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

List:       kde-commits
Subject:    branches/KDE/4.3/kdelibs/kio/kio
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2009-09-24 15:25:32
Message-ID: 1253805932.199356.24391.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1027715 by adawit:

Send the correct 'Content-Type' header when submitting forms.

BUG:207438


 M  +9 -10     accessmanager.cpp  


--- branches/KDE/4.3/kdelibs/kio/kio/accessmanager.cpp #1027714:1027715
@@ -79,30 +79,22 @@
     switch (op) {
         case HeadOperation: {
             kDebug() << "HeadOperation:" << req.url();
-
             kioJob = KIO::mimetype(req.url(), KIO::HideProgressInfo);
-
             break;
         }
         case GetOperation: {
             kDebug() << "GetOperation:" << req.url();
-
             kioJob = KIO::get(req.url(), KIO::NoReload, KIO::HideProgressInfo);
-
             break;
         }
         case PutOperation: {
             kDebug() << "PutOperation:" << req.url();
-
             kioJob = KIO::put(req.url(), -1, KIO::HideProgressInfo);
-
             break;
         }
         case PostOperation: {
             kDebug() << "PostOperation:" << req.url();
-
             kioJob = KIO::http_post(req.url(), outgoingData->readAll(), KIO::HideProgressInfo);
-
             break;
         }
         default:
@@ -115,9 +107,16 @@
 
     kioJob->addMetaData(d->metaDataForRequest(req));
 
-    if ( op == PostOperation && !kioJob->metaData().contains("content-type")) 
-        kioJob->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded" );
+    if ( op == PostOperation && !kioJob->metaData().contains("content-type"))  {
+        QVariant header = req.header(QNetworkRequest::ContentTypeHeader);
+        if (header.isValid())
+          kioJob->addMetaData("content-type",
+                              QString::fromLatin1("Content-Type: %1").arg(header.toString()));
+        else
+          kioJob->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded");
+    }
 
+    kDebug () << "Job '" << kioJob << "' started...";
     return reply;
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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