Closed Bug 460335 Opened 16 years ago Closed 15 years ago

disallow redirects when updating an application cache

Categories

(Core :: Networking: Cache, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: dcamp, Assigned: mayhemer)

References

()

Details

(Keywords: fixed1.9.1)

Attachments

(1 file, 3 obsolete files)

The application cache spec has changed to completely disallow redirects during a cache update (primarily to avoid problems with captive portals).
Flags: blocking1.9.1?
OS: Mac OS X → All
Hardware: PC → All
Summary: disallow redirects when fetching from an application cache → disallow redirects when updating an application cache
Assignee: nobody → dcamp
Flags: blocking1.9.1? → blocking1.9.1+
Depends on: 460328, 443017
Attached patch v1 (obsolete) — Splinter Review
Disabling redirects, make them fatal for manifest and explicit/fallback entries. Includes tests for non-fatal and fatal entry redirects during update and fatal redirect during fetching manifest itself.
Assignee: dcamp → honzab
Status: NEW → ASSIGNED
Attachment #346044 - Flags: review?(dcamp)
Attached patch v2 (obsolete) — Splinter Review
As discussed with dcamp on IRC added check to the channel's status to catch redirects and also any call to channel's Cancel() with failure status (e.g. a user call). This removes need for mRedirected member. Tests have better names.
Attachment #346044 - Attachment is obsolete: true
Attachment #346144 - Flags: review?(dcamp)
Attachment #346044 - Flags: review?(dcamp)
Attachment #346144 - Flags: superreview?(cbiesinger)
Attachment #346144 - Flags: review?(dcamp)
Attachment #346144 - Flags: review+
Attachment #346144 - Flags: superreview?(cbiesinger) → superreview+
Attached patch v3 (obsolete) — Splinter Review
After IRC discussion with dave camp:
- disallowing redirect only when it is not an internal redirect (e.g. proxy replace); redirect abort implemented as cancel of the original channel (as in the previous patch)
- when update is canceled by user we catch it now (indicated by httpChannel->GetStatus(&status), NS_FAILED(status)); there is no worry about offline cache entry used as a main entry, we open it just for READ access
- now network errors are handled correctly

We have to file bugs for handling redirect when normally fetching using an offline cache (if not already fixed) and when loading master entries.
Attachment #346144 - Attachment is obsolete: true
Attachment #346491 - Flags: review?(dcamp)
Priority: -- → P3
Comment on attachment 346491 [details] [diff] [review]
v3


>diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
>--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
>+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp

>     }
>+    NS_ENSURE_SUCCESS(rv, rv);
> 
>+    // Server responded with an error state, let the upper level know about it.
>+    *aStatus = PRUint16(httpStatus);
>+    if (httpStatus >= 400) {
>+        return NS_OK;
>+    }

You might want to use GetRequestSucceeded() here, and maybe include a comment explaining that we need to do this before httpChannel->GetStatus() because we want a server error code to be reported to the caller even if we canceled the channel.
Attachment #346491 - Flags: review?(dcamp) → review+
(In reply to comment #4)

> >+    // Server responded with an error state, let the upper level know about it.
> >+    *aStatus = PRUint16(httpStatus);
> >+    if (httpStatus >= 400) {
> >+        return NS_OK;
> >+    }
> 
> You might want to use GetRequestSucceeded() here, and maybe include a comment
> explaining that we need to do this before httpChannel->GetStatus() because we
> want a server error code to be reported to the caller even if we canceled the
> channel.

Honza pointed out that 3xx codes will be canceled, and we want to treat those as an error.  So the code in the patch be fine.  We need some clear documentation here, since this is kind of strange.
There are more changes, so rerequsting review.
Attachment #346491 - Attachment is obsolete: true
Attachment #356115 - Flags: review?(dcamp)
Comment on attachment 356115 [details] [diff] [review]
v3.1
[Checkin: Comment 11]

Yeah, I like this one better.
Attachment #356115 - Flags: superreview?(cbiesinger)
Attachment #356115 - Flags: review?(dcamp)
Attachment #356115 - Flags: review+
Attachment #356115 - Flags: superreview?(cbiesinger) → superreview+
Comment on attachment 356115 [details] [diff] [review]
v3.1
[Checkin: Comment 11]

You didn't add a comment explaining why you call GetRequestSucceeded before GetStatus, can you do that?

-        if (mState >= nsIDOMLoadStatus::RECEIVING) {
-            *aStatus = NS_ERROR_NOT_AVAILABLE;
-            return NS_OK;
-        }

Why did you remove this code?
That snippet was mirroring xmlhttprequest behavior but xmlhttprequets has changed to return just 0 here and we needed to change it also for internal logic of the class.
Landed on moz-central as ab54983d6ad5.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Attachment #356115 - Attachment description: v3.1 → v3.1 [Checkin: Comment 11]
(In reply to comment #10)
> Landed on moz-central as ab54983d6ad5.

This never happened, afaict.
Status: RESOLVED → REOPENED
Flags: in-testsuite+
Resolution: FIXED → ---
Whiteboard: [needs m-c(!) landing]
Target Milestone: --- → mozilla1.9.2a1
Version: unspecified → Trunk
http://hg.mozilla.org/mozilla-central/rev/413fc69d3b3d
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Whiteboard: [needs m-c(!) landing]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: