[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kio
From:       Jakub Stachowski <qbast () go2 ! pl>
Date:       2009-05-02 10:26:48
Message-ID: 1241260008.580565.24460.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 962377 by qbast:

When POST request get redirected, QtWebKit needs to know HTTP response code in order \
to figure out if it should be changed to GET or not.
KIO does not provide that information, but it can be guessed quite accurately - \
permanent redirection is always 301 and temporary one is usually 302.
This code will not work properly if server used 307 redirection - POST will be \
changed into GET when it should not be.




 M  +7 -0      accessmanagerreply_p.cpp  


--- trunk/KDE/kdelibs/kio/kio/accessmanagerreply_p.cpp #962376:962377
@@ -216,6 +216,11 @@
 {
     job->kill();
     m_kioJob = 0;
+    
+    // unfortunately we don't get HTTP response code for redirection, so for
+    // 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();
 }
@@ -229,6 +234,8 @@
 void AccessManagerReply::AccessManagerReplyPrivate::_k_permanentRedirection(KIO::Job \
*job, const KUrl &fromUrl, const KUrl &toUrl)  {
     Q_UNUSED(fromUrl);
+    if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull())
+        q->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 301);
     _k_redirection(job, toUrl);
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic