Hi Lennart,

On Wed, Mar 01, 2006 at 08:28:25PM +0100, Lennart Poettering wrote:
> ne_get_range() of neon 0.25.5 doesn't work with current
> Apache2/mod_dav versions. 
> 
> Please merge this trivial patch to fix this:
> 
> http://0pointer.de/public/neon-partial-get.patch

Thanks for the report and patch. 

> The problem is that neon doesn't consider partial GET responses valid
> which don't return exactly the byte range requested. However, modern
> WebDAV servers concatenate the real file length to the returned byte
> range. (seperated by a dash) Hence, neon will never accept any partial
> GET responses.

As is required by 2616, indeed! I've merged a slightly different patch, 
as below.

Index: src/ne_basic.c
===================================================================
--- src/ne_basic.c      (revision 978)
+++ src/ne_basic.c      (working copy)
@@ -115,6 +115,7 @@
     ne_session *const sess = ne_get_session(req);
     const ne_status *const st = ne_get_status(req);
     int ret;
+    size_t rlen = strlen(range + 6); /* length of bytespec after "bytes=" */
 
     do {
         const char *value;
@@ -128,7 +129,8 @@
          * given which matches the Range request header. */
         if (range && st->code == 206 
             && (value == NULL || strncmp(value, "bytes ", 6) != 0
-                || strcmp(range + 6, value + 6))) {
+                || strncmp(range + 6, value + 6, rlen)
+                || value[6 + rlen] != '/')) {
             ne_set_error(sess, _("Response did not include requested range"));
             return NE_ERROR;
         }
_______________________________________________
neon mailing list
[email protected]
http://mailman.webdav.org/mailman/listinfo/neon

Reply via email to