From 26d91f2b1006a3affff963d6aa8d0d0ced134723 Mon Sep 17 00:00:00 2001 From: Lokesh S Date: Wed, 20 Jul 2016 13:49:29 +0000 Subject: [PATCH] Python3 eventlet patched httplib _MAXHEADERS This change patches the correct eventlet monkey patched httplib's _MAXHEADERS as required by Swift. It also makes the configparser inside the copy middleware py3 compatable. Change-Id: I2f7dbcecbbecd7cb69b7031faa39f35bcfadcfc8 --- swift/common/bufferedhttp.py | 5 ++++- swift/common/middleware/copy.py | 2 +- test/probe/test_wsgi_servers.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/swift/common/bufferedhttp.py b/swift/common/bufferedhttp.py index 2db36b155f..1294609133 100644 --- a/swift/common/bufferedhttp.py +++ b/swift/common/bufferedhttp.py @@ -38,7 +38,10 @@ from eventlet.green.httplib import CONTINUE, HTTPConnection, HTTPMessage, \ from six.moves.urllib.parse import quote import six -httplib = eventlet.import_patched('httplib') +if six.PY2: + httplib = eventlet.import_patched('httplib') +else: + httplib = eventlet.import_patched('http.client') httplib._MAXHEADERS = constraints.MAX_HEADER_COUNT diff --git a/swift/common/middleware/copy.py b/swift/common/middleware/copy.py index 1bb2234a05..9ef44a2243 100644 --- a/swift/common/middleware/copy.py +++ b/swift/common/middleware/copy.py @@ -132,7 +132,7 @@ backwards compatibility. At first chance, set ``object_post_as_copy`` to """ import os -from ConfigParser import ConfigParser, NoSectionError, NoOptionError +from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError from six.moves.urllib.parse import quote, unquote from swift.common import utils diff --git a/test/probe/test_wsgi_servers.py b/test/probe/test_wsgi_servers.py index 437912dcf8..46175cf458 100644 --- a/test/probe/test_wsgi_servers.py +++ b/test/probe/test_wsgi_servers.py @@ -15,9 +15,11 @@ # limitations under the License. import unittest -import httplib + import random +from six.moves import http_client as httplib + from swift.common.storage_policy import POLICIES from swift.common.ring import Ring from swift.common.manager import Manager