Commit Graph

520 Commits

Author SHA1 Message Date
Aldo Cortesi
a20f8e9620 More powerful Options scheme
This prepares us for the addon configuration mechanism and gives us a more
flexible way to handle options changes. This changeset should spell the end of
the current anti-pattern in our codebase where we duplicate data out of options
onto the master when mutability is needed. From now on, Options can be the one
source of thruth.

- Change notifications
- Rollback on error
2016-07-13 18:45:50 +12:00
strohu
6a9407d7cc Make sudo pfctl error check Python 3 compatible
In Python 3, subprocess.check_output() returns a sequence of bytes. This change ensures that it will be converted to a string, so the substring test for the sudo error message does not raise a TypeError. This fixes the code in Python 3 while remaining compatible with Python 2.
2016-07-12 15:47:01 +01:00
strohu
6217614204 Fix is_ascii check when determining next layer 2016-07-12 13:18:58 +01:00
Thomas Kriechbaumer
7c09255298 http2: more coverage 2016-07-10 20:07:43 +02:00
Shadab Zafar
c92992f03b Move cookie expiry detection to separate function 2016-07-09 22:20:25 +05:30
Shadab Zafar
608435cabf Delete stickycookies when told by the server
Fixes #1096
2016-07-09 22:20:25 +05:30
Shadab Zafar
0a21d27004 strutils.hexdump returns native_strings 2016-07-09 12:43:21 +05:30
Shadab Zafar
147f61fa62 py3++ 2016-07-09 11:14:12 +05:30
Shadab Zafar
b4469d2579 py3++: test_dump 2016-07-09 11:14:12 +05:30
Maximilian Hils
15c10d49f6 Merge pull request #1327 from mitmproxy/remove-script-context
Remove script context
2016-07-08 20:11:12 -07:00
Maximilian Hils
5d2b7c52f9 move script context to mitmproxy.ctx 2016-07-08 19:57:57 -07:00
jpkrause
05ab9c1b37 Updated coding style and modified flow format compat test to use v0.11 and v0.10 dump files 2016-07-08 15:03:36 -07:00
jpkrause
c9482c6255 Added flow converters for versions 0.11 and 0.12 2016-07-08 12:46:28 -07:00
Thomas Kriechbaumer
6da166d762 http2: fix self-depended streams 2016-07-08 10:37:56 +02:00
Maximilian Hils
7c67faa8da remove script contexts 2016-07-07 23:50:55 -07:00
Maximilian Hils
76473d44e0 py3++ 2016-07-07 17:50:26 -07:00
Maximilian Hils
f62e976e1e py3++ 2016-07-07 17:29:22 -07:00
Thomas Kriechbaumer
d962bd4e83 py3++ 2016-07-07 20:25:48 +02:00
Maximilian Hils
a212ce1f63 py3++ 2016-07-07 02:30:25 -07:00
Thomas Kriechbaumer
64ac2c73fe Merge pull request #1318 from mhils/tnetstring3-unicode-type
[tests actually pass] Add unicode to tnetstring3
2016-07-07 09:48:22 +02:00
Linmiao Xu
275cf7a6c2 Detect JSON API media type as a json content view
IANA assignment here:
https://www.iana.org/assignments/media-types/application/vnd.api+json

More about JSON API:
https://github.com/json-api/json-api
2016-07-06 21:10:35 -07:00
Maximilian Hils
64a867973d sni is now str, not bytes 2016-07-06 21:03:17 -07:00
Maximilian Hils
2c37ebfc72 fix dump file cross compat between python versions 2016-07-06 19:55:48 -07:00
Maximilian Hils
d406bee988 tnetstring3: adapt to unicode support 2016-07-06 19:55:48 -07:00
Maximilian Hils
48ee3a553e add tnetstring unicode type 2016-07-06 19:55:48 -07:00
Maximilian Hils
684b4b5130 tnetstring: keys are str on py3. migrate flow.io_compat 2016-07-06 19:55:48 -07:00
Maximilian Hils
e6e839d56d add python3 tnetstring implementation 2016-07-06 19:55:25 -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
444f0a4c39 py3++ 2016-07-06 17:31:08 -07:00
Maximilian Hils
38fd1d3ad7 fix issue introduced in 72f3b2b 2016-07-06 12:14:48 -07:00
Maximilian Hils
72f3b2bb17 minor code improvement 2016-07-05 19:32:25 -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
Thomas Kriechbaumer
05de3b759f http2: remove forbidden headers
E.g.: send_error_reponse sets a connection header
2016-07-05 22:15:57 +02:00
Thomas Kriechbaumer
50fdb01553 prevent early priority changes 2016-07-05 21:02:19 +02:00
Thomas Kriechbaumer
64880e7ebd handle related events from h2 2016-07-05 20:14:28 +02:00
Thomas Kriechbaumer
47db346959 improve end_stream handling
To replicate requests as close as possible frame-by-frame.

This fixes an issue with broken HTTP/2 implemenation by Akamai and
Twitter, which raise an error if we send an empty DataFrame only to
indicate END_STREAM.
2016-07-05 20:14:28 +02:00
Thomas Kriechbaumer
aa1b203182 http2: implement direct handling of priority 2016-07-05 20:14:28 +02:00
Maximilian Hils
ca9de786fd minor fix 2016-07-04 15:07:01 -07:00
Maximilian Hils
a6b3551934 raise ValueError if content-encoding is invalid 2016-07-04 13:58:09 -07:00
Shadab Zafar
d361177753 h2: move header parsing to netlib 2016-07-03 18:03:34 +05:30
Shadab Zafar
f623b3d99b py3++: test_flow_export 2016-07-02 21:15:20 +05:30
Shadab Zafar
17b727321f Replace map + lambda with list comprehensions 2016-07-02 21:15:20 +05:30
Shadab Zafar
393c1d74af fix lint issues 2016-07-02 18:56:22 +05:30
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
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
268e42e55e py3++: test/mitmproxy/test_server 2016-07-01 10:23:04 -07:00
Maximilian Hils
8366c87c57 update to latest typing release 2016-06-29 03:03:23 -07:00
Maximilian Hils
025efc030a Merge pull request #1301 from mitmproxy/simplify-tox
Simplify tox
2016-06-29 02:04:38 -07:00
Maximilian Hils
f7d4319c5a minor fixes 2016-06-28 23:48:19 -07:00
Maximilian Hils
b7430c0775 Merge pull request #1296 from gzzhanghao/test
[web] add tests for ducks/utils
2016-06-28 23:16:18 -07:00
Maximilian Hils
a57ea27bd4 watchdog: always use PollingObserver 2016-06-28 22:09:12 -07:00
Maximilian Hils
3b53d3e393 fix mysterious tox issue 2016-06-28 19:26:08 -07:00
Jason
37c2b47c26 [web] add tests for utils 2016-06-27 18:42:20 +08:00
Maximilian Hils
3eb2d04aac minor fixes 2016-06-26 01:45:45 -07:00
Jason
db415a26bc [web] log only in dev 2016-06-25 10:50:15 +08:00
Jason
a782571244 [web] build with envify 2016-06-25 10:43:30 +08:00
Jason
59dc5e4687 [web] update build 2016-06-25 10:09:21 +08:00
Jason
e400e9f513 [web] ErrorView 2016-06-25 09:52:49 +08:00
Jason
2b7923b4f4 [web] fix actions 2016-06-25 02:18:52 +08:00
Jason
571c817f21 [web] add msgQueue 2016-06-25 00:36:39 +08:00
Jason
5a1677c387 Merge branch 'master' of github.com:mitmproxy/mitmproxy into list
Conflicts:
	mitmproxy/web/static/app.js
	web/src/js/app.jsx
	web/src/js/connection.js
	web/src/js/ducks/websocket.js
2016-06-24 21:04:39 +08:00
Maximilian Hils
21c3480429 Merge remote-tracking branch 'jason/websocket' 2016-06-23 23:38:19 -07:00
Jason
f392b8e34c [web] bug fix 2016-06-24 01:20:42 +08:00
Jason
c40ff0277b [web] fix bugs 2016-06-24 01:01:34 +08:00
Jason
397554b7c7 [web] update build 2016-06-23 01:30:34 +08:00
Shadab Zafar
d655d8f1f3 py3++: mitmproxy.platform.pf 2016-06-22 13:38:00 +05:30
Shadab Zafar
119021a9c3 py3++: mitmproxy.proxy 2016-06-22 13:37:16 +05:30
Jason
57af1d00dd [web] set connected to false when DISCONNECTED 2016-06-22 11:29:21 +08:00
Jason
26aed8f56f [web] updateSettings -> handleWsMsg 2016-06-22 11:24:22 +08:00
Shadab Zafar
0a53550955 mitmproxy.tnetstring -> mitmproxy.contrib.tnetstring 2016-06-21 23:53:59 +05:30
Shadab Zafar
b5d280cab1 Py3: tnetstring
Copied the initial code from
[tnetstring3](https://raw.githubusercontent.com/carlopires/tnetstring3/master/tnetstring/__init__.py)

Then made some changes, like using the isdigit function, removing
superfluous ord() etc. to make all our tests pass.
2016-06-21 23:37:28 +05:30
Jason
9a7415a58d [web] store ws object in symbol property 2016-06-22 00:51:45 +08:00
Jason
0cab9ef1fa Merge remote-tracking branch 'origin/master' into websocket
Conflicts:
	mitmproxy/web/static/app.js
	web/src/js/components/ProxyApp.jsx
2016-06-22 00:49:21 +08:00
Maximilian Hils
7ef0e37c74 Merge pull request #1273 from Kriechi/fix-default-arg
fix default arg
2016-06-20 14:52:16 -07:00
Shadab Zafar
5b95803be0 py3++ 2016-06-20 21:57:18 +02:00
Shadab Zafar
efeade134a py3++ 2016-06-20 21:39:39 +02:00
Maximilian Hils
165deb08fd Merge remote-tracking branch 'jason/settings' 2016-06-19 18:27:12 -07:00
Thomas Kriechbaumer
6ad0e3e66e fix default arg 2016-06-19 12:05:10 +02:00
Thomas Kriechbaumer
7bde38dc4a py3++ 2016-06-19 12:00:37 +02:00
Jason
d01e49c6d5 [web] replace SetttingsActions.update with settings.updateSettings 2016-06-19 02:53:15 +08:00
Doug Freed
1f915b7f24 mitmproxy/models: missed comma in __all__
Spotted by Landscape (thanks @Kriechi for pointing out the site).  Add a
comma to the last item too, to prevent this from happening in the future
and reduce messing up blame later.
2016-06-18 14:50:06 -04:00
Jason
9cb5b0af9d Merge branch 'master' of github.com:mitmproxy/mitmproxy into websocket
Conflicts:
	mitmproxy/web/static/app.js
	web/src/js/components/ProxyApp.jsx
	web/src/js/connection.js
2016-06-18 14:18:24 +08:00
Jason
6c0511b06f [web] add app ducks 2016-06-18 14:11:47 +08:00
Maximilian Hils
ce53799c62 simplify settings reducer 2016-06-17 21:03:19 -07:00
Jason
965b27b529 [web] simplify settings 2016-06-17 22:12:32 +08:00
Jason
c82d27b2a2 Merge branch 'master' into settings
Conflicts:
	mitmproxy/web/static/app.css
	mitmproxy/web/static/app.js
	web/src/js/components/ProxyApp.jsx
2016-06-17 21:58:24 +08:00
Jason
e4addd60f1 Merge branch 'master' into websocket
Conflicts:
	mitmproxy/web/static/app.css
	mitmproxy/web/static/app.js
	web/src/js/components/ProxyApp.jsx
2016-06-17 21:54:31 +08:00
Jason
034287edcf [web] clean up 2016-06-17 07:57:06 +08:00
Jason
16a28eca25 [web] websocket 2016-06-17 07:26:29 +08:00
Jason
7a78970d10 [web] common 2016-06-17 07:07:38 +08:00
Jason
6ad2f13341 [web] fix settings ducks 2016-06-17 06:01:29 +08:00
Jason
cedac98b70 [web] promot reduce 2016-06-17 05:08:05 +08:00
Jason
7fb0836bfe [web] remove store 2016-06-17 05:08:05 +08:00
Jason
99b2b8633d [web] settings store 2016-06-17 05:08:05 +08:00
Jason
f5c597a9e3 [web] Editor & Prompt 2016-06-17 04:38:35 +08:00
Jason
e5bf1e930a [web] FlowView and ContentView 2016-06-17 04:37:57 +08:00