<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/115651/">https://git.reviewboard.kde.org/r/115651/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">As stated in the bug report it is also true that every other browsers rewrite POST method to GET when following 301/302 redirections. This behavior could also be verified in curl by issuing the following commands:
curl -L --data "fakepostdata" http://greenbytes.de/tech/tc/httpredirects/redirect_with_status.cgi?301
curl -L --data "fakepostdata" http://greenbytes.de/tech/tc/httpredirects/redirect_with_status.cgi?302
We could/should do the same for compatibility.
In that case the snippet of code that handles 301-303 http status codes may assume this form:
} else if (m_request.responseCode >= 301 && m_request.responseCode<= 303) {
// NOTE: This is wrong according to RFC 2616 (section 10.3.[2-4,8]).
// However, because almost all client implementations treat a 301/302
// response as a 303 response in violation of the spec, many servers
// have simply adapted to this way of doing things! Thus, we are
// forced to do the same thing. Otherwise, we loose compatibility and
// might not be able to correctly retrieve sites that redirect.
if (m_request.responseCode == 301) { // Moved permanently
setMetaData(QLatin1String("permanent-redirect"), QLatin1String("true"));
if (m_request.method == HTTP_POST) {
m_request.method = HTTP_GET; // FORCE a GET
setMetaData(QLatin1String("redirect-to-get"), QLatin1String("true"));
}
} else if (m_request.responseCode == 302) { // Moved temporarily
if (m_request.method == HTTP_POST) {
m_request.method = HTTP_GET; // FORCE a GET
setMetaData(QLatin1String("redirect-to-get"), QLatin1String("true"));
}
} else { // 303 See Other
if (m_request.method != HTTP_HEAD) {
m_request.method = HTTP_GET; // FORCE a GET
setMetaData(QLatin1String("redirect-to-get"), QLatin1String("true"));
}
}
}
...or something like that.</pre>
<br />
<p>- Andrea Iacovitti</p>
<br />
<p>On February 11th, 2014, 10:28 a.m. UTC, Dawit Alemayehu wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for kdelibs, Andreas Hartmetz and David Faure.</div>
<div>By Dawit Alemayehu.</div>
<p style="color: grey;"><i>Updated Feb. 11, 2014, 10:28 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=330795">330795</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kdelibs
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The attached patch fixes how we handle HTTP redirection. Currently KIO does not correctly handle a "303 See Other" response. Instead of converting the redirection request to a GET operation as specified in the RFC, KIO simply repeats the same operation with the redirect URL. Additionally, KIO does not handle redirection of a delete operation that is handled internally.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Run tests at
http://greenbytes.de/tech/tc/httpredirects/t301methods.html
http://greenbytes.de/tech/tc/httpredirects/t302methods.html
http://greenbytes.de/tech/tc/httpredirects/t303methods.html</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>kio/DESIGN.metadata <span style="color: grey">(1351119)</span></li>
<li>kio/kio/accessmanager.cpp <span style="color: grey">(7a806e8)</span></li>
<li>kio/kio/job.cpp <span style="color: grey">(13107c2)</span></li>
<li>kioslave/http/http.cpp <span style="color: grey">(b13eed1)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/115651/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>