Forwared from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710672
Dear Maintainer,
pywebdav uses persistent connections even for HTTP/1.0 GET requests
without a Connection: Keep-Alive header. This causes the client to
hang waiting for the connection to close. RFC2616 explicitly states
HTTP/1.1 servers must not assume HTTP/1.0 clients to support
persistent connections:
=== Begin RFC2616 excerpt ===
8.1.2.1 Negotiation
[...]
Clients and servers SHOULD NOT assume that a persistent connection is
maintained for HTTP versions less than 1.1 unless it is explicitly
signaled. [...]
=== End RFC2616 excerpt ===
In addition, both a Connection: close and a Connection: Keep-Alive
header are sent and Date is sent twice:
=== Begin tcpflow dump ===
127.000.000.001.50660-127.000.000.001.08009: GET / HTTP/1.0
User-Agent: w3m/0.5.3+cvs-1.1055
Accept: text/html, text/*;q=0.5, image/*, */*
Accept-Encoding: Xgzip, compress, bzip, bzip2, deflate
Accept-Language: en;q=1.0
Host: localhost:8009
Pragma: no-cache
Cache-control: no-cache
127.000.000.001.08009-127.000.000.001.50660: HTTP/1.0 200 OK
127.000.000.001.08009-127.000.000.001.50660: Server: DAV/0.9.8 Python/2.7.3
127.000.000.001.08009-127.000.000.001.50660: Date: Sat, 01 Jun 2013 10:11:00 GMT
127.000.000.001.08009-127.000.000.001.50660: Connection: close
127.000.000.001.08009-127.000.000.001.50660: Accept-Ranges: bytes
127.000.000.001.08009-127.000.000.001.50660: Date: Sat, 01 Jun 2013 10:11:00 GMT
127.000.000.001.08009-127.000.000.001.50660: DAV: 1
127.000.000.001.08009-127.000.000.001.50660: Last-Modified: Sat, 01 Jun 2013
10:11:00 GMT
127.000.000.001.08009-127.000.000.001.50660: Connection: Keep-Alive
127.000.000.001.08009-127.000.000.001.50660: Keep-Alive: timeout=15, max=86
127.000.000.001.08009-127.000.000.001.50660: Content-Length: 253
127.000.000.001.08009-127.000.000.001.50660: Content-Type: text/html;
charset=utf-8
127.000.000.001.08009-127.000.000.001.50660:
127.000.000.001.08009-127.000.000.001.50660: <html>
<head><title>Journal listing</title></head>
<body>
<table>
<tr><th>Name</th></tr>
<tr><td><a href="by-id/">by-id/</a></td></tr>
<tr><td><a href="by-tags/">by-tags/</a></td></tr>
<tr><td><a href="by-title/">by-title/</a></td></tr>
</table>
</html>
=== End tcpflow dump ===
A quick patch for these issues:
=== Begin ===
--- WebDAVServer.py.old 2013-06-01 14:23:19.105319133 +0200
+++ WebDAVServer.py 2013-06-01 14:23:35.457092427 +0200
@@ -62,9 +62,9 @@
log.debug("Use send_body method")
self.send_response(code, message=msg)
- self.send_header("Connection", "close")
+ if 'Connection' not in headers:
+ self.send_header("Connection", "close")
self.send_header("Accept-Ranges", "bytes")
- self.send_header('Date', rfc1123_date())
self._send_dav_version()
@@ -255,8 +255,9 @@
self.send_body(data, status_code, None, None, content_type,
headers)
else:
- headers['Keep-Alive'] = 'timeout=15, max=86'
- headers['Connection'] = 'Keep-Alive'
+ if self.request_version == 'HTTP/1.1':
+ headers['Keep-Alive'] = 'timeout=15, max=86'
+ headers['Connection'] = 'Keep-Alive'
self.send_body_chunks_if_http11(data, status_code, None, None,
content_type, headers)
=== End ===
Original issue reported on code.google.com by mathi...@m9s.biz on 1 Jun 2013 at 5:15
Original issue reported on code.google.com by
mathi...@m9s.biz
on 1 Jun 2013 at 5:15