| OLD | NEW |
| 1 """HTTP/1.1 client library | 1 """HTTP/1.1 client library |
| 2 | 2 |
| 3 <intro stuff goes here> | 3 <intro stuff goes here> |
| 4 <other stuff, too> | 4 <other stuff, too> |
| 5 | 5 |
| 6 HTTPConnection goes through a number of "states", which define when a client | 6 HTTPConnection goes through a number of "states", which define when a client |
| 7 may legally make another request or fetch the response for a particular | 7 may legally make another request or fetch the response for a particular |
| 8 request. This diagram details these state transitions: | 8 request. This diagram details these state transitions: |
| 9 | 9 |
| 10 (null) | 10 (null) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ------------- ------- ---------- | 60 ------------- ------- ---------- |
| 61 Idle _CS_IDLE None | 61 Idle _CS_IDLE None |
| 62 Request-started _CS_REQ_STARTED None | 62 Request-started _CS_REQ_STARTED None |
| 63 Request-sent _CS_REQ_SENT None | 63 Request-sent _CS_REQ_SENT None |
| 64 Unread-response _CS_IDLE <response_class> | 64 Unread-response _CS_IDLE <response_class> |
| 65 Req-started-unread-response _CS_REQ_STARTED <response_class> | 65 Req-started-unread-response _CS_REQ_STARTED <response_class> |
| 66 Req-sent-unread-response _CS_REQ_SENT <response_class> | 66 Req-sent-unread-response _CS_REQ_SENT <response_class> |
| 67 """ | 67 """ |
| 68 | 68 |
| 69 import socket | 69 import socket |
| 70 from sys import py3kwarning |
| 70 from urlparse import urlsplit | 71 from urlparse import urlsplit |
| 71 import warnings | 72 import warnings |
| 72 from test.test_support import catch_warning | 73 with warnings.catch_warnings(): |
| 73 with catch_warning(record=False): | 74 if py3kwarning: |
| 74 warnings.filterwarnings("ignore", ".*mimetools has been removed", | 75 warnings.filterwarnings("ignore", ".*mimetools has been removed", |
| 75 DeprecationWarning) | 76 DeprecationWarning) |
| 76 import mimetools | 77 import mimetools |
| 77 | 78 |
| 78 try: | 79 try: |
| 79 from cStringIO import StringIO | 80 from cStringIO import StringIO |
| 80 except ImportError: | 81 except ImportError: |
| 81 from StringIO import StringIO | 82 from StringIO import StringIO |
| 82 | 83 |
| 83 __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", | 84 __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", |
| 84 "HTTPException", "NotConnected", "UnknownProtocol", | 85 "HTTPException", "NotConnected", "UnknownProtocol", |
| 85 "UnknownTransferEncoding", "UnimplementedFileMode", | 86 "UnknownTransferEncoding", "UnimplementedFileMode", |
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 print 'status =', status | 1282 print 'status =', status |
| 1282 print 'reason =', reason | 1283 print 'reason =', reason |
| 1283 print "read", len(hs.getfile().read()) | 1284 print "read", len(hs.getfile().read()) |
| 1284 print | 1285 print |
| 1285 if headers: | 1286 if headers: |
| 1286 for header in headers.headers: print header.strip() | 1287 for header in headers.headers: print header.strip() |
| 1287 print | 1288 print |
| 1288 | 1289 |
| 1289 if __name__ == '__main__': | 1290 if __name__ == '__main__': |
| 1290 test() | 1291 test() |
| OLD | NEW |