[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kioslave/http
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2010-05-03 16:54:34
Message-ID: 20100503165434.08E35AC8AA () svn ! kde ! org
[Download RAW message or body]
SVN commit 1122350 by adawit:
- Only change a POST HTTP method to GET on redirections.
- Make sure you only change the protocol from "webdav" to "http"
in copy and rename member functions.
- Trim trailing whitespace from the debug output of sent and
received HTTP headers.
M +10 -20 http.cpp
--- trunk/KDE/kdelibs/kioslave/http/http.cpp #1122349:1122350
@@ -1319,7 +1319,7 @@
KUrl newDest = dest;
if (newDest.protocol() == QLatin1String("webdavs"))
newDest.setProtocol(QLatin1String("https"));
- else
+ else if (newDest.protocol() == QLatin1String("webdav"))
newDest.setProtocol(QLatin1String("http"));
m_request.method = DAV_COPY;
@@ -1349,7 +1349,7 @@
KUrl newDest = dest;
if (newDest.protocol() == QLatin1String("webdavs"))
newDest.setProtocol(QLatin1String("https"));
- else
+ else if (newDest.protocol() == QLatin1String("webdav"))
newDest.setProtocol(QLatin1String("http"));
m_request.method = DAV_MOVE;
@@ -2719,7 +2719,7 @@
}
kDebug(7103) << "============ Received Status Response:";
- kDebug(7103) << QByteArray(buffer, bufPos);
+ kDebug(7103) << QByteArray(buffer, bufPos).trimmed();
HTTP_REV httpRev = HTTP_None;
int headerSize = 0;
@@ -2827,23 +2827,13 @@
}
// 302 Found (temporary location)
// 303 See Other
- if (m_request.method != HTTP_HEAD && m_request.method != HTTP_GET) {
-#if 0
- // Reset the POST buffer to avoid a double submit
- // on redirection
if (m_request.method == HTTP_POST) {
- m_POSTbuf.resize(0);
- }
-#endif
-
- // NOTE: This is wrong according to RFC 2616. However,
- // because most other existing user agent implementations
- // treat a 301/302 response as a 303 response and preform
- // a GET action regardless of what the previous method was,
- // many servers have simply adapted to this way of doing
- // things!! Thus, we are forced to do the same thing or we
- // won't be able to retrieve these pages correctly!! See RFC
- // 2616 sections 10.3.[2/3/4/8]
+ // 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 won't be able to retrieve
+ // these pages correctly.
m_request.method = HTTP_GET; // Force a GET
}
} else if ( m_request.responseCode == 207 ) {
@@ -2909,7 +2899,7 @@
// TODO review use of STRTOLL vs. QByteArray::toInt()
foundDelimiter = readDelimitedText(buffer, &bufPos, maxHeaderSize, 2);
- kDebug(7113) << " -- full response:" << QByteArray(buffer, bufPos);
+ kDebug(7113) << " -- full response:" << endl << QByteArray(buffer, bufPos).trimmed();
Q_ASSERT(foundDelimiter);
//NOTE because tokenizer will overwrite newlines in case of line continuations in the header
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic