Bug 70683 - [Qt] Change HTTP redirection behavior to match Firefox/Chromium
Summary: [Qt] Change HTTP redirection behavior to match Firefox/Chromium
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2011-10-22 12:24 PDT by Dawit A.
Modified: 2019-05-03 19:52 PDT (History)
2 users (show)

See Also:


Attachments
proposed patch I (1.31 KB, patch)
2011-10-22 12:27 PDT, Dawit A.
no flags Details | Formatted Diff | Diff
proposed patch II (1.39 KB, patch)
2011-10-22 13:06 PDT, Dawit A.
no flags Details | Formatted Diff | Diff
proposed patch II (Updated) (2.30 KB, patch)
2011-10-23 09:49 PDT, Dawit A.
hausmann: review-
Details | Formatted Diff | Diff
proposed patch I (Updated) (2.09 KB, patch)
2011-10-23 09:53 PDT, Dawit A.
hausmann: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dawit A. 2011-10-22 12:24:22 PDT
QtWebKit currently does not handle the 303 redirection response from a server correctly. According to RFC 2616 section 10.3.4, a 303 redirect should always be converted into a GET request before it is retrieved again. However, QtWebKit does not do that for both PUT and DELETE requests.

Actually what QtWebKit is currently doing, though very adherent to the spec, won't work with lots of broken servers out in the wild. That is because many server implementations incorrectly return a 301 or 302 response when they should actually be returing a 303. As a result, browsers like Chromium and Firefox treat all redirection response codes the same and simply convert all requests into a GET operation on redirection.

Though I personally believe that QtWebKit's behavior should be changed to match Firefox for maximum compatability, the attached patch only addresses the broken behavior of the 303 redirection.
Comment 1 Dawit A. 2011-10-22 12:27:00 PDT
Created attachment 112094 [details]
proposed patch I

Fix the 303 redirection bug for PUT and DELETE requests.
Comment 2 Dawit A. 2011-10-22 13:06:12 PDT
Created attachment 112097 [details]
proposed patch II

Change the redirection behavior to match that of Firefox and Chromium for all requests except HEAD.
Comment 3 Dawit A. 2011-10-23 09:49:45 PDT
Created attachment 112115 [details]
proposed patch II (Updated)

Added missing changelog information.
Comment 4 Dawit A. 2011-10-23 09:53:18 PDT
Created attachment 112116 [details]
proposed patch I (Updated)

Added missing changelog information.
Comment 5 Dawit A. 2011-10-23 09:55:54 PDT
A site where you can test redirection behavior:

http://www.mnot.net/javascript/xmlhttprequest/
Comment 6 Simon Hausmann 2011-10-24 02:07:30 PDT
Comment on attachment 112115 [details]
proposed patch II (Updated)

View in context: https://bugs.webkit.org/attachment.cgi?id=112115&action=review

Generally I would prefer this approach to the other one. But that's just MHO, I'm not a real expert on this particular topic.

> Source/WebCore/ChangeLog:13
> +        No new tests required as existing redirection tests should cover this
> +        scenario as well.

Hm, this _is_ touchy code. I think that this patch should add a (http) layout test to cover this. If there exists a test already, then it should be unskipped.
Comment 7 Dawit A. 2011-10-24 06:38:24 PDT
(In reply to comment #6)
> (From update of attachment 112115 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=112115&action=review
> 
> Generally I would prefer this approach to the other one. But that's just MHO, I'm not a real expert on this particular topic.

So do I and I do not think any particular exerptise is required for addressing this particular problem. The RFC on the topic, RFC 2616 section 10.3, is clear as a day light and so is the violation by the other browsers. One would only have to vist the wonderful test site mentioned in comment #5 with QtTestBrowser, Firefox and Chromium to see the differences in behavior. I think addressing that should be a no brainer since QtWebKit should be as close to these widely deployed browsers as possible.

Since we seem to agree this is the best approach, I will change this bug's title to match this patch.

> > Source/WebCore/ChangeLog:13
> > +        No new tests required as existing redirection tests should cover this
> > +        scenario as well.
> 
> Hm, this _is_ touchy code. I think that this patch should add a (http) layout test to cover this. If there exists a test already, then it should be unskipped.

There is already a layout test that was added due to another bug I reported a while back and I do not think it is skipped. See 

https://bugs.webkit.org/show_bug.cgi?id=60440#c24

However, I am unsure if the tests cover all the HTTP operations or just POST.
Comment 8 Simon Hausmann 2011-10-27 04:53:23 PDT
(In reply to comment #7)
> Since we seem to agree this is the best approach, I will change this bug's title to match this patch.
> 
> > > Source/WebCore/ChangeLog:13
> > > +        No new tests required as existing redirection tests should cover this
> > > +        scenario as well.
> > 
> > Hm, this _is_ touchy code. I think that this patch should add a (http) layout test to cover this. If there exists a test already, then it should be unskipped.
> 
> There is already a layout test that was added due to another bug I reported a while back and I do not think it is skipped. See 
> 
> https://bugs.webkit.org/show_bug.cgi?id=60440#c24
> 
> However, I am unsure if the tests cover all the HTTP operations or just POST.

Let me try to clarify: What I'd like to see is a test that is executed and that fails unless your fix is applied :)
Comment 9 Simon Hausmann 2011-11-03 08:28:09 PDT
Comment on attachment 112115 [details]
proposed patch II (Updated)

r- . This is unfortunately rather touchy code and the patch should be accompanied with either a change to the skip list to unskip a test that is currently failing because of the absence of this patch _or_ a new layout test is added.
Comment 10 Simon Hausmann 2011-11-03 08:28:38 PDT
Comment on attachment 112116 [details]
proposed patch I (Updated)

Taking this one also out of the review queue. See https://bugs.webkit.org/show_bug.cgi?id=70683#c8
Comment 11 Jocelyn Turcotte 2014-02-03 03:19:07 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.