Problem with KIO::http_post

Christian Weilbach christian_weilbach at web.de
Sat Jul 14 18:44:07 BST 2007


Hi,

I'm using KIO::http_post in kdepimlibs/kblog and have a problem with my 
authenticate method in gdata_p.cpp

The unit test testgdata throws the following communication with the Google 
server on stdout:

<-  snip

kio_http: (6671) ============ Sending Header:
kio_http: (6671) 
POST /accounts/ClientLogin?Email=christian_weilbach%40web.de&Passwd=Wo%20ist%20Hans%3F&source=KBlog&service=blogger 
HTTP/1.1
kio_http: (6671) Connection: Keep-Alive
kio_http: (6671) User-Agent: Mozilla/5.0 (compatible; Konqueror/3.91; Linux) 
KHTML/3.91.0 (like Gecko)
kio_http: (6671) Pragma: no-cache
kio_http: (6671) Cache-control: no-cache
kio_http: (6671) Accept: text/html, image/jpeg, image/png, text/*, image/*, 
*/*
kio_http: (6671) Accept-Encoding: x-gzip, x-deflate, gzip, deflate
kio_http: (6671) Accept-Charset: system, utf-8;q=0.5, *;q=0.5
kio_http: (6671) Accept-Language: en-US, en
kio_http: (6671) Host: www.google.com

<- snip

<- snip 

kssl: KSSL connected OK
kssl: X509Callback: ok = 1 error = 0 depth = 2
kssl: X509Callback: ok = 1 error = 0 depth = 1
kssl: X509Callback: ok = 1 error = 0 depth = 0
kssl: Matching CN=[www.google.com] to [www.google.com]
kssl: SSL HTTP frame the parent?
kssl: SSL connection information follows:
kssl: +-----------------------------------------------
kssl: | Cipher: AES256-SHA
kssl: | Description: AES256-SHA              SSLv3 Kx=RSA      Au=RSA  
Enc=AES(256)  Mac=SHA1
kssl:
kssl: | Version: TLSv1/SSLv3
kssl: | Strength: 256 of 256 bits used.
kssl: | PEER:
kssl: | Subject: /C=US/ST=California/L=Mountain View/O=Google 
Inc/CN=www.google.com
kssl: | Issuer: /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
kssl: | Validation: 1
kssl: | Certificate matches IP: true
kssl: +-----------------------------------------------
kio_http: (6671) ============ Received Response:
kio_http: (6671) "HTTP/1.1 411 Length Required "
kio_http: (6671) "Date: Sat, 14 Jul 2007 17:14:24 GMT "
kio_http: (6671) "Content-Type: text/html "
kio_http: (6671) "Server: GFE/1.3 "
kio_http: (6671) "Content-Length: 1357 "
kio_http: (6671) --empty--
kdepimlibs (kblog): Fetched authentication result for 
https://www.google.com/accounts/ClientLogin?Email=christian_weilbach%40web.de&Passwd=Wo%20ist%20Hans%3F&source=KBlog&service=blogger.
kdepimlibs (kblog): Authentication response

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>411 Length Required</title>
<style><!--
body {font-family: arial,sans-serif}
div.nav {margin-top: 1ex}
div.nav A {font-size: 10pt; font-family: arial,sans-serif}
span.nav {font-size: 10pt; font-family: arial,sans-serif; font-weight: bold}
div.nav A,span.big {font-size: 12pt; color: #0000cc}
div.nav A {font-size: 10pt; color: black}
A.l:link {color: #6f6f6f}
A.u:link {color: green}
//--></style>
<script><!--
var rc=411;
//-->
</script>
</head>
<body text=#000000 bgcolor=#ffffff>
<table border=0 cellpadding=2 cellspacing=0 width=100%><tr><td rowspan=3 
width=1% nowrap>
<b><font face=times color=#0039b6 size=10>G</font><font face=times 
color=#c41200 size=10>o</font><font face=times color=#f3c518 
size=10>o</font><font face=times color=#0039b6 size=10>g</font><font 
face=times color=#30a72f size=10>l</font><font face=times color=#c41200 
size=10>e</font>  </b>
<td> </td></tr>
<tr><td bgcolor=#3366cc><font face=arial,sans-serif 
color=#ffffff><b>Error</b></td></tr>
<tr><td> </td></tr></table>
<blockquote>
<H1>Length Required</H1>
POST requests require a <code>Content-length</code> header.

<p>
</blockquote>
<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=#3366cc><img 
alt="" width=1 height=4></td></tr></table>
</body></html>

<- snip

Even if i add job->addMetaData( "connection-length", "0" ); it does not occur 
in the unit test output. I don't know how to check the traffic with 
wireshark, since it is SSL ( and this is intended by SSL ).

I hope somebody can help me.

We have got another new problem with kxmlrpcclient in kblog which also depends 
on http_post. We cannot send more than one POST in a one kio slave process. 
The second post has a content-length of 0 and therefore throws an error. 
Since both Blogger API 1.0 and MetaWeblog API in kblog depend on 
kxmlrpcclient which uses KIO::http_post in query.cpp to send the data, 
nothing works except the unit test which luckily uses a different slave for 
each connection.
If you want to try it out yourself, checkout KBlogger (the GUI to KBlog) from 
trunk/playground/pim, capture the network traffic, configure your blogging 
account and play around a bit until you get the first error box with an 
xmlrpc error.

"Antonio Aloisio" <antonio.aloisio at gmail.com> (nick GNUton) has tracked down 
the problem to the following code:

[Sa Jul 14 2007] [00:37:14] <GNUton> in the kdelibs/kioslave/http/http.cpp
[Sa Jul 14 2007] [00:37:16] <GNUton> file
[Sa Jul 14 2007] [00:37:24] <GNUton> comment the lines
[Sa Jul 14 2007] [00:37:40] <GNUton> /*if ( !m_bufPOST.isNull() )
[Sa Jul 14 2007] [00:37:44] <GNUton> {
[Sa Jul 14 2007] [00:37:56] <GNUton> kDebug(7113) << "(" << m_pid << ") 
POST'ing saved data..." << endl;
[Sa Jul 14 2007] [00:38:00] <GNUton> result = 0;
[Sa Jul 14 2007] [00:38:04] <GNUton> length = m_bufPOST.size();
[Sa Jul 14 2007] [00:38:08] <GNUton> }
[Sa Jul 14 2007] [00:38:12] <GNUton> else*/

I hope somebody can help here, too.

Cheers,
Christian




More information about the kfm-devel mailing list