This project is read-only.

transfer-encoding

Jun 12, 2009 at 9:32 AM

I recently tried the WebDAVSharp plugin (http://code.google.com/p/webdavsharp/) together with the Cadaver client and got a BadRequest exception from the HttpServer. I looked the problem a bit closer and found out that the HttpServer could not know how to handle value "TE" in Connection header.

The problematic bit of code is in the AddHeader method in HttpRequest class. For testing purposes I made a quick fix that it ignores the value "TE" in connection, but eventually this needs to be handled. The request that was sent to server was a bit like in here http://bit.ly/eDbiE [books.google.fi]. As the book descibes: "The string TE in the Connection header means that cadaver client supports chunked transfer encodings. The string TE must appear in the Connection header whenever the TE header is present." More information about Connection header and transfer encoding can be found from: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html (chapters 14.10, 14.39 and 14.41)

Since I'm quite new to projects codebase I would appreciate if anyone would have pointer where to start look at this problem.

Jun 12, 2009 at 9:47 AM

I can fix it if you provide me with a complete request.

Jun 15, 2009 at 7:46 AM

The request is something like:

OPTIONS /user/temp/ HTTP/1.1
User-Agent: cadaver/0.17.0 neon/0.12.0-dev
Keep-Alive:
Connection: TE, Keep-Alive
TE: trailers
Content-Length: 0
Host: www.example.com
Authorization: Digest username="user", realm="www.example.com", uri="/user/temp/", nonce="883a8a6bfec66f61e582a28bb665aa83", responce="a0e5abeb0b373a4e110b49857660baa1", conce="HIgdsiUIghgUJBGnsnuagfaGnkawQnTwonWQnmh=", algorithm="MD5", nc=00000001, qop="auth"

Jun 16, 2009 at 8:42 AM

I think this should make it continue. The precise mechanics of how your server chooses to implement TE support is up to you (http://tools.ietf.org/html/rfc2616#section-3.6).

WebDAV clients use chunked transfer encoding (http://en.wikipedia.org/wiki/Chunked_transfer_encoding) to avoid computing precise sizes for large files before beginning a transfer.Index: HttpServer/HttpRequest.cs


===================================================================
--- HttpServer/HttpRequest.cs    (revision 20344)
+++ HttpServer/HttpRequest.cs    (working copy)
@@ -380,6 +380,8 @@
                         Connection = ConnectionType.Close;
                     else if (value.StartsWith("keep-alive", StringComparison.CurrentCultureIgnoreCase))
                         Connection = ConnectionType.KeepAlive;
+                    else if (value.StartsWith("te", StringComparison.CurrentCultureIgnoreCase))
+                        Connection = ConnectionType.TransferEncoding;
                     else
                         throw new BadRequestException("Unknown 'Connection' header type.");
                     break;
Index: HttpServer/IHttpResponse.cs
===================================================================
--- HttpServer/IHttpResponse.cs    (revision 20344)
+++ HttpServer/IHttpResponse.cs    (working copy)
@@ -188,6 +188,11 @@
         /// <summary>
         /// Connection is kept alive for X seconds (unless another request have been made)
         /// </summary>
-        KeepAlive
+        KeepAlive,
+       
+        /// <summary>
+        /// Requests message-body be sent with an encoding to be specified in the "Transfer-Encoding" header.
+        /// </summary>
+        TransferEncoding
     }
 }