apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Collins-Sussman <suss...@collab.net>
Subject Re: opposite of apr_xml_quote_string() ?
Date Tue, 08 Mar 2005 23:10:46 GMT

On Mar 8, 2005, at 2:20 PM, Joe Orton wrote:

> On Tue, Mar 08, 2005 at 11:41:51AM -0600, Ben Collins-Sussman wrote:
>> I'm working on the svn 1.2 "locking" feature, and I've come to a point
>> where mod_dav_svn needs to xml-unescape the incoming comment attached
>> to a DAV lock, so that it ends up being stored in the svn repository 
>> as
>> something human-readable.  (For complex reasons, neither httpd nor
>> mod_dav is xml-unescaping the data.)
>> I've searched high and low through apr, apr-util, httpd, and svn APIs.
>> I've found apr_xml_quote_string() as a nice way of xml-escaping data,
>> but I've not found anything to xml-unescape.
> It's because the XML parser does it automatically; you never normally
> get to see the escaped form when parsing the XML.  How complex are 
> these
> complex reasons - is the data getting XML-escaped twice, or something?

An svn client uses neon to send a DAV lock to mod_dav.  mod_dav treats 
the <D:owner> field as sacred, and refuses to xml-unescape it or touch 
it at all.  Then it hands all the fields down to mod_dav_svn.

If the lock came from a generic DAV client, then mod_dav_svn stores the 
owner field verbatim, and retrieves it verbatim later on when asked.

If the lock came from a subverison cilent, then mod_dav_svn needs to 
make the value palatable to the rest of subversion.  Before storing in 
the repository, it strips away the <D:owner> tags, and xml-unescapes 
the data.  (ra_dav xml-escapes this 'comment' field before sending it 
over neon, since neon isn't doing it.)  When retrieving the lock later 
on, it remembers to xml-escape the data and re-add the <D:owner> tags, 
so that the http response is valid.

On the client side of subversion, the lock coming back from 
ne_lock_discover() needs to have the owner field unescaped as well.

View raw message