setting http headers in KIO::storedPut?

Reinhold Kainhofer reinhold at kainhofer.com
Sat Feb 12 11:59:43 GMT 2005


I'm currently fixing our opengroupware resource to be compliant with the 
GroupDAV specification (http://www.groupdav.org).

However, I have several problems:

-) First, even if I include the username and password in the URL, the KIO 
methods will first try a request without a username/password, and then access 
kwallet for the username/password. In other words, what i set in the URL is 
simply ignored! How can I make the KIO methods use the username and password 
that I supplied in the URL (because the user entered that in the 
configuration dialog already, so there's no need to ask him again!). Also, 
how do I get rid of the first request without username/password?


-) Second, it seems that if I use addMetaData to add If-Match and 
If-None-Match headers (which is required to prevent data loss by overwriting 
an already changed event on the server), these are simply not sent to the 
server...  The same problem appears with uploading, where the spec says that 
I MUST send the content-type (text/calendar). I set the content-type, but 
that header is never sent to the server. Here's the code for uploading a new 
item (for changing an existing item the last line simply uses "If-Match" with 
the correct fingerprint):

KIO::TransferJob *job = KIO::storedPut( dta.utf8(), upUrl, -1, true, 
      false, false );
job->addMetaData( "PropagateHttpHeader", "true" );
if ( adaptor )
  job->addMetaData( "content-type", adaptor->mimeType() );
job->addMetaData( "If-None-Match", "*" );


The resulting request to the server, however is simply:

PUT /zidestore/dav/reinhold/Overview/new.ics HTTP/1.1 
Connection: Keep-Alive 
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.3; Linux) KHTML/3.3.2 (like 
Gecko) 
Pragma: no-cache 
Cache-control: no-cache 
Accept: text/html, image/jpeg, image/png, text/*, image/*, */* 
Accept-Encoding: x-gzip, x-deflate, gzip, deflate 
Accept-Charset: iso-8859-15, utf-8;q=0.5, *;q=0.5 
Accept-Language: en, de 
Host: ogo.fruitsalad.org 
Cookie: ogo-webui-1.0a=0632063201420DCD7C 
Content-Length: 420 
 
BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML KOrganizer 3.4 beta2//EN



The same problem appears with the deletion of items, where I need to set the 
If-Match: header, too:

  delJob = KIO::del( url, false, false );
  if ( delJob && adaptor && adaptor->idMapper() ) {
    delJob->addMetaData( "if-match",
      adaptor->idMapper()->fingerprint( deletedItem->uid() ) );
  }

The request sent to the server, however, does not include that If-Match 
header:

DELETE /zidestore/dav/reinhold/Overview/17420.ics HTTP/1.1 
Connection: Keep-Alive 
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.3; Linux) KHTML/3.3.2 (like 
Gecko) 
Pragma: no-cache 
Cache-control: no-cache 
Accept: text/html, image/jpeg, image/png, text/*, image/*, */* 
Accept-Encoding: x-gzip, x-deflate, gzip, deflate 
Accept-Charset: iso-8859-15, utf-8;q=0.5, *;q=0.5 
Accept-Language: en, de 
Host: ogo.fruitsalad.org 
Cookie: ogo-webui-1.0a=0632063201420DCD7C 
Authorization: Basic blahblahblah


How can I send these If-Match, If-None-Match, and Content-Type headers to the 
server, too?

Thanks,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna, Austria
email: reinhold at kainhofer.com, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at
 * K Desktop Environment, http://www.kde.org/, KOrganizer / KPilot maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050212/8f695d6b/attachment.sig>


More information about the kde-core-devel mailing list