neon@webdav.org
[Top] [All Lists]

Re: [neon] bad server: 204 response body not empty

Subject: Re: [neon] bad server: 204 response body not empty
From: Joe Orton
Date: Tue, 10 Jul 2007 09:07:26 +0100
On Mon, Jul 09, 2007 at 04:09:27PM -0700, Dave Hayden wrote:
> When I do a DELETE on box.net's webdav server, the response has an  
> extra \n after the blank end-of-headers line, even though it's a 204  
> No Content and shouldn't have a body. It's a keep-alive connection,  
> so the next request reads the buffered \n and throws a "couldn't  
> parse response" error.
> 
> I've asked them for info to try and track down the bug on the server  
> side (headers aren't identifying what's doing the DAV), but I'm  
> looking at workarounds for the client. Would it be safe/sane to just  
> clear the read buffer when sending out a request? If so, is  
> ne_begin_request() a bottleneck for all requests?

No to both of those questions - but eating the blank lines in 
read_status_line() should be safe; can you try this:

Index: src/ne_request.c
===================================================================
--- src/ne_request.c    (revision 1180)
+++ src/ne_request.c    (working copy)
@@ -861,13 +861,15 @@
 {
     char *buffer = req->respbuf;
     ssize_t ret;
-
-    ret = ne_sock_readline(req->session->socket, buffer, sizeof req->respbuf);
-    if (ret <= 0) {
-       int aret = aborted(req, _("Could not read status line"), ret);
-       return RETRY_RET(retry, ret, aret);
-    }
     
+    do {
+        ret = ne_sock_readline(req->session->socket, buffer, sizeof 
req->respbuf);
+        if (ret <= 0) {
+            int aret = aborted(req, _("Could not read status line"), ret);
+            return RETRY_RET(retry, ret, aret);
+        }
+    } while (req->session->persisted && ret == 2 && buffer[0] == '\n');
+    
     NE_DEBUG(NE_DBG_HTTP, "[status-line] < %s", buffer);
     strip_eol(buffer, &ret);
     
_______________________________________________
neon mailing list
neon@xxxxxxxxxx
http://mailman.webdav.org/mailman/listinfo/neon

<Prev in Thread] Current Thread [Next in Thread>