PHP Image Host - Sending HTTP Headers Twice?
| From: | APseudoUtopia | Date: | Mon, 10 May 2010 20:19:34 +0000 |
| Subject: | PHP Image Host - Sending HTTP Headers Twice? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-305052@lists.php.net to get a copy of this message | ||
I have a php script which serves an image. It's very simple:
header('Content-Type: image/' . $ImageData['content_type']);
readfile($File);
When viewing the script with the Firefox Extension: LiveHTTPHeaders,
it gives the following output for a SINGLE request:
----------------------------------------------------------
https://domain.tld/img.php?i=260
GET /img.php?i=260 HTTP/1.1
Host: domain.tld
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
Cookie: session=blahblah
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 10 May 2010 20:17:09 GMT
Content-Type: image/jpeg
Transfer-Encoding: chunked
Connection: keep-alive
----------------------------------------------------------
https://domain.tld/img.php?i=260
GET /img.php?i=260 HTTP/1.1
Host: domain.tld
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 10 May 2010 20:17:10 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip
----------------------------------------------------------
As you can see, the browser is requesting the image twice, and PHP is
sending two different Content-Type headers. Why is this?