Bug 41571 - [Qt] Fix http/tests/loading/redirect-methods.html
Summary: [Qt] Fix http/tests/loading/redirect-methods.html
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: QtWebKit Unassigned
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2010-07-03 14:13 PDT by Robert Hogan
Modified: 2010-10-01 11:40 PDT (History)
8 users (show)

See Also:


Attachments
Patch (6.07 KB, patch)
2010-07-03 14:27 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (4.61 KB, patch)
2010-09-06 14:00 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (4.70 KB, patch)
2010-09-27 13:25 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (4.38 KB, patch)
2010-09-27 13:58 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff
Patch (4.37 KB, patch)
2010-09-30 14:03 PDT, Robert Hogan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Hogan 2010-07-03 14:13:30 PDT
and document our redirection behaviour.
Comment 1 Robert Hogan 2010-07-03 14:27:25 PDT
Created attachment 60459 [details]
Patch
Comment 2 Kenneth Rohde Christiansen 2010-07-03 15:23:52 PDT
Brady, can you have a look at this?
Comment 3 Adam Barth 2010-07-07 03:52:43 PDT
Comment on attachment 60459 [details]
Patch

I know how all this stuff is supposed to work, but I'm too tired right now to remember.  If you don't get a review soon, feel free to ping me and I'll look in more detail.  In general, what the RFC says about this stuff is bogus.  :(
Comment 4 Adam Barth 2010-07-27 07:30:36 PDT
Comment on attachment 60459 [details]
Patch

Your comment is making me think you don't know this history of this topic.  How to handle these redirects is a somewhat sad tale.  The requirements for these status codes are changing in the next generation of the HTTP spec to more closely align with reality.

I need to look up the proper behavior, but POST shouldn't be special-cased.  I think HEAD (and possibly OPTIONS) are the only ones with special cases.
Comment 5 Robert Hogan 2010-07-27 13:31:52 PDT
(In reply to comment #4)
> (From update of attachment 60459 [details])
> Your comment is making me think you don't know this history of this topic.  How to handle these redirects is a somewhat sad tale.  The requirements for these status codes are changing in the next generation of the HTTP spec to more closely align with reality.
> 
> I need to look up the proper behavior, but POST shouldn't be special-cased.  I think HEAD (and possibly OPTIONS) are the only ones with special cases.

So the code is wrong as well as the comments? I thought http/tests/loading/redirect-methods.html and others were all about handling cases where POST was used and multiple redirects followed.

I'm confused now.
Comment 6 Robert Hogan 2010-09-06 14:00:38 PDT
Created attachment 66668 [details]
Patch
Comment 7 Robert Hogan 2010-09-06 14:02:10 PDT
(In reply to comment #4)
> (From update of attachment 60459 [details])
> Your comment is making me think you don't know this history of this topic.  How to handle these redirects is a somewhat sad tale.  The requirements for these status codes are changing in the next generation of the HTTP spec to more closely align with reality.
> 
> I need to look up the proper behavior, but POST shouldn't be special-cased.  I think HEAD (and possibly OPTIONS) are the only ones with special cases.

I've resubmitted and removed the comments about the RFC. I just describe what we do in order to pass the layout tests.
Comment 8 Adam Barth 2010-09-27 10:54:26 PDT
Comment on attachment 66668 [details]
Patch

I don't think this is quite right.  You shouldn't need m_receivedPermanentRedirect.  What happens is that the first 301 (or whatever) changes the method to GET.  By the time you get to the 307, you shouldn't have a POST method anymore.  307 should always preserve the method of the request that received the 307.  That's the whole point of 307 existing.
Comment 9 Robert Hogan 2010-09-27 12:46:38 PDT
(In reply to comment #8)
> (From update of attachment 66668 [details])
> I don't think this is quite right.  You shouldn't need m_receivedPermanentRedirect.  What happens is that the first 301 (or whatever) changes the method to GET.  

Yes.

>By the time you get to the 307, you shouldn't have a POST method anymore.  
We do. We have it in the original request (m_resourceHandle->firstRequest()), which is what QNetworkReplyHandler inspects here. We don't currently keep a record of the most recent method sent in response to a redirect.

>307 should always preserve the method of the request that received the 307.  That's the whole point of 307 existing.

OK. The patch does that though - by reinstating the GET used for the previous 301-303, if that was what was used.

The code in sendResponseIfNeeded() isn't very clear so I'll refactor it.
Comment 10 Robert Hogan 2010-09-27 13:25:15 PDT
Created attachment 68949 [details]
Patch
Comment 11 Early Warning System Bot 2010-09-27 13:35:28 PDT
Attachment 68949 [details] did not build on qt:
Build output: http://queues.webkit.org/results/4057156
Comment 12 Robert Hogan 2010-09-27 13:58:30 PDT
Created attachment 68951 [details]
Patch
Comment 13 Adam Barth 2010-09-30 11:19:03 PDT
Comment on attachment 68951 [details]
Patch

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

Looks great!  Thanks.

> WebCore/platform/network/qt/QNetworkReplyHandler.cpp:393
> +        if ((statusCode >= 301 && statusCode <= 303) &&  m_resourceHandle->firstRequest().httpMethod() == "POST")

You've got an extra space in "&&  m_resourceHandle"
Comment 14 Robert Hogan 2010-09-30 14:03:37 PDT
Created attachment 69379 [details]
Patch
Comment 15 WebKit Commit Bot 2010-10-01 11:40:31 PDT
Comment on attachment 69379 [details]
Patch

Clearing flags on attachment: 69379

Committed r68906: <http://trac.webkit.org/changeset/68906>
Comment 16 WebKit Commit Bot 2010-10-01 11:40:38 PDT
All reviewed patches have been landed.  Closing bug.