KIO HTTP: Post-Content type bug in http.c and SOAPAction header

Tim Jansen tim at tjansen.de
Sun Sep 29 22:54:52 BST 2002


Hi...

I would like to do two changes in kdelibs/kioslave/http/http.cc (HEAD):

1. A bug fix for the broken Content-Type header field in post requests.
When you create a post request (using KIO::http_post, for example) and add a 
header as shown in the kdoc example as "content-type" meta-data, the HTTP 
request is broken and looks like this:
[..]
Accept-Language: en
Host: www.ejseinc.com
text/xml; charset=utf-8
Content-Length: 266
[...]

The name of the field ("Content-Type") is missing.

2. I would like to add a new kind of metadata called "soapaction". It is the 
content of a "SOAPAction" header field, as required by SOAP 1.1. I know it is 
a little bit late to add a feature, but it is trivial and should not harm any 
other code.

Here is the patch (1&2 combined):

Index: kioslave/http/http.cc
===================================================================
RCS file: /home/kde/kdelibs/kioslave/http/http.cc,v
retrieving revision 1.543
diff -u -3 -p -r1.543 http.cc
--- kioslave/http/http.cc       2002/09/21 19:51:27     1.543
+++ kioslave/http/http.cc       2002/09/29 21:17:47
@@ -2170,8 +2170,17 @@ bool HTTPProtocol::httpOpen()
     if (!cookieStr.isEmpty())
       header += cookieStr + "\r\n";

+    QString soapAction = metaData("soapaction");
+    if (!soapAction.isEmpty())
+    {
+      header += "SOAPAction: ";
+      header += soapAction;
+      header += "\r\n";
+    }
+
     if (m_request.method == HTTP_POST)
     {
+      header += "Content-Type: ";
       header += metaData("content-type");
       header += "\r\n";
     }

Ok to commit?

bye...






More information about the kde-core-devel mailing list