In an attempt to put a stake through this one: it appears that
the headers:
Accept-Ranges: bytes
ETag: "ac0f-2743f-3a2ebf5b"
cause trouble. I gather these are supposed to be server
generated (in particular the "Entity-Tag" is a server(?)
specific code for a file type; Accept-ranges means the
server'll allow "header and some bytes more" requests),
and either I'm doing them wrong or they confuse both IE
and NE. If anybody has a hint ... here's the final
code, FWIW:
my $debug = 0;
my $path = "/web/images";
my $file = $ENV{PATH_INFO};
$file =~ s#^[^/]*##;
$file =~ s#[^/\d-\.\w]##g;
my $pdf_file = $path . $file;
if ( -s $pdf_file ) {
print "Content-Type: application/pdf\n";
#print "Accept-Ranges: bytes\n";
#print "Accept-Ranges: none\n";
#print "ETag: \"ac0f-2743f-3a2ebf5b\"\n";
#print "Last-Modified: Wed, 06 Dec 2000 22:36:11 GMT\n\n";
my ($size, $mtime) = (stat $pdf_file)[7,9];
print "Last-Modified: ", scalar gmtime($mtime), "GMT\n";
print "Content-length: $size\n";
# print "Content-disposition: attachement; filename=$pdf_file_name\n"
+;
print "\n";
open(PDF, "$pdf_file" ) or die "Can't open pdf $pdf_file: $!";
print <PDF>;
close PDF;
print STDERR "documents: $pdf_file, $size\n" if $debug > 5;
} else {
print "Content-Type: text/html\n";
print "\n";
print "<h1>Error</h1>\n
Image file : $file is missing!!!
<p>
<hr>
";
}
a
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.