summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpc/server.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-19 22:29:24 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-19 22:29:24 (GMT)
commitaefde242fd7bc6c838107aaa734c8808c5d21fe2 (patch)
tree6857c209b6d08ddc0b5f67d98c5529eb484e5768 /Lib/xmlrpc/server.py
parent22101aa086ddf50928939b9a9cf84f9ca814e52a (diff)
downloadcpython-aefde242fd7bc6c838107aaa734c8808c5d21fe2.zip
cpython-aefde242fd7bc6c838107aaa734c8808c5d21fe2.tar.gz
cpython-aefde242fd7bc6c838107aaa734c8808c5d21fe2.tar.bz2
porting revision 74098 from trunk:
http://bugs.python.org/issue6499 zlib/gzip may not be present for all builds. Make xmlrpclib gracefully not supporg gzip encoding in this case
Diffstat (limited to 'Lib/xmlrpc/server.py')
-rw-r--r--Lib/xmlrpc/server.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
index 273202f..2194775 100644
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -509,8 +509,11 @@ class SimpleXMLRPCRequestHandler(BaseHTTPRequestHandler):
if len(response) > self.encode_threshold:
q = self.accept_encodings().get("gzip", 0)
if q:
- response = gzip_encode(response)
- self.send_header("Content-Encoding", "gzip")
+ try:
+ response = gzip_encode(response)
+ self.send_header("Content-Encoding", "gzip")
+ except NotImplementedError:
+ pass
self.send_header("Content-length", str(len(response)))
self.end_headers()
self.wfile.write(response)
@@ -523,6 +526,8 @@ class SimpleXMLRPCRequestHandler(BaseHTTPRequestHandler):
if encoding == "gzip":
try:
return gzip_decode(data)
+ except NotImplementedError:
+ self.send_response(501, "encoding %r not supported" % encoding)
except ValueError:
self.send_response(400, "error decoding gzip content")
else: