tests: make hghave handle exec bit on Linux with vfat
[ 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):globaltagheaders={}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)