Review Request 115689: Fix khtml/ecma/xmlhttprequest.cpp to properly handle HEAD requests

Dawit Alemayehu adawit at kde.org
Sun Feb 16 19:09:02 GMT 2014



> On Feb. 16, 2014, 12:38 a.m., Andrea Iacovitti wrote:
> > khtml/ecma/xmlhttprequest.cpp, line 512
> > <https://git.reviewboard.kde.org/r/115689/diff/2/?file=244040#file244040line512>
> >
> >     This does not seems to fix the "POST->POST redirection with no content on 307 response" issue, instead it has the side effect that POST method is rewritten to GET in 307 redirection.Also it doesn't make possible to do an XHR PUT request with content (!_body.isEmpty()) as actually a POST request is sent to the origin server and not a PUT.
> >     We use KIO::http_post (regardless of method) whenever we need to send a request that includes content, even for methods that do not have a defined semantics for entity-body (e.g. DELETE).
> >     So setting custom method it's always needed.

The reason a POST method is rewritten to GET in a 307 redirection has to do with how we originally chose to deal with POST redirection in KIO::TransferJob. Right now all POST redirections are converted to GET regardless of the HTTP status code in TransferJob::slotFinished in job.cpp. See the CMD_SPECIAL section of the switch statement in that function.

As far as then issue with the PUT request and an entity-body, kio_http was designed only to send the entity-body to the server for POST and other webdav requests. Anything that is done to skirt around that to me is a hack by definition. What would be the purpose of allowing entity-body for methods that are not supposed to have such thing, e.g. DELETE?

Anyhow, I do not want to cause regression ; so I will roll back this patch to the way things were. However, those POST->POST redirection tests it seems to pass are wrong because it never sends the entity-body to the redirected resource.


- Dawit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115689/#review49889
-----------------------------------------------------------


On Feb. 14, 2014, 4 p.m., Dawit Alemayehu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115689/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2014, 4 p.m.)
> 
> 
> Review request for kdelibs and Andrea Iacovitti.
> 
> 
> Bugs: 331007
>     http://bugs.kde.org/show_bug.cgi?id=331007
> 
> 
> Repository: kdelibs
> 
> 
> Description
> -------
> 
> Fix khtml/ecma/xmlttprequest.cpp such that it correctly handles HEAD requests without a noticable delay, i.e. use KIO::mimeType instead of KIO::get. Otherwise, the request will wait for the content which is not returned when doing a stat operation like HEAD.
> 
> 
> Diffs
> -----
> 
>   khtml/ecma/xmlhttprequest.cpp b3707e7 
>   kio/kio/job.cpp abb3dfd 
> 
> Diff: https://git.reviewboard.kde.org/r/115689/diff/
> 
> 
> Testing
> -------
> 
> Tested HEAD redirection with http://greenbytes.de/tech/tc/httpredirects/
> 
> 
> Thanks,
> 
> Dawit Alemayehu
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140216/33e141cd/attachment.htm>


More information about the kde-core-devel mailing list