Closed Bug 263903 Opened 20 years ago Closed 20 years ago

redirects with a body not cached properly

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: dbaron, Assigned: darin.moz)

Details

(Whiteboard: [ready to land])

Attachments

(1 file)

We don't seem to cache redirects with a body.  If I serve an Apache asis file
containing:

Status: 301 Moved Permanently
Location: http://www.mozilla.org/
Cache-Control: max-age=86400
Content-Type: text/plain
                                                                               
http://www.mozilla.org/

and load it twice in the same browser session, I get two hits on the server. 
The second load, an NSPR log shows:

Cached data size does not match the Content-Length header
[content-length=24 size=0]
(I was actually seeing this on an aviary branch build, but darin thinks it's on
the trunk as well and has been around for a while.)
Summary: redirects with a body not cached → redirects with a body not cached properly
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8beta
See
http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpChannel.cpp#741
(the "don't store the response body for redirects" comment).
Attached patch v1 patchSplinter Review
Attachment #162666 - Flags: superreview?(bzbarsky)
Attachment #162666 - Flags: review?(cbiesinger)
Attachment #162666 - Flags: review?(cbiesinger) → review+
Comment on attachment 162666 [details] [diff] [review]
v1 patch

So this just skips doing the content-length comparison and ensuing cache
invalidate for cases when we have a redirect?

If so, sr=bzbarsky.  If I misunderstood something, please tell me what.  ;)
Attachment #162666 - Flags: superreview?(bzbarsky) → superreview+
> So this just skips doing the content-length comparison and ensuing cache
> invalidate for cases when we have a redirect?
> 
> If so, sr=bzbarsky.  If I misunderstood something, please tell me what.  ;)

you are correct.  the alternative would have been to strip the Content-Length
header before inserting the headers into the cache, but since i realized that we
also have the same bug for HEAD responses, i figured it was best to put all of
the checking into CheckCache.
Whiteboard: [ready to land]
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: