Bug 13710

Summary: HTTP headers being displayed in page body
Product: WebKit Reporter: Alex Stapleton <alex.stapleton>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: alex.stapleton, mrowe
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
URL: http://www.webkit.com
Attachments:
Description Flags
Displaying headers on an empty 302 redirect page.
none
Headers being displayed on a fairly normal page.
none
Packet dump of session where 1 request displayed headers in the page
none
Packet dump during which headers are displayed. none

Description Alex Stapleton 2007-05-14 06:34:25 PDT
Occasionally HTTP headers seem to leak into the page body as seen in the attached screenshots. This only seems to happen quite rarely though, maybe 1 page in 20 or more. Viewing the source of the page shows the headers in it as well.

I have only tried this while behind a Squid proxy so far.

This bug appears to be related to http://bugs.webkit.org/show_bug.cgi?id=4619

This bug also appears on my companies website (http://www.advfn.com/p.php?pid=sitemap is a good page to try it on) we do not run mod_layout.
Comment 1 Alex Stapleton 2007-05-14 06:38:18 PDT
Created attachment 14544 [details]
Displaying headers on an empty 302 redirect page.
Comment 2 Alex Stapleton 2007-05-14 06:39:39 PDT
Created attachment 14545 [details]
Headers being displayed on a fairly normal page.
Comment 3 Alex Stapleton 2007-05-14 07:08:57 PDT
Created attachment 14546 [details]
Packet dump of session where 1 request displayed headers in the page

The first couple of hits to http://www.advfn.com/p.php?pid=sitemap&cb=1179150783 where fine, the last one had headers in it.
Comment 4 Alex Stapleton 2007-05-14 07:16:08 PDT
Comment on attachment 14546 [details]
Packet dump of session where 1 request displayed headers in the page

I suck and didn't set the snaplen :-/
Comment 5 Alex Stapleton 2007-05-14 07:17:11 PDT
Created attachment 14547 [details]
Packet dump during which headers are displayed.

The last hit to http://www.advfn.com/p.php?pid=sitemap&cb=1179150783 had headers displayed in it.
Comment 6 Mark Rowe (bdash) 2007-05-14 09:39:38 PDT
Based on the packet trace it appears something is sending buggy HTTP responses.  There are two responses in which the Content-Length mentioned in the header does not match the apparent length of the data:

('192.168.0.13', '192.168.0.52', 3128, 55552)
HTTP/1.0 200 OK
Server: Mathopd/1.5p5
Date: Mon, 14 May 2007 14:00:31 GMT
Content-Type: text/css
Content-Length: 28623
Last-Modified: Wed, 04 Apr 2007 08:05:32 GMT
X-Cache: MISS from localhost.localdomain
X-Cache-Lookup: HIT from localhost.localdomain:3128
Proxy-Connection: keep-alive

Content-Length header says:  28623
Next response start appears to be at:  23102

and

('192.168.0.13', '192.168.0.52', 3128, 55557)
HTTP/1.0 200 OK
Server: DCLK-AdSvr
Content-Type: text/html
Content-Length: 3939
Set-Cookie: test_cookie=CheckForPermission; path=/; domain=.doubleclick.net; expires=Mon, 14 May 2007 14:15:27 GMT
P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Cache-Control: no-cache
Pragma: no-cache
X-Cache: MISS from localhost.localdomain
X-Cache-Lookup: MISS from localhost.localdomain:3128
Proxy-Connection: keep-alive

Content-Length header says:  3939
Next response start appears to be at:  3940



In the case of the former it looks as though the upstream proxy server starts sending packets from an entirely *different* TCP connection to this port.  I can't think of any reasonable explanation for the mixed up packets, but it's very probable that they are the cause of the headers appearing on the page.  Squid or any network device along the trip could be to blame.
Comment 7 Mark Rowe (bdash) 2007-05-14 09:41:09 PDT
Closing as INVALID as analysis of the packet trace suggests the response stream is garbled before it reaches Safari.