Mercurial > public > mercurial-scm > hg
comparison tests/get-with-headers.py @ 17017:953faba28e91
tests: prepare get-with-headers.py for MSYS
get-with-headers.py took the http GET parameter as a command line parameter
that had to start with '/'. MSYS on windows will mangle such paths.
Instead of applying a workaround everywhere (such as an extra '/') we let
get-with-headers.py add the mandatory '/'. That is consistent with the
url path handling in the Mercurial url class.
A few tests sent 'GET ?cmd=...' which is invalid. They will now send 'GET
/?cmd=...'.
This will not enable any tests for being run on windows - only remove one
reason they were disabled.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 21 Jun 2012 03:05:02 +0200 |
parents | bd98796c0b6f |
children | a4d7fd7ad1f7 |
comparison
equal
deleted
inserted
replaced
17016:468a950aebc3 | 17017:953faba28e91 |
---|---|
19 | 19 |
20 reasons = {'Not modified': 'Not Modified'} # python 2.4 | 20 reasons = {'Not modified': 'Not Modified'} # python 2.4 |
21 | 21 |
22 tag = None | 22 tag = None |
23 def request(host, path, show): | 23 def request(host, path, show): |
24 | 24 assert not path.startswith('/'), path |
25 global tag | 25 global tag |
26 headers = {} | 26 headers = {} |
27 if tag: | 27 if tag: |
28 headers['If-None-Match'] = tag | 28 headers['If-None-Match'] = tag |
29 | 29 |
30 conn = httplib.HTTPConnection(host) | 30 conn = httplib.HTTPConnection(host) |
31 conn.request("GET", path, None, headers) | 31 conn.request("GET", '/' + path, None, headers) |
32 response = conn.getresponse() | 32 response = conn.getresponse() |
33 print response.status, reasons.get(response.reason, response.reason) | 33 print response.status, reasons.get(response.reason, response.reason) |
34 for h in [h.lower() for h in show]: | 34 for h in [h.lower() for h in show]: |
35 if response.getheader(h, None) is not None: | 35 if response.getheader(h, None) is not None: |
36 print "%s: %s" % (h, response.getheader(h)) | 36 print "%s: %s" % (h, response.getheader(h)) |