[Inteproxy-commits] r114 - in trunk: . inteproxy
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Feb 22 21:27:29 CET 2008
Author: bh
Date: 2008-02-22 21:27:29 +0100 (Fri, 22 Feb 2008)
New Revision: 114
Modified:
trunk/ChangeLog
trunk/inteproxy/transcoder.py
Log:
* inteproxy/transcoder.py (OWSProxyGETTranscoder.convert_request):
New method to work around a problem with OWSProxy. See doc-string
for details.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-02-21 15:44:39 UTC (rev 113)
+++ trunk/ChangeLog 2008-02-22 20:27:29 UTC (rev 114)
@@ -1,3 +1,9 @@
+2008-02-22 Bernhard Herzog <bh at intevation.de>
+
+ * inteproxy/transcoder.py (OWSProxyGETTranscoder.convert_request):
+ New method to work around a problem with OWSProxy. See doc-string
+ for details.
+
2008-02-21 Bernhard Herzog <bh at intevation.de>
* inteproxy/proxycore.py
Modified: trunk/inteproxy/transcoder.py
===================================================================
--- trunk/inteproxy/transcoder.py 2008-02-21 15:44:39 UTC (rev 113)
+++ trunk/inteproxy/transcoder.py 2008-02-22 20:27:29 UTC (rev 114)
@@ -135,7 +135,34 @@
"password=%s" % quote_plus(password)])
return urlparse.urlunsplit((scheme, netloc, path, query, fragment))
+ def convert_request(self, request):
+ """Modifies the request to avoid a timeout problem with OWSProxy.
+ OWSProxy always tries to read the body of a request, regardless
+ of the HTTP method and the headers of the request. This doesn't
+ work correctly if the request header doesn't indicate that the
+ request has a body (with the Content-Length or Transfer-Encoding
+ header fields) and the header contains a 'Connection: close'
+ field. In this case, the Java servlet API tries to read all
+ data the client sends until it closes the connection (presumably
+ by closing its socket for writing with shutdown). This
+ incorrect behavior according to RFC2616, section 4.4, which
+ allows only the server to indicate the length of the body by
+ closing the connection.
+ To work around this problem, this method adds a Content-Length
+ header to the request that indicates a body of length 0. It
+ doesn't add a real empty body with request.set_body() because
+ that would make urllib2 turn the request into a POST request.
+
+ Other workarounds would be to either not send the 'Connection:
+ close' header field, or to shutdown the socket for writing after
+ sending the request. Both are not easy to implement with
+ urllib2, though.
+ """
+ if request.body is None:
+ request.headers["Content-Length"] = "0"
+
+
class OWSProxyPOSTTranscoder(HTTPSTranscoder):
"""Transcoder for POST requests to the OWSProxy"""
More information about the Inteproxy-commits
mailing list