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.
[ original upstream message ]
#!/usr/bin/env python"""This does HTTP GET requests given a host:port and path and returnsa subset of the headers plus the body of the result."""importhttplib,systry:importmsvcrt,osmsvcrt.setmode(sys.stdout.fileno(),os.O_BINARY)msvcrt.setmode(sys.stderr.fileno(),os.O_BINARY)exceptImportError:passtwice=Falseif'--twice'insys.argv:sys.argv.remove('--twice')twice=Truereasons={'Not modified':'Not Modified'}# python 2.4tag=Nonedefrequest(host,path,show):assertnotpath.startswith('/'),pathglobaltagheaders={}iftag:headers['If-None-Match']=tagconn=httplib.HTTPConnection(host)conn.request("GET",'/'+path,None,headers)response=conn.getresponse()printresponse.status,reasons.get(response.reason,response.reason)forhin[h.lower()forhinshow]:ifresponse.getheader(h,None)isnotNone:print"%s: %s"%(h,response.getheader(h))printdata=response.read()sys.stdout.write(data)iftwiceandresponse.getheader('ETag',None):tag=response.getheader('ETag')returnresponse.statusstatus=request(sys.argv[1],sys.argv[2],sys.argv[3:])iftwice:status=request(sys.argv[1],sys.argv[2],sys.argv[3:])if200<=status<=305:sys.exit(0)sys.exit(1)