tests/get-with-headers.py
branchstable
changeset 1200 1a67e2797f33
parent 1199 b9f44c378e62
child 1201 6f2f7246e4be
equal deleted inserted replaced
1199:b9f44c378e62 1200:1a67e2797f33
    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     if show[:1] == ['-']:
    34     if show[:1] == ['-']:
    35         show = [h for h, v in response.getheaders() if h.lower() not in show]
    35         show = sorted(h for h, v in response.getheaders()
       
    36                       if h.lower() not in show)
    36     for h in [h.lower() for h in show]:
    37     for h in [h.lower() for h in show]:
    37         if response.getheader(h, None) is not None:
    38         if response.getheader(h, None) is not None:
    38             print "%s: %s" % (h, response.getheader(h))
    39             print "%s: %s" % (h, response.getheader(h))
    39 
    40 
    40     print
    41     print