19
19
There are separate implementation modules for each http client implementation.
22
from collections import deque
23
from cStringIO import StringIO
24
from collections import deque
25
from cStringIO import StringIO
29
31
from warnings import warn
398
400
method = getattr(self, mname)
403
if sys.platform == 'win32':
404
# On win32 you cannot access non-ascii filenames without
405
# decoding them into unicode first.
406
# However, under Linux, you can access bytestream paths
407
# without any problems. If this function was always active
408
# it would probably break tests when LANG=C was set
409
def translate_path(self, path):
410
"""Translate a /-separated PATH to the local filename syntax.
412
For bzr, all url paths are considered to be utf8 paths.
413
On Linux, you can access these paths directly over the bytestream
414
request, but on win32, you must decode them, and access them
417
# abandon query parameters
418
path = urlparse.urlparse(path)[2]
419
path = posixpath.normpath(urllib.unquote(path))
420
path = path.decode('utf-8')
421
words = path.split('/')
422
words = filter(None, words)
425
drive, word = os.path.splitdrive(word)
426
head, word = os.path.split(word)
427
if word in (os.curdir, os.pardir): continue
428
path = os.path.join(path, word)
402
432
class TestingHTTPServer(BaseHTTPServer.HTTPServer):
403
433
def __init__(self, server_address, RequestHandlerClass, test_case):