On Wed, Mar 01, 2006 at 09:41:32PM +0100, Lennart Poettering wrote:
> On Wed, 01.03.06 20:05, Joe Orton ([EMAIL PROTECTED]) wrote:
> > > 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.
> 
> Mmmh, are you sure that that patch does what you want? The "if"
> condition contains a check for "range != NULL". However, the new "rlen"
> variable is initialized by strlen(range+6), hence it requires "range"
> to be valid. Somehow this doesn't fit together, does it?

Yup, exactly right - I already checked in a fix it to be conditional on 
range being non-NULL.  So the complete patch looks like:

Index: src/ne_basic.c
===================================================================
--- src/ne_basic.c      (revision 978)
+++ src/ne_basic.c      (working copy)
@@ -115,7 +115,11 @@
     ne_session *const sess = ne_get_session(req);
     const ne_status *const st = ne_get_status(req);
     int ret;
+    size_t rlen;
 
+    /* length of bytespec after "bytes=" */
+    rlen = range ? strlen(range + 6) : 0;
+
     do {
         const char *value;
         
@@ -128,7 +132,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