summaryrefslogtreecommitdiffstats
path: root/Lib/SimpleXMLRPCServer.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-19 22:14:00 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-19 22:14:00 (GMT)
commit6d755900f6735a6c66b5e8455a0127ac99caf2a6 (patch)
tree099c42b9a6ec4f405797ca5b4114564aefa642f6 /Lib/SimpleXMLRPCServer.py
parentd7b0eebcaea618c982eff7ed92054292b9281d1f (diff)
downloadcpython-6d755900f6735a6c66b5e8455a0127ac99caf2a6.zip
cpython-6d755900f6735a6c66b5e8455a0127ac99caf2a6.tar.gz
cpython-6d755900f6735a6c66b5e8455a0127ac99caf2a6.tar.bz2
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/SimpleXMLRPCServer.py')
-rw-r--r--Lib/SimpleXMLRPCServer.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/SimpleXMLRPCServer.py b/Lib/SimpleXMLRPCServer.py
index 5b5aced..7aac89a 100644
--- a/Lib/SimpleXMLRPCServer.py
+++ b/Lib/SimpleXMLRPCServer.py
@@ -521,8 +521,11 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if len(response) > self.encode_threshold:
q = self.accept_encodings().get("gzip", 0)
if q:
- response = xmlrpclib.gzip_encode(response)
- self.send_header("Content-Encoding", "gzip")
+ try:
+ response = xmlrpclib.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)
@@ -535,6 +538,8 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
if encoding == "gzip":
try:
return xmlrpclib.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: