Commit Graph

658 Commits

Author SHA1 Message Date
Maximilian Hils
e07f515a20 remove content caching in netlib.http.Message 2016-07-23 19:05:10 -07:00
Maximilian Hils
e920c101e5 add single-element cache for netlib.encoding 2016-07-23 18:49:01 -07:00
Maximilian Hils
fa45722ed8 Merge pull request #1402 from mhils/console-fixes
minor fixes
2016-07-23 12:49:57 -07:00
Maximilian Hils
fcb906dc97 improve dumper addon text alignment (#1415) 2016-07-23 12:01:05 -07:00
Maximilian Hils
61de6fa1d6 fix test_view_urlencoded 2016-07-23 11:55:27 -07:00
Maximilian Hils
798759d2b3 fix content view cache invalidation 2016-07-21 19:49:32 -07:00
Aldo Cortesi
02acfb1242 Fix netlib.utils.is_valid_host
- Don't crash when passed an empty string. This translated into an actual core
crash, discovered while fuzzing with afl.
- Taking a slice of length one out of bytes returns an integer, so the check
for trailing period in this function never worked on Python3.
- Add unit tests.
2016-07-21 10:38:37 +12:00
Maximilian Hils
b27db1fc81 minor fixes 2016-07-19 18:09:33 -07:00
Thomas Kriechbaumer
a32312cecc fix-1366 2016-07-16 18:31:37 +02:00
Maximilian Hils
b27d59095d Merge pull request #1306 from mitmproxy/message-body-encoding
Improve Message Body Encoding
2016-07-16 00:13:58 -07:00
Maximilian Hils
e6e39ce80f preserve content-type parameter order 2016-07-15 23:46:12 -07:00
Aldo Cortesi
1a1f7e6fd9 replacehooks -> addon
Also fixes a bug in header replacements in netlib that resulted in a mutable
multidict.
2016-07-16 18:37:30 +12:00
Maximilian Hils
3602fd7a36 Merge remote-tracking branch 'origin/master' into message-body-encoding 2016-07-15 23:17:57 -07:00
Maximilian Hils
a3c7c84d49 improve message content semantics 2016-07-15 22:50:33 -07:00
Aldo Cortesi
b94f5fd361 Convert examples and example tests for new-style scripts
Remove the test that just loads all the example scripts for now - it's a very
low-value test, and we need to think of something better.
2016-07-14 19:54:15 +12:00
Thomas Kriechbaumer
c90de8b9a4 fix sysinfo for py3 2016-07-10 13:16:23 +02:00
Shadab Zafar
39f5108400 Test cookies.is_expired separately 2016-07-10 01:06:50 +05:30
Shadab Zafar
c92992f03b Move cookie expiry detection to separate function 2016-07-09 22:20:25 +05:30
Shadab Zafar
83a1cc5a9a Make escape_control_characters handle strings on Py2 2016-07-09 13:28:20 +05:30
Shadab Zafar
0a21d27004 strutils.hexdump returns native_strings 2016-07-09 12:43:21 +05:30
Maximilian Hils
0a1431ed2c fix #1314 2016-07-08 15:50:11 -07:00
Maximilian Hils
7a5b21556b fix tests 2016-07-07 19:34:57 -07:00
Maximilian Hils
00dce24015 tests++ 2016-07-07 18:02:59 -07:00
Maximilian Hils
f62e976e1e py3++ 2016-07-07 17:29:22 -07:00
Maximilian Hils
64a867973d sni is now str, not bytes 2016-07-06 21:03:17 -07:00
Maximilian Hils
9c873d63f4 py3++, multidict fixes
This commit improves Python 3 compatibility and fixes two multidict
issues:

 1. Headers.items(multi=True) now decodes fields
 2. MultiDict.clear(item) has been removed, as Python's
    MutableMapping already defines .clear() with different
    semantics. This is confusing for everyone who expects a
    dict-like object. `.pop("attr", None)` is not fantastic,
    but it's the Python way to do it.
2016-07-06 19:53:29 -07:00
Maximilian Hils
55fae7cea9 Merge pull request #1319 from mitmproxy/fix-py27-encoding-issues
Fix pathod log encoding
2016-07-06 17:35:34 -07:00
Maximilian Hils
444f0a4c39 py3++ 2016-07-06 17:31:08 -07:00
Maximilian Hils
8b564bc934 fix pathod log encoding 2016-07-06 16:47:32 -07:00
Maximilian Hils
e84f5fcc72 Merge pull request #1315 from mitmproxy/better-unicode-handling
remove clean_bin, clarify unicode handling
2016-07-05 16:02:37 -07:00
Maximilian Hils
00a35aa895 Merge pull request #1297 from dufferzafar/py3-flow-export
Python 3 - test_flow_export
2016-07-05 15:17:18 -07:00
Maximilian Hils
d51cf543bb remove clean_bin, clarify unicode handling 2016-07-05 15:11:32 -07:00
Maximilian Hils
a6b3551934 raise ValueError if content-encoding is invalid 2016-07-04 13:58:09 -07:00
Thomas Kriechbaumer
23e295b37e py3: fix bytes vs. str 2016-07-03 23:22:04 +02:00
Shadab Zafar
d361177753 h2: move header parsing to netlib 2016-07-03 18:03:34 +05:30
Shadab Zafar
5b5a3ffa8e netlib: condition on PY2 rather than on PY3
Let's just hope PY4 doesn't break this!
2016-07-02 21:15:20 +05:30
Maximilian Hils
2f8a1fd2cb tests++ 2016-07-02 03:03:42 -07:00
Maximilian Hils
d9f797e7e6 make the linter happy 2016-07-02 02:11:00 -07:00
Maximilian Hils
6032c4f235 message.content -> .raw_content, implement .text
This PR improves our handling of HTTP message body encodings:

- The unaltered message body is now accessible as `.raw_content`
- The "content-encoding"-decoded content (i.e. gzip removed) content
  is not `.content`, as this is what we want in 99% of the cases.
- `.text` now provides the "content-encoding"-decoded and then
  "content-type charset"-decoded message body.
- The decoded values for `.content` and `.text` are cached,
  so that repeated access and `x.text = x.text` is cheap.
- The `decoded()` decorator is now deprecated, as we can now just use
  `.content`. Similarly `HTTPMessage.get_decoded_content()` is
  deprecated.
2016-07-02 01:51:47 -07:00
Maximilian Hils
2c09e0416b minor fixes 2016-07-01 17:49:18 -07:00
Maximilian Hils
fa72462798 fix tcp message handling 2016-07-01 17:17:16 -07:00
Maximilian Hils
536c7acd13 py3++ 2016-07-01 14:10:48 -07:00
Shadab Zafar
e0ed7699ca Handle case when scheme is None 2016-07-01 10:23:04 -07:00
Thomas Kriechbaumer
5d0de16f57 http2: improve error handling in tests 2016-06-22 22:09:57 +02:00
Thomas Kriechbaumer
eb3ed87100 move custom HTTP/2 stack from netlib to pathod 2016-06-17 15:06:01 +02:00
Shadab Zafar
d9b940c21e Py3: websockets 2016-06-15 09:49:38 +02:00
Shadab Zafar
0f1aa2b78e Py3: fix http2 bytes issue 2016-06-15 09:49:38 +02:00
Aldo Cortesi
a63817f2b8 Merge pull request #1253 from mhils/fix-debug
Fix Debug Mode on Windows
2016-06-14 17:12:02 +12:00
Aldo Cortesi
e6fd98bb72 Start rolling out leak detection in netlib 2016-06-14 14:32:18 +12:00
Maximilian Hils
3c9a70b761 fix debug mode on Windows 2016-06-13 18:06:44 -07:00