Review Request 116017: Implement POST -> POST redirection support in KIO
Andrea Iacovitti
aiacovitti at libero.it
Wed Feb 26 16:04:49 GMT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116017/#review50948
-----------------------------------------------------------
kio/kio/job.cpp
<https://git.reviewboard.kde.org/r/116017/#comment35767>
This seems not needed. We can handle GET redirection just by setting "redirect-to-get" to "true"; in this case we already set "d->m_command = CMD_GET" before the switch statement, then "case CMD_SPECIAL:" will not be executed.
(See also related comments on http.cpp part)
kioslave/http/http.cpp
<https://git.reviewboard.kde.org/r/116017/#comment35760>
You removed "case 302" (may be unintentionally ?)
We should check for m_request.sentMethodString == "POST" otherwise PUT (or DELETE) method with body data (i.e. m_request.method == HTTP_POST and m_request.sentMethod == (PUT || DELETE) ) will be rewritten to GET (wrong!) for 301/302 response code.
This will happen in kio/job.cpp where we end up to execute the "case CMD_SPECIAL" code with redirectToGet != "false" (actually empty)
kioslave/http/http.cpp
<https://git.reviewboard.kde.org/r/116017/#comment35764>
It seems to me this "case 307" is not needed, we know the only case in which a redirect to GET have to be performed is for 301/302 response and method POST (and for 303, but this case is already handled just above): 307, 308 never rewrite method.
On overall i think this part of code doesn't need modifications, except removing the "m_request.method = HTTP_GET; // FORCE a GET" parts that, yes, seem not needed.
- Andrea Iacovitti
On Feb. 26, 2014, 8:34 a.m., Dawit Alemayehu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116017/
> -----------------------------------------------------------
>
> (Updated Feb. 26, 2014, 8:34 a.m.)
>
>
> Review request for kdelibs, Andrea Iacovitti and David Faure.
>
>
> Repository: kdelibs
>
>
> Description
> -------
>
> The attached patch implements support for redirecting one POST request to another in KIO. Unless implicitly disabled currently the automatic redirection handler in KIO always redirects any POST requests to a GET.
>
> Note this patch also changes the original KIO::http_post implementation that accepted a QByteArray to simply store the data in a QBuffer and call the newer implementation that uses a QIODevice. I have updated the documentation for the original implementation to state as such and encourage developers to directly use the newer http_post method instead. Not sure if everyone will agree with my implementation but it makes it much easier to resend POST data on redirection.
>
>
> Diffs
> -----
>
> kio/kio/job.h aeaffa2
> kio/kio/job.cpp edc5fed
> kio/kio/job_p.h 5ead3ed
> kioslave/http/http.cpp 9eba5d1
>
> Diff: https://git.reviewboard.kde.org/r/116017/diff/
>
>
> Testing
> -------
>
> http://greenbytes.de/tech/tc/httpredirects/t307methods.html
> http://greenbytes.de/tech/tc/httpredirects/t308methods.html
>
>
> Thanks,
>
> Dawit Alemayehu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140226/7c528a25/attachment.htm>
More information about the kde-core-devel
mailing list