[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Two KIO::AccessManager patches...
From: "Dawit A." <adawit () kde ! org>
Date: 2009-09-24 5:31:39
Message-ID: 200909240131.39446.adawit () kde ! org
[Download RAW message or body]
Improved #2 Patch:
Instead of chaning the QNetworkReply error code value which might have other
ramifications, send the KIO error code as an attribute, specifically using the
QNetworkRequest::UserMax attribute...
On Thursday 24 September 2009 00:07:25 Dawit A. wrote:
> Patch #1:
> The attached patch fixes KIO::AccessManager so that it sends the correct
> content-type during post operations and addresses bug# 207438.
>
> Patch #2:
> Change AccessManagerReply to return the actual KIO error code when it
> cannot be mapped directly into QNetworkReply::NetworkError.
["accessmanagerreply_p.patch" (text/x-patch)]
Index: accessmanagerreply_p.cpp
===================================================================
--- accessmanagerreply_p.cpp (revision 1026906)
+++ accessmanagerreply_p.cpp (working copy)
@@ -158,11 +158,13 @@
void AccessManagerReply::jobDone(KJob *kJob)
{
- switch (kJob->error())
+ const int errcode = kJob->error();
+ switch (errcode)
{
case 0:
setError(QNetworkReply::NoError, kJob->errorText());
kDebug() << "0 -> QNetworkReply::NoError";
+ kDebug() << "Job '" << kJob << "' completed...";
break;
case KIO::ERR_COULD_NOT_CONNECT:
setError(QNetworkReply::ConnectionRefusedError, kJob->errorText());
@@ -200,12 +202,12 @@
break;
case KIO::ERR_COULD_NOT_AUTHENTICATE:
setError(QNetworkReply::AuthenticationRequiredError, kJob->errorText());
- kDebug() << kJob->error();
+ kDebug() << errcode;
break;
case KIO::ERR_UNSUPPORTED_PROTOCOL:
case KIO::ERR_NO_SOURCE_PROTOCOL:
setError(QNetworkReply::ProtocolUnknownError, kJob->errorText());
- kDebug() << kJob->error();
+ kDebug() << errcode;
break;
case KIO::ERR_UNSUPPORTED_ACTION:
setError(QNetworkReply::ProtocolInvalidOperationError, kJob->errorText());
@@ -213,7 +215,8 @@
break;
default:
setError(QNetworkReply::UnknownNetworkError, errorString());
- kDebug() << kJob->error();
+ setAttribute(QNetworkRequest::UserMax, errcode);
+ kDebug() << errcode;
}
emit finished();
@@ -228,6 +231,7 @@
// temporary one assume code 302 which is most often used
if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull())
q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 302);
+
q->setAttribute(QNetworkRequest::RedirectionTargetAttribute, QUrl(url));
emit q->finished();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic