Bug 80551 - REGRESSION (r107672): Cached empty XMLHttpRequest responses are not delivered
Summary: REGRESSION (r107672): Cached empty XMLHttpRequest responses are not delivered
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P1 Critical
Assignee: Nate Chapin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-03-07 16:52 PST by Alexey Proskuryakov
Modified: 2012-03-09 09:50 PST (History)
3 users (show)

See Also:


Attachments
test case (1.52 KB, application/zip)
2012-03-07 16:52 PST, Alexey Proskuryakov
no flags Details
patch (4.33 KB, patch)
2012-03-08 14:24 PST, Nate Chapin
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2012-03-07 16:52:33 PST
If a response is cached with ETag, it cannot be fetched from cache with XMLHttpRequest.

To reproduce, 
1. unpack attached files into LayoutTests/http/tests, 
2. run-webkit-httpd,
3. Open http://127.0.0.1:8000/304.html,
4. Follow instructions in test.
Comment 1 Alexey Proskuryakov 2012-03-07 16:52:58 PST
Created attachment 130726 [details]
test case
Comment 2 Alexey Proskuryakov 2012-03-07 16:53:14 PST
<rdar://problem/10979550>
Comment 3 Nate Chapin 2012-03-07 17:18:35 PST
(In reply to comment #2)
> <rdar://problem/10979550>

(In reply to comment #0)
> If a response is cached with ETag, it cannot be fetched from cache with XMLHttpRequest.
> 
> To reproduce, 
> 1. unpack attached files into LayoutTests/http/tests, 
> 2. run-webkit-httpd,
> 3. Open http://127.0.0.1:8000/304.html,
> 4. Follow instructions in test.

I'm wondering if we should perhaps switch to requiring identical headers except a whitelist, rather than presuming reuse is ok with a blacklist, as proposed in https://bugs.webkit.org/show_bug.cgi?id=80334

What do you think?
Comment 4 Alexey Proskuryakov 2012-03-07 17:24:54 PST
This sounds reasonable to me, but I don't see the connection to this bug. Here, no response is delivered at all, not even a stale one.
Comment 5 Nate Chapin 2012-03-08 09:38:49 PST
(In reply to comment #4)
> This sounds reasonable to me, but I don't see the connection to this bug. Here, no response is delivered at all, not even a stale one.

Sorry, I misread the report. That's bad, will look at this today.
Comment 6 Nate Chapin 2012-03-08 12:56:56 PST
(In reply to comment #5)
> (In reply to comment #4)
> > This sounds reasonable to me, but I don't see the connection to this bug. Here, no response is delivered at all, not even a stale one.
> 
> Sorry, I misread the report. That's bad, will look at this today.

This appears to be more general than just etags. When the content of a cached xhr is valid but empty, we exit too early in CachedRawResource::didAddClient() and leave the load hanging.
Comment 7 Alexey Proskuryakov 2012-03-08 13:05:57 PST
Re-titling accordingly.
Comment 8 Nate Chapin 2012-03-08 14:24:53 PST
Created attachment 130905 [details]
patch
Comment 9 Nate Chapin 2012-03-09 09:37:00 PST
Landed: http://trac.webkit.org/changeset/110301