Re: HTTP headers, IE and downloading
| From: | Andreas Korthaus | Date: | Tue, 23 Dec 2003 00:00:19 +0000 |
| Subject: | Re: HTTP headers, IE and downloading | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173210@lists.php.net to get a copy of this message | ||
Hi!
Andreas Magnusson wrote:
>> Have a look at: http://pear.php.net/package/HTTP_Download
> I looked at it and it's hard to see what it does differently from
> what I do...
Use Ethereal or your own tracer to find out! And compare to a direct request
to a real file!
AFAIK the headers sent here are:
'Content-Type' => 'application/x-octetstream', (perhaps other)
'Cache-Control' => 'public',
'Accept-Ranges' => 'bytes',
'Connection' => 'close'
>> And the first comment of:
>>
>> http://www.php.net/manual/en/function.session-cache-limiter.php
> Thanks, I've read that and I'm not using output compression.
Did you try something like this:
<?php
header("Content-Type: application/pdf");
header("Content-Disposition: inline; filename=foo.pdf");
header("Accept-Ranges: bytes");
header("Content-Length: $len");
header("Expires: 0");
header("Cache-Control: private");
// header("Pragma: no-cache");//don't send this header!!
?>
What headers are sent at this moment? Could you post them?
>> Perhaps you should not use ouput-compression, and look at the headers
>> generated by PHP
>>
>> What headers are sent? Do you use sessions?
>
> I use sessions, and I've tried to send the same headers as the
> webserver sends if I download a file directly (rather than through
> PHP).
> It doesn't work... Maybe I should just create a temporary file and
> relocate the browser to it in case the browser is IE...
If you send the same headers and the same data - there _can_not_ be any
difference. How should your client recognize any difference? There _must_ be
a difference! Use a very small file to test it, so you can compare the whole
HTTP-Header + Body easily.
>> you can see this using Mozilla + Live Headers, Ethereal,
>> http://schroepl.net/cgi-bin/http_trace.pl ...
>
> Thanks, I've written my own HTTP header tracer in C++, but it hasn't
> been able to help me since the headers looks good to me...
Oh, I could not know ;-)
Kind Regards,
Andreas