Commit Graph

36 Commits

Author SHA1 Message Date
Aldo Cortesi
2aa1b98fbf netlib/test.py -> test/tservers.py 2015-06-22 14:52:23 +12:00
Thomas Kriechbaumer
e3d390e036 cleanup code with autopep8
run the following command:
  $ autopep8 -i -r -a -a .
2015-05-27 11:19:11 +02:00
Aldo Cortesi
f2bc58cdd2 Add tcp.Reader.safe_read, use it in socks and websockets
safe_read is guaranteed to raise or return a byte string of the
requested length. It's particularly useful for implementing binary
protocols.
2015-05-05 10:47:02 +12:00
Aldo Cortesi
b7a2fc8553 testing: http read_request corner case 2015-04-30 08:41:13 +12:00
Aldo Cortesi
42a87a1d8b websockets: handshake checks only take headers 2015-04-23 08:23:51 +12:00
Aldo Cortesi
7d83e388aa Whitespace, pep8, mixed indentation 2015-04-21 11:19:00 +12:00
Aldo Cortesi
dd7ea896f2 Return a named tuple from read_response 2015-04-21 11:11:16 +12:00
Aldo Cortesi
2c660d7633 Migrate requeset reading from mitmproxy to netlib 2015-04-21 11:05:12 +12:00
Aldo Cortesi
0c85c72dc4 ODict improvements
- Setting values now tries to preserve the existing order, rather than
just appending to the end.
- __repr__ now returns  a repr of the tuple list. The old repr becomes a
.format() method. This is clearer, makes troubleshooting easier, and
doesn't assume all data in ODicts are header-like
2015-04-15 10:28:17 +12:00
Maximilian Hils
da1eb94ccd 100% test coverage 🎉 2015-02-27 22:02:52 +01:00
Aldo Cortesi
9ce2f473f6 Simplify expected_http_body_size signature, fixing a traceback found in fuzzing 2014-11-07 15:59:00 +13:00
Maximilian Hils
6bd5df79f8 refactor response length handling 2014-07-21 14:01:24 +02:00
Brad Peabody
280d9b8625 added some additional functions for dealing with chunks - needed for mitmproxy streaming capability 2014-07-17 22:34:29 -07:00
Brad Peabody
273c25a705 added option for read_response to only read the headers, beginnings of implementing streamed result in mitmproxy 2014-07-12 22:42:06 -07:00
Maximilian Hils
763cb90b66 add tcp.Address to unify ipv4/ipv6 address handling 2014-01-28 17:26:35 +01:00
Maximilian Hils
cebec67e08 refactor read_http_body 2013-12-15 06:43:54 +01:00
Maximilian Hils
5e4ccbd7ed attempt to fix #24 2013-11-19 04:11:24 +01:00
Aldo Cortesi
9c13224353 Fix exception hierarchy. 2013-05-05 13:49:20 +12:00
Aldo Cortesi
5f0ad7b2a6 Ensure that HTTP methods are ASCII. 2013-03-03 22:13:23 +13:00
Aldo Cortesi
5a050bb6b2 Tighten up checks on port ranges and path character sets. 2013-03-03 21:39:15 +13:00
Aldo Cortesi
b21a7da142 parse_url: Handle invalid IPv6 addresses 2013-03-03 15:12:58 +13:00
Aldo Cortesi
7b9300743e More parse_url solidification: check that port is in range 0-65535 2013-03-03 15:08:17 +13:00
Aldo Cortesi
cd4ed8530f Check that hosts in parse_url do not contain NULL bytes. 2013-03-03 15:03:57 +13:00
Aldo Cortesi
2897ddfbee Stricter error checking for http.parse_url 2013-03-03 14:52:06 +13:00
Aldo Cortesi
1fe1a802ad 100% test coverage. 2013-03-03 12:16:09 +13:00
Aldo Cortesi
0acab862a6 Integrate HTTP auth, test to 100% 2013-03-03 10:37:28 +13:00
Aldo Cortesi
c6f9a2d74d More accurate description of an HTTP read error, make pyflakes happy. 2013-02-24 11:08:43 +13:00
Aldo Cortesi
d3b46feb60 Handle non-integer port error in parse_init_connect correctly 2013-01-05 20:06:55 +13:00
Aldo Cortesi
1c21a28e64 read_headers: handle some crashes, return None on invalid data. 2012-07-30 12:50:35 +12:00
Aldo Cortesi
91752990d5 Handle HTTP responses that have a body but no content-length or transfer encoding
We check if the server sent a connection:close header, and read till the socket
closes.

Closes #2
2012-07-24 11:41:18 +12:00
Aldo Cortesi
29f907ecf9 Handle HTTP versions malformed due to non-integer major/minor numbers. 2012-07-21 17:27:23 +12:00
Aldo Cortesi
1662d6d572 Repair test suite. 2012-06-24 23:16:06 +12:00
Aldo Cortesi
5988b65419 Add and unit test http.read_response 2012-06-24 22:45:40 +12:00
Aldo Cortesi
0de765f360 Make read_headers return an ODictCaseless object. 2012-06-24 21:49:23 +12:00
Aldo Cortesi
1263221ddd 100% testcoverage for netlib.http 2012-06-23 15:07:42 +12:00
Aldo Cortesi
5cf6aeb926 protocol.py -> http.py 2012-06-23 13:56:17 +12:00