def read_response_body(self, request, response): expected_size = http1.expected_http_body_size(request, response) return http1.read_body( self.server_conn.rfile, expected_size, self.config.options.body_size_limit )
def read_response_body(self, request, response): expected_size = http1.expected_http_body_size(request, response) return http1.read_body( self.server_conn.rfile, expected_size, human.parse_size(self.config.options.body_size_limit) )
def read_request_body(self, request): expected_size = http1.expected_http_body_size(request) return http1.read_body( self.client_conn.rfile, expected_size, self.config.options.body_size_limit )
def read_request_body(self, request): expected_size = http1.expected_http_body_size(request) return http1.read_body( self.client_conn.rfile, expected_size, human.parse_size(self.config.options.body_size_limit) )
def test_stream_chunked(self): connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connection.connect(("127.0.0.1", self.proxy.port)) fconn = connection.makefile("rb") spec = '200:h"Transfer-Encoding"="chunked":r:b"4\\r\\nthis\\r\\n11\\r\\nisatest__reachhex\\r\\n0\\r\\n\\r\\n"' connection.send(b"GET %s/p/%s HTTP/1.1\r\n" % (self.server.urlbase.encode(), spec.encode())) connection.send(b"\r\n") resp = http1.read_response_head(fconn) assert resp.headers["Transfer-Encoding"] == 'chunked' assert resp.status_code == 200 chunks = list(http1.read_body(fconn, None)) assert chunks == [b"this", b"isatest__reachhex"] connection.close()
def test_stream_chunked(self): connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connection.connect(("127.0.0.1", self.proxy.port)) fconn = connection.makefile("rb") spec = '200:h"Transfer-Encoding"="chunked":r:b"4\\r\\nthis\\r\\n11\\r\\nisatest__reachhex\\r\\n0\\r\\n\\r\\n"' connection.send( b"GET %s/p/%s HTTP/1.1\r\n" % (self.server.urlbase.encode(), spec.encode())) connection.send(b"\r\n") resp = http1.read_response_head(fconn) assert resp.headers["Transfer-Encoding"] == 'chunked' assert resp.status_code == 200 chunks = list(http1.read_body(fconn, None)) assert chunks == [b"this", b"isatest__reachhex"] connection.close()
def read_response_body(self, request, response): expected_size = http1.expected_http_body_size(request, response) return http1.read_body( self.server_conn.rfile, expected_size, self.config.options._processed.get("body_size_limit"))
def read_request_body(self, request): expected_size = http1.expected_http_body_size(request) return http1.read_body( self.client_conn.rfile, expected_size, self.config.options._processed.get("body_size_limit"))