[Patch] Webdav properties in UDSAtoms
Best, Jan-Pascal van
j.p.vanbest at tbm.tudelft.nl
Thu May 30 11:42:45 BST 2002
David Fauré wrote:
> > My current implementation uses just another UDSAtomType,
> > UDS_WEBDAV_PROPERTIES = 32768 | UDS_STRING
> > and then in http.c:HTTPProtocol:davParseProperties checks whether
> > the metadata "davRequestResponse" is set to "true". In that case,
> > it adds an UDSAtom to the current UDSEntry, of type
> > UDS_WEBDAV_PROPERTIES, containing the <prop/> XML element string.
>
> Sounds good. I would even make this more generic, like
> UDS_XML_PROPERTIES.
> I suspect people will want to reuse this in other slaves in
> the future.
Ok, I'll change that. Especially since Hamish proposed exactly the
same thing :)
> > The main argument against this method is that we now first parse the
> > servers response, then encode the properties as an XML string in the
> > UDSAtom, and then (in the application side) parse the same
> data again!
>
> How big is that XML string, typically?
Can't say anything about typical, but Exchange server 2000 gives for a
typical
appointment about 40 lines with a total of 5124 characters. If there's a
large
description or many attendees that may become more.
> Seems the parsing of the XML in kio_http is necessary anyway,
> and the app is
> another process, it has to reparse it anyway. I don't think
> there's any other way,
> that's part of the "separate process" design. But it
> shouldn't be a big problem.
You're probably right.
> > + atom.m_uds = KIO::UDS_WEBDAV_PROPERTIES;
> > + QDomDocument doc;
> > + doc.appendChild(prop);
> > + atom.m_str = doc.toString();
> > + entry.append( atom );
>
> Hmm, no way to get prop.toString()? Ok.
Nope, only QDomDocument has a toString().
Updated patch follows.
Cheers
Jan-Pascal
Index: global.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/global.h,v
retrieving revision 1.49
diff -u -3 -p -r1.49 global.h
--- global.h 5 Apr 2002 22:18:47 -0000 1.49
+++ global.h 30 May 2002 09:10:00 -0000
@@ -238,7 +238,9 @@ namespace KIO
UDS_MIME_TYPE = 16384 | UDS_STRING,
// A mime type to be used for displaying only.
// But when 'running' the file, the mimetype is re-determined
- UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING
+ UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
+ // XML properties, e.g. for WebDAV
+ UDS_XML_PROPERTIES = 32768 | UDS_STRING
};
enum CacheControl
Index: http.cc
===================================================================
RCS file: /home/kde/kdelibs/kioslave/http/http.cc,v
retrieving revision 1.503
diff -u -3 -p -r1.503 http.cc
--- http.cc 23 May 2002 23:37:33 -0000 1.503
+++ http.cc 30 May 2002 09:17:35 -0000
@@ -595,6 +595,15 @@ void HTTPProtocol::davParsePropstats( co
return;
}
+ if ( metaData( "davRequestResponse" ) == "true" )
+ {
+ atom.m_uds = KIO::UDS_XML_PROPERTIES;
+ QDomDocument doc;
+ doc.appendChild(prop);
+ atom.m_str = doc.toString();
+ entry.append( atom );
+ }
+
for ( QDomElement property = prop.firstChild().toElement();
!property.isNull();
property = property.nextSibling().toElement() )
More information about the kfm-devel
mailing list