Ticket #343: large_response_test.patch
| File large_response_test.patch, 2.3 KB (added by gawel, 3 years ago) |
|---|
-
tests/test_exactproxy.txt
38 38 'GET', 39 39 '/testform', 40 40 '', 41 {'Host': 'example.com:80' })41 {'Host': 'example.com:80', 'Content-Length': 0}) 42 42 Called httplib.HTTPConnection.getresponse() 43 43 Called httpresponse.getheader('content-length') 44 44 Called httpresponse.read() … … 55 55 'GET', 56 56 '/testform', 57 57 '', 58 {'Host': 'example.com:80' })58 {'Host': 'example.com:80', 'Content-Length': 0}) 59 59 Called httplib.HTTPConnection.getresponse() 60 60 Called httpresponse.getheader('content-length') 61 61 Called httpresponse.read() … … 76 76 'GET', 77 77 '/testform', 78 78 '', 79 {'Host': 'example.com:80' })79 {'Host': 'example.com:80', 'Content-Length': 0}) 80 80 Called httplib.HTTPConnection.getresponse() 81 81 Called httpresponse.getheader('content-length') 82 82 Called httpresponse.read() … … 102 102 'POST', 103 103 '/testform?test=result', 104 104 'var=value&var2=value2', 105 {'Host': 'differenthost.com' })105 {'Host': 'differenthost.com', 'Content-Length': 21}) 106 106 Called httplib.HTTPConnection.getresponse() 107 107 Called httpresponse.getheader('content-length') 108 108 Called httpresponse.read() 109 109 Called httplib.HTTPConnection.close() 110 111 A large response:: 112 113 >>> from wsgiproxy.exactproxy import BLOCK_SIZE 114 >>> set_response('200 Ok', h(content_type='application/unknow'), 'chunk '*BLOCK_SIZE) 115 >>> req = Request.blank('http://download-example.com/testfile') 116 >>> res = send(req) 117 Called httplib.HTTPConnection('download-example.com:80') 118 Called httplib.HTTPConnection.request( 119 'GET', 120 '/testfile', 121 '', 122 {'Host': 'download-example.com:80', 'Content-Length': 0}) 123 Called httplib.HTTPConnection.getresponse() 124 Called httpresponse.getheader('content-length') 125 Called httpresponse.read() 126 Called httplib.HTTPConnection.close() 127 >>> len(res.body) > BLOCK_SIZE 128 True 129 >>> print res # doctest: +ELLIPSIS 130 200 Ok 131 content-type: application/unknow 132 Content-Length: 393216 133 <BLANKLINE> 134 chunk chunk chunk chunk chunk chunk chunk ... 135
