[PATCH] fix for unparsable DAV:href values
Mark Jenkins
mark at parit.ca
Fri Jun 19 17:12:36 EDT 2009
Hello libneon,
I discovered recently that a WebDAV server I'm working with, Plone 2.0.5
is implemented incorrectly. In response to a PROPFIND, it gives me a
hideous answer:
<d:href>/documents/tier2/BOARD%20AND%20CTTE%20DOCS/
Board Meetings/</d:href>
As you can see, it gets the URI hex encoding for spaces right at one
level "BOARD AND CTTE DOCS", but wrong at the next, "Board Meetings".
In end_element() in ne_207.c (line 825), unparsable DAV:hrefs are
discarded. There is no error message or refusal to operate, life goes on.
The /right thing/ for me to have done would of been to upgrade and patch
Plone, but I figured it would be harder then patching neon and davfs2
(which I'm using with neon). As it was, this approach took quite a bit
of time.
Also, with Plone and possibly other misbehaving DAV servers out there in
the wild, it made sense to me that neon should at least make it possible
to catch such behaviours and allow something (like an error messages or
a hard failure) to be done. Also, I have used several other DAV clients
(including Cadaver, which uses neon) that are quite accommodating to
these behaviours and still make such collections visible. I think there
was even a piece of proprietary software developed (I won't name it)
that was created specifically to work with Plone's broken WebDAV. So, if
everybody else is tolerating this garbage, perhaps neon users should
have the opportunity to be explicitly tolerant or intolerant too.
So, it is with some regret for supporting a broken implementation of an
open standard that I publish a patch to neon, the attached
unparsable_href_fix.patch .
The patch allows a user of the ne_207 module to add in a hook for the
moment where these unparsable DAV:href values are encountered. The user
specified handler can then:
* tell ne_207 to do what it usually does, ignore the bad href
* fix the href, call uri_parse, and tell ne_207 that all is fine now
or
* tell ne_207 that the situation is catasrophic. raise this as a
serious error
Also attached is neontest.c, which shows me using the new feature. When
I run this test program without the new feature provide by the patch, my
output is:
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/AORs/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Minutes/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Training/
When I run neontest.c as attached with the unparsable_href_fix.patch
applied to neon, I get
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/AORs/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Minutes/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Board%20Meetings/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/General%20Meetings/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/STUDENT%20REPRESENTATIVES1.doc
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/committee%20composition%202008.doc
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Training/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Board%20Contact%20info/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Committee%20meetings/
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/Board%20Start%20up.doc
/documents/tier2/BOARD%20AND%20CTTE%20DOCS/director%20office%20hours%202009.doc
I have also written an initial, but incomplete patch
(bad_href_fix.patch) to davfs2
(https://savannah.nongnu.org/projects/davfs2), which also illustrates
the new neon ne_207 feature in use. I have tested this, and in doing so
I'm sure I've given neon with unparsable_href_fix.patch a good test,
because it only takes a little bit of file browsing with davfs2 to
trigger quite a bit of activity between it and neon.
Additional credit for the changelog:
This patch was developed by ParIT Worker Co-operative (http://parit.ca)
under contract for the University of Winnipeg Students' Association.
Mark Jenkins
Member
ParIT Worker Co-operative
cc fellow ParITistas
cc Werner Baumann (of davfs2)
cc UWSA general coordinator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unparsable_href_fix.patch
Type: text/x-diff
Size: 6665 bytes
Desc: not available
Url : http://lists.manyfish.co.uk/pipermail/neon/attachments/20090619/cd45d81e/attachment-0018.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: neontest.c
Type: text/x-csrc
Size: 5732 bytes
Desc: not available
Url : http://lists.manyfish.co.uk/pipermail/neon/attachments/20090619/cd45d81e/attachment-0019.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad_href_fix.patch
Type: text/x-diff
Size: 11007 bytes
Desc: not available
Url : http://lists.manyfish.co.uk/pipermail/neon/attachments/20090619/cd45d81e/attachment-0020.bin
More information about the neon
mailing list