Maximilian Hils
fa45722ed8
Merge pull request #1402 from mhils/console-fixes
...
minor fixes
2016-07-23 12:49:57 -07:00
Maximilian Hils
61de6fa1d6
fix test_view_urlencoded
2016-07-23 11:55:27 -07:00
Thomas Kriechbaumer
514ea1b701
http2: cleanup tests
2016-07-23 11:08:32 +02:00
Shadab Zafar
08000c940c
Test marked property while serialization roundtrip
2016-07-23 10:41:57 +05:30
Aldo Cortesi
afda175e1c
Addon iface: .configure(options) -> .configure(options, updated)
2016-07-23 15:43:55 +12:00
Aldo Cortesi
b5416895f5
script: convert test recorder to an addon class
2016-07-23 11:38:45 +12:00
Aldo Cortesi
9294d19f90
scripts: .start can now return an Addon instance
2016-07-23 11:29:13 +12:00
Aldo Cortesi
51a8ba57f1
script: add a namespace adaptor to match Addons
2016-07-23 11:03:50 +12:00
Maximilian Hils
65c2f30218
fix mitmproxy 0.11 dumpfile - was 0.18 before
2016-07-22 10:36:26 -07:00
Maximilian Hils
798759d2b3
fix content view cache invalidation
2016-07-21 19:49:32 -07:00
Aldo Cortesi
33ffbc28ed
console: share one ActionBar instance
...
This fixes an issues where popping a view off the stack caused stale ActionBar
contents to be displayed.
2016-07-21 15:41:43 +12:00
Aldo Cortesi
6750ab899a
Merge branch 'flow-export' of https://github.com/dufferzafar/mitmproxy into dufferzafar-flow-export
2016-07-21 13:53:41 +12: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
Shadab Zafar
c84d0bd10b
Add a url exporter
2016-07-20 10:03:00 +05:30
Shadab Zafar
8f4d49e22a
Remove raw_request exporter
...
This functionality will be handled by headers+content
2016-07-20 10:03:00 +05:30
Aldo Cortesi
8317772377
mitproxy.options -> mitmproxy.optmanager, mitmproxy.flow.options -> mitmproxy.options
...
It might be slightly more felicitous to move optmanager into netlib at some
point, especially if we can also use it in pathod.
This also consolidates our constants in mitmproxy.options, removing some duplicates.
2016-07-20 11:28:53 +12:00
Aldo Cortesi
09fbebf42a
Test suite: get_proxy_config -> get_options
2016-07-19 19:36:40 +12:00
Aldo Cortesi
9c9d28d068
Remove proxy.config.process_proxy_options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
ef380917a8
ProxyConf: adapt mitmproxy console, ditch tcp|host filter attrs on flow.master
2016-07-19 16:25:09 +12:00
Aldo Cortesi
be081a24bc
ProxyConf: auth_* into Options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
5cfe783b6c
ProxyConfig: http2, rawtcp, no_upstream_cert -> Options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
26fa88a338
ProxyConfig: Refactor to move verification mode checks into configure
2016-07-19 16:25:09 +12:00
Aldo Cortesi
98bf544664
Regularize naming of upstream_trusted_ca* options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
0a3839375d
ProxyConfig: various SSL options to Options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
78e8159007
config.parse_server_spec shouldn't pass byts to tcp.Address
2016-07-19 16:25:09 +12:00
Aldo Cortesi
f9622074cc
ProxyConfig: mode, upstream_server and upstream_auth to Options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
d2268ddb1e
ProxyConfig: --body-size-limit to Options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
856e1c2ba9
Move clientcers & cadir to Options
...
Also adds a .configure mechanism to ProxyConfig, and hooks it up to the change
event.
2016-07-19 16:25:09 +12:00
Aldo Cortesi
b1b1a1b9cf
ProxyConfig: cadir to options
2016-07-19 16:25:09 +12:00
Aldo Cortesi
6908dc4d90
ProxyConfig refactor
...
Step two of frog boiling: move listening address and port into options. This is
the hard bit, because it touches the test suite so deeply.
2016-07-19 16:25:09 +12:00
Aldo Cortesi
9bc1514aef
Unify proxy config and options
...
This is step 1 in a gradual "boiling frog" strategy. Decorate ProxyConfig
with an Options object.
2016-07-19 16:25:09 +12:00
Aldo Cortesi
e9865800a8
Console options cleanup
...
Use setters, use togglers, move more things out of master
2016-07-18 10:31:34 +12:00
Aldo Cortesi
f9e4249499
Add a toggller helper to Options, start using it in mitmproxy console
2016-07-18 10:03:10 +12:00
Thomas Kriechbaumer
7b57c2948e
cleanup
2016-07-17 18:17:35 +02:00
Thomas Kriechbaumer
d9021f8505
http2: coverage++
2016-07-17 18:07:02 +02:00
Aldo Cortesi
216e38d437
setheaders -> addon
2016-07-17 18:41:14 +12:00
Aldo Cortesi
a26cc75aab
Merge pull request #1370 from cortesi/filestreamer
...
Some work on stream-to-file
2016-07-17 16:20:41 +12:00
Aldo Cortesi
9bf1d300d8
Some work on stream-to-file
...
- stream -> filestreamer throughout
- move active_flows set into FileStreamer addon
2016-07-17 16:07:29 +12:00
Aldo Cortesi
fb45d59c02
Merge pull request #1367 from Kriechi/fix-1366
...
fix-1366
2016-07-17 15:06:58 +12:00
Aldo Cortesi
08b3af98c2
Merge branch 'master' into dumper
2016-07-17 12:53:14 +12:00
Aldo Cortesi
b0b3b19ad6
Extract console dump functionality into an addon
...
This removes all the code that deals with printing flows to screen from dump.py
into a self-contained addon.
- This fixes a bug - by moving dumping into an
addon, we now dump flows AFTER addon transformation, so we can see the changes
made.
- We get dumping "for free" in other places by simply adding the addon. It's
now easy to add dumping to console to mitmweb for debugging and development.
The same goes for external projects that derive from master.
- We also get major benefits in clarity for a frankly hairy part of our
project. Mitmdump is much clearer, and all the hairyness is now isolated for
further refactoring.
2016-07-17 10:17:02 +12:00
Thomas Kriechbaumer
a32312cecc
fix-1366
2016-07-16 18:31:37 +02:00
Maximilian Hils
afc3f6d854
Merge remote-tracking branch 'duffer/tcpflow-filter'
2016-07-16 00:19:01 -07: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
Shadab Zafar
fea4435dac
Allow DummyFlow to match ~e, ~src and ~dst
2016-07-16 10:15:38 +05:30
Shadab Zafar
1d2ccb9170
Add DummyFlow and its Tests
2016-07-16 10:15:38 +05:30
Shadab Zafar
8c49f0e784
Add tests for TCPFlow.match
2016-07-16 10:15:38 +05:30
Shadab Zafar
6a2668d865
Add ~http and ~tcp filters
2016-07-16 10:15:38 +05:30
Shadab Zafar
262a420553
Use ~bq / ~bs for messages sent from client / server
2016-07-16 10:15:38 +05:30
Shadab Zafar
767457fda9
Add tests for HTTPFlow only filters
2016-07-16 10:15:38 +05:30
Shadab Zafar
317355a9af
Add test for operators (& | !)
2016-07-16 10:15:38 +05:30
Shadab Zafar
4e29993c1f
Add test for addresses (~src, ~dst)
2016-07-16 10:15:38 +05:30
Shadab Zafar
124b87b851
Add test for body (~b)
2016-07-16 10:15:38 +05:30
Shadab Zafar
88671c3aac
Add test for error (~e)
2016-07-16 10:15:38 +05:30
Aldo Cortesi
5f23d4f5ca
add_event -> add_log throughout project
...
"Event" is terribly over-loaded in the project, and "log" is straight-forward
and self-explanatory.
2016-07-16 10:19:06 +12:00
Aldo Cortesi
c4fb489a96
Zap unused test scripts
2016-07-15 22:37:52 +12:00
Aldo Cortesi
c7d0850d8f
Script cleanups
...
- Preserve script order on config change
- Prohibit script duplicates (i.e. identical script + args)
- Various cleanups and tweaks
2016-07-15 16:35:24 +12:00
Aldo Cortesi
917d51bd22
Fix HAR extractor
...
Thanks to @mhils
2016-07-15 15:01:35 +12:00
Aldo Cortesi
92a5076bd0
Adjust concurrent tests for start method
2016-07-15 15:00:37 +12:00
Aldo Cortesi
4ba7ce50c6
Add .start for addons and scripts
...
Also improve error messages, fix various unit tests
2016-07-15 14:52:34 +12:00
Aldo Cortesi
fcc1416ffd
Fix windows parse_args test
2016-07-15 10:33:51 +12:00
Aldo Cortesi
698af945a4
Adjust for new options scheme
2016-07-14 19:58:12 +12:00
Aldo Cortesi
a4127fb6d5
Add a tick event for addons and scripts, and use it for race-free reload
2016-07-14 19:54:15 +12:00
Aldo Cortesi
deffed2196
Script cleanup: editing in console, Python3 compatibility fixes
2016-07-14 19:54:15 +12: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
Aldo Cortesi
a6821aad8e
Zap old scripts infrastructure, fix concurrency tests
2016-07-14 19:54:15 +12:00
Aldo Cortesi
a3a22fba33
First-order integration of scripts addon
2016-07-14 19:54:15 +12:00
Shadab Zafar
1266255842
Re-add deletion of stickycookies ( #1355 )
...
This was originally added in #1324 (fixing issue #1096 )
but got lost during "the big refactor" (#1352 )
2016-07-14 00:37:27 -07:00
Maximilian Hils
f84a23f11d
minor fixes
2016-07-13 22:01:16 -07:00
Maximilian Hils
ec6fbe9eb6
make options explicit
2016-07-13 21:45:25 -07:00
Aldo Cortesi
b2c4f301cb
Stream to file -> addon
...
This commit also clarifies a confusion about the "outfile" attribute and its
use in testing in the mitmdump master.
2016-07-14 13:52:09 +12:00
Aldo Cortesi
703c05066e
Fix indeterminacy in sticky cookie tests
...
How has this not bitten us before?
2016-07-14 12:59:00 +12:00
Aldo Cortesi
00509d86a8
StickyCookies to addon
2016-07-14 12:13:14 +12:00
Aldo Cortesi
143bf0dfa9
AntiCache to addon
2016-07-14 11:24:06 +12:00
Aldo Cortesi
97b2e6d958
Add a .setter helper to Options
...
This returns a function that sets a named attribute, and is handy for
event-driven code like mitmproxy console.
2016-07-14 11:11:41 +12:00
Aldo Cortesi
a8a083a10d
Move StickyAuth into addon
...
This is the first addon that handles an OptionsError, so this commit also demos
how this works in console. Handling of command-line erorrs is on its way.
2016-07-14 10:08:41 +12:00
Aldo Cortesi
255e1eb00b
Add the addons mechanism
...
Demonstrate how it works and interacts with Options by adding our first new
builtin: anticomp.
2016-07-13 23:45:49 +12:00
Aldo Cortesi
7f8fd3cdff
Basic outline of addons
...
Add addons.py, integrate with our event mechanism, and change the Master API so
options is the first init argument.
2016-07-13 23:26:04 +12:00
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
Thomas Kriechbaumer
3579c6dd43
http2: fix race-condition in tests
2016-07-12 19:55:28 +02:00
Thomas Kriechbaumer
7c09255298
http2: more coverage
2016-07-10 20:07:43 +02:00
Thomas Kriechbaumer
b611997619
http2: simplify test class
2016-07-10 18:53:00 +02:00
Shadab Zafar
7eade1ef7c
Remove redundant tests
2016-07-10 01:08:02 +05:30
Shadab Zafar
39f5108400
Test cookies.is_expired separately
2016-07-10 01:06:50 +05:30
Shadab Zafar
6a746deff5
Add tests for deletion of stickycookies
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
c7cbbf5f0d
Set verbosity & flow_detail to 0
2016-07-09 12:32:41 +05:30
Shadab Zafar
147f61fa62
py3++
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
Maximilian Hils
f7639e077a
py3++
2016-07-08 15:58:12 -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
Maximilian Hils
7c67faa8da
remove script contexts
2016-07-07 23:50:55 -07:00
Maximilian Hils
c048ae1d5b
remove context from all scripts
2016-07-07 20:14:52 -07:00
Maximilian Hils
00dce24015
tests++
2016-07-07 18:02:59 -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
Shadab Zafar
c870d26bc7
py3++: test_protocol_http2
2016-07-07 16:39:25 +02:00
Maximilian Hils
f259b9478f
disable harparser on py3
2016-07-07 01:21:15 -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
8287ce7e6d
fix tests
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
684b4b5130
tnetstring: keys are str on py3. migrate flow.io_compat
2016-07-06 19:55:48 -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
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
5fecb8c843
http2: test fatal connection termination
2016-07-05 22:15:57 +02:00
Thomas Kriechbaumer
8d2042ea8a
http2: test throttling at MAX_CONCURRENT_STREAMS
2016-07-05 22:15:57 +02:00
Maximilian Hils
a6b3551934
raise ValueError if content-encoding is invalid
2016-07-04 13:58:09 -07:00
Shadab Zafar
45aa2174e2
http2: Remove TestReadRequestConnect test
2016-07-03 21:14:01 +05:30
Shadab Zafar
f623b3d99b
py3++: test_flow_export
2016-07-02 21:15:20 +05:30
Shadab Zafar
393c1d74af
fix lint issues
2016-07-02 18:56:22 +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
268e42e55e
py3++: test/mitmproxy/test_server
2016-07-01 10:23:04 -07:00
Maximilian Hils
f7d4319c5a
minor fixes
2016-06-28 23:48:19 -07:00
Maximilian Hils
3b53d3e393
fix mysterious tox issue
2016-06-28 19:26:08 -07:00
Thomas Kriechbaumer
5d0de16f57
http2: improve error handling in tests
2016-06-22 22:09:57 +02:00
Shadab Zafar
c0ba47094d
py3++: mitmproxy.protocol.http1
2016-06-22 13:37:41 +05:30
Shadab Zafar
0a53550955
mitmproxy.tnetstring -> mitmproxy.contrib.tnetstring
2016-06-21 23:53:59 +05:30
Shadab Zafar
10f4a36a5a
Imported tests for tnetstring
...
Copied from
a808f6b5ba/tests/test_format.py
Then ran pep8 etc.
2016-06-21 23:47:36 +05:30
Maximilian Hils
44abb4caea
Merge pull request #1276 from dufferzafar/console-pathedit
...
mitmproxy.console tests - PathEdit
2016-06-20 20:36:31 -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
Shadab Zafar
6aeba9777a
Add dummy directory to completion
2016-06-20 01:24:27 +05:30
Shadab Zafar
ba13fda10d
Add tests for PathEdit
2016-06-20 00:50:41 +05:30
Thomas Kriechbaumer
7bde38dc4a
py3++
2016-06-19 12:00:37 +02:00
Thomas Kriechbaumer
eb3ed87100
move custom HTTP/2 stack from netlib to pathod
2016-06-17 15:06:01 +02:00
Shadab Zafar
2a0e850615
pathod tests: do not string_escape specs
2016-06-16 17:08:21 -07:00
Shadab Zafar
6782b4ec00
Py3: Store certificate with a byte key
...
Had to debug this for hours!
2016-06-16 17:08:06 -07:00
Shadab Zafar
ea5576238f
Py3: Use BytesIO in a pathoc test
2016-06-16 17:08:06 -07:00
Shadab Zafar
f399a5cd29
Py3: Fix tests by using byte literals
2016-06-16 17:08:06 -07:00
Shadab Zafar
52fa195204
Unexpected spaces around =
2016-06-15 09:49:39 +02:00
Shadab Zafar
f83433e674
Py3: pathoc
2016-06-15 09:49:38 +02:00
Shadab Zafar
fa40531a80
Py3: pathod
2016-06-15 09:49:38 +02:00
Tai Dickerson
c2d0910e59
Make har_extractor.py output HAR 1.2 spec-compliant
...
HAR files were failing to load in harviewer (http://www.softwareishard.com/har/viewer/ ) due to:
- ISO 8601 dates for startedDateTime missing timezone (http://www.softwareishard.com/blog/har-12-spec/#pages )
-- Used UTC but could add detection of default system timezone if desired
- pages object missing pageTimings (http://www.softwareishard.com/blog/har-12-spec/#pageTimings )
-- Used {} because all child fields are optional
2016-06-14 12:47:10 -04: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
93276d45be
Merge branch 'master' into netlibrace
2016-06-14 16:29:15 +12:00
Aldo Cortesi
4c292b0197
Fix Python3 tests
2016-06-14 16:13:50 +12:00
Aldo Cortesi
50a20fefee
Satisfy lint
2016-06-14 14:34:30 +12:00
Aldo Cortesi
9e63350a96
Use handlers in http2 test suite
2016-06-14 14:32:18 +12:00
Aldo Cortesi
e6fd98bb72
Start rolling out leak detection in netlib
2016-06-14 14:32:18 +12:00
Maximilian Hils
63c6660895
update examples, tests, docs
2016-06-13 18:17:09 -07:00
Maximilian Hils
3c9a70b761
fix debug mode on Windows
2016-06-13 18:06:44 -07:00
Aldo Cortesi
9bea616441
Be stricter about handling connetcts in the pathoc test suite
...
Attempt to clear a niggling Appveyor exception buggering up our CI.
2016-06-12 10:39:19 +12:00
Aldo Cortesi
7b86560ded
debug: On SIGUSR2, we dump tracebacks for all threads to screen
2016-06-11 23:07:42 +12:00
Aldo Cortesi
09edbd9492
Improve debugging of thread and other leaks
...
- Add basethread.BaseThread that all threads outside of test suites should use
- Add a signal handler to mitmproxy, mitmdump and mitmweb that dumps resource
information to screen when SIGUSR1 is received.
- Improve thread naming throughout to make thread dumps understandable
2016-06-11 19:52:24 +12:00
Aldo Cortesi
5b9f07c81c
debug.sysinfo: tests and coverage
2016-06-11 17:56:17 +12:00
Aldo Cortesi
2cf79b7912
Remove timestamps from pathoc output
...
Pathoc is an interactive tool, no need for a long leading timestamp. More
generally, make timestamps optional in the logging mechanism so we can
configure this with command-line flags or something down the track.
2016-06-10 10:47:28 +12:00
Aldo Cortesi
c421c41307
Remove odict
...
- Adds default implementations for _kconv and _reduce_values to MultiDict.
Without these, operations fail in really, really non-obvious ways.
- Replace the remaining few instances of ODict
Fixes #1159
2016-06-09 13:28:43 +12:00
Shadab Zafar
b3b4156c2f
Py3: Fix test_language_http2 tests by using byte literals
2016-06-08 16:15:54 +05:30
Shadab Zafar
6b03df2633
Py3: Use global next() instead of iterator method
2016-06-08 16:15:54 +05:30
Shadab Zafar
0280af9522
Py3: Use BytesIO instead of StringIO
2016-06-08 16:15:54 +05:30
Aldo Cortesi
a5cb241c7c
If a message has been acked, all other processors are skipped
...
This applies the constraint, but does to clumsily. When we've unified modules
and processors it will be much nicer. We also make some exceptions for the
master processors that we may want to re-evaluate down the track.
2016-06-08 12:58:58 +12:00
Aldo Cortesi
b3bf754e53
Simplify script concurrency helpers
...
We now have take() to prevent double-replies.
2016-06-08 11:21:38 +12:00
Aldo Cortesi
a388ddfd78
A new interface for reply
...
Reply is now explicit - it's no longer a callable itself. Instead, we have:
reply.kill() - kill the flow
reply.ack() - ack, but don't send anything
reply.send(message) - send a response
This is part of an incremental move to detach reply from our flow objects,
and unify the script and handler interfaces.
2016-06-08 10:44:20 +12:00
Aldo Cortesi
982077ec31
Add reply.ack and reply.kill
2016-06-08 10:14:34 +12:00
Aldo Cortesi
db11fe0087
Merge branch 'master' into beautiful-json
2016-06-08 09:19:25 +12:00
Maximilian Hils
c98c83190b
tests++
2016-06-07 01:03:08 -07:00
Shadab Zafar
d254fe791a
Py3: Fix a test_language_writer test by using a byte literal
2016-06-07 00:01:41 -07:00
Maximilian Hils
ba466dbb35
simplify pretty_json, improve test coverage
2016-06-06 23:08:58 -07:00
Aldo Cortesi
1ffc273c94
Utils cleanups
...
- Move more stuff that belongs in netlib.human
- Move some stuff to near the only use
- Zap mitmproxy.utils.timestamp(). I see the rationale, but we used it
interchangeably with time.time() throughout the project. Since time.time()
dominates in the codebase and timestamp() is such low utility, away it goes.
2016-06-07 17:12:52 +12:00
Maximilian Hils
80292c0ac3
fix all pathod tests on Windows 🎉
2016-06-06 16:03:45 -07:00
Maximilian Hils
2ee5e8ef0e
fix NestedMessage encoding
2016-06-06 13:39:38 -07:00
Maximilian Hils
6447c8ae22
fix .freeze(), improve tests
2016-06-06 13:31:44 -07:00
Shadab Zafar
f48073af56
Py3: Fix status_code and other tests by using byte literals
2016-06-06 11:52:45 -07:00
Shadab Zafar
5a2932adc1
Py3: Fix corresponding base.Integer test in test_language_base
2016-06-06 11:52:45 -07:00
Shadab Zafar
40056e1cd7
Py3: Fix useragent tests
2016-06-06 11:52:45 -07:00
Shadab Zafar
f5a6b295f7
Py3: Fix websocket tests
2016-06-06 11:52:45 -07:00
Shadab Zafar
b86ef9fd04
Py3: Use BytesIO in tutils.render
2016-06-06 11:52:45 -07:00
Shadab Zafar
bafce6cfe9
Py3: Use byte string literals
2016-06-06 11:51:36 -07:00
Shadab Zafar
9a19540f8b
Py3: Use BytesIO instead of StringIO for tests
2016-06-06 11:51:36 -07:00
Shadab Zafar
12dd6f6707
Py3: Use global next() instead of iterator method
2016-06-06 11:51:36 -07:00
Shadab Zafar
ced6fb4cf9
Py3: Fix tests by using byte literals
2016-06-06 11:48:58 -07:00
Shadab Zafar
efb0f7133c
Py3: Use global next() instead of iterator method
2016-06-06 11:48:54 -07:00
Aldo Cortesi
210c376901
Fix sequencing in Pathoc websocket termination test
2016-06-06 18:17:22 +12:00
Aldo Cortesi
9458eaece7
Make more of the pathod test suite use synchronisation
2016-06-06 16:05:44 +12:00
Aldo Cortesi
08344ee38b
Merge pull request #1215 from redfast00/master
...
Now keeps header capitalization
2016-06-06 08:45:35 +12:00
Aldo Cortesi
c31b9c461d
Merge pull request #1211 from cortesi/pathod
...
WIP: Radical webectomy of pathod
2016-06-06 08:40:20 +12:00
redfast00
25505733bc
fix multidict unittests
2016-06-05 21:20:37 +02:00
Shadab Zafar
435bfeca0b
Use BytesIO instead of StringIO
2016-06-06 00:36:15 +05:30
Shadab Zafar
7b6da98719
Py3: Use byte literals for comparison
2016-06-06 00:07:44 +05:30
Shadab Zafar
be306c8439
Py3: Use global next() function instead of iterator method
2016-06-06 00:07:44 +05:30
Aldo Cortesi
375d7c9741
Remove last vestiges of noapi and noweb from pathod
...
Also hide HTTP2 freeze bug by making explain configurable in the tests
2016-06-05 13:24:46 +12:00
Aldo Cortesi
48da24ae7e
First-order removal of pathod API and app
2016-06-05 13:04:13 +12:00
Aldo Cortesi
c0c45c051a
Fix test that may fail due to binary header data
...
This is just inherently not a determinisitc test. We don't use the log HTTP
interface any more, so it can just go. A more radical "solution" is inbound
shortly.
Fixes #1207
2016-06-05 11:47:52 +12:00
Shadab Zafar
6ffe8b376e
Py3: Write bytes to file
2016-06-04 18:28:50 +05:30
Shadab Zafar
0d4437a404
Fix function name typo
2016-06-04 18:28:03 +05:30
Shadab Zafar
bd7b275d44
Py3: Convert all data to bytes in pathod.language.writer test
2016-06-04 15:23:09 +05:30
Shadab Zafar
614a3d7a54
Py3: Use global next() instead of iterator method
2016-06-04 15:23:09 +05:30
Aldo Cortesi
d5532319c1
Basic ConsoleMaster tests, based on mastertester
2016-06-04 19:07:27 +12:00
Aldo Cortesi
af63a3e064
console/__init__.py -> console/master.py
2016-06-04 16:06:44 +12:00
Aldo Cortesi
12a4f9ecf9
Very basic test truss for web.app
2016-06-04 15:30:28 +12:00
Aldo Cortesi
f7f9cab5dc
Rebase on master
2016-06-04 14:37:07 +12:00
Aldo Cortesi
e60860e65d
Make tcp.Client.connect return a context manager that closes the connection
2016-06-03 12:06:36 +12:00
Aldo Cortesi
c5076f5e01
Implement a service connection handler counter, use it in Pathod test suite
...
Lots of failures, but that's a good thing.
2016-06-03 11:47:07 +12:00
Aldo Cortesi
c6d15904f3
Merge remote-tracking branch 'upstream/master' into testsuite
2016-06-03 10:19:22 +12:00
Maximilian Hils
29c52d98dc
Merge remote-tracking branch 'duffer/pathod-lang-generators'
2016-06-02 09:53:22 -07:00
Aldo Cortesi
5fd52970fd
Satisfy linting gods
2016-06-02 19:55:52 +12:00
Aldo Cortesi
c9dd574f48
Silence requests warnings
...
Once we convert the rest of the suite to pathoc, this can go.
2016-06-02 19:40:39 +12:00
Aldo Cortesi
d8c52964c7
Reimplement test retrievals on pathoc and ditch requests
...
Requests uses urllib3, which has a connection pool that's not easy to disable
(https://github.com/shazow/urllib3/issues/383 ).
2016-06-02 19:36:02 +12:00
Shadab Zafar
b510616c69
Py3: Return bytes from FileGenerator
...
and use __getitem__ instead of __getslice__
2016-06-02 13:00:44 +05:30
Shadab Zafar
a04d7fd166
Py3: Return bytes from RandomGenerator
...
and use __getitem__ rather than __getslice__
2016-06-02 13:00:02 +05:30
Aldo Cortesi
a7522d9308
pathod.test shouldn't use the API at all
2016-06-02 18:27:51 +12:00
Aldo Cortesi
254614e9f7
Since we have locks over the logs, use direct access rather than API requests to get to them
2016-06-02 18:10:36 +12:00
Aldo Cortesi
ffca395e48
Honesty in testing
...
- Don't skip tests that fail
- Don't omit console from coverage
I'm working on the pathod races, and can't seem to reproduce the failures
locally.
Also, let's not kid ourselves about the console coverage - it should be
tracked. To improve it, we should measure it. Regressions in coverage of the
module should be flagged by CI.
2016-06-02 14:44:06 +12:00
Aldo Cortesi
09da1febbd
Shift a bunch more string-related functions to strutils
2016-06-02 13:04:19 +12:00
Aldo Cortesi
31012d782f
Consolidate some functions to strutils.bytes_to_escaped_str
2016-06-02 12:53:12 +12:00
Aldo Cortesi
cccdc98426
Utils reorganisation: add netlib.strutils
...
Extract a number of string and format-related functions to netlib.strutils.
2016-06-02 12:31:41 +12:00
Aldo Cortesi
eaa3b308f7
Fix non-deterministic test failures in export
...
We had various places in the code where we relied on incidental order of dict
keys. Add a helper to multidict, and fix.
2016-06-02 11:37:18 +12:00
Maximilian Hils
898602ad21
Merge pull request #1180 from dufferzafar/pathod-base
...
Python 3 - pathod.language.base
2016-05-31 14:46:28 -07:00
Maximilian Hils
30fff1fb32
be more strict about module namespaces
2016-05-31 14:05:57 -07:00
Aldo Cortesi
42e91fcfe1
http2.frame -> http2.framereader
2016-05-31 20:32:28 +12:00
Aldo Cortesi
5a75ea3fc6
Fix test failures
2016-05-31 20:19:54 +12:00
Aldo Cortesi
40a030f215
Satisfy flake8
2016-05-31 19:58:28 +12:00
Aldo Cortesi
f62efed304
Unify and make symmetric pretty_size and parse_size
2016-05-31 19:45:48 +12:00
Aldo Cortesi
b2f63458fc
Move human-friendly format functions to netlib.human, remove redundant implementations
2016-05-31 19:32:08 +12:00
Aldo Cortesi
ec34cae618
utils.multipartdecode -> http.multipart.decode
...
also
utils.parse_content_type -> http.headers.parse_content_type
2016-05-31 19:07:55 +12:00
Aldo Cortesi
15b2374ef9
netlib.utils.get_header_tokens -> netlib.http1.read.get_header_tokens
...
Placing this next to its only use.
2016-05-31 18:54:42 +12:00
Aldo Cortesi
6dda2b2ee5
Module is part of the name - url.decode, not url.urldecode
...
A pattern we need to use far more often in the codebase
2016-05-31 18:46:19 +12:00
Aldo Cortesi
4e6c9c4e93
Extract url functions from netlib.utils and move to netlib.http.url
2016-05-31 18:42:56 +12:00
Aldo Cortesi
08fbe6f111
Start cleaning up netlib.utils
...
- Remove http2 functions, move to http2.frame
- Remove Serializable, move to netlib.basetypes
2016-05-31 17:16:31 +12:00
Aldo Cortesi
9ea68ebd28
Improve handling of pseudo-headers
...
- The canonical source for :method, :scheme and :path are the .method, .scheme
and .path attributes on the request object.
- These pseudo-headers are stripped after reading the request, and re-inserted
just before sending.
- The :authority header remains, and should be handled analagously to the Host
header in HTTP1 with respect to display and user interaction.
2016-05-31 14:36:17 +12:00
Aldo Cortesi
bc6509ab6d
Fix test import error
2016-05-31 10:25:02 +12:00
Shadab Zafar
25e30f42be
Py3: Use byte literals for comparison
2016-05-31 01:13:50 +05:30
Maximilian Hils
89f07603ca
split mitmproxy.flow into mitmproxy.flow.*
2016-05-30 01:40:09 -07:00
Thomas Kriechbaumer
be9438b01c
fix
2016-05-29 22:58:56 +02:00
Thomas Kriechbaumer
8cd0c9c330
fix windows paths
2016-05-29 22:47:51 +02:00
Thomas Kriechbaumer
fb0b591242
fix har test
2016-05-29 22:30:15 +02:00
Thomas Kriechbaumer
03167d5e71
fix headers order
2016-05-29 22:07:22 +02:00
Thomas Kriechbaumer
01fcaa64c3
fix #1162
2016-05-29 13:58:14 +02:00
Thomas Kriechbaumer
e2447406cc
more style cleanup
2016-05-29 13:43:20 +02:00
Thomas Kriechbaumer
8eeab37a07
more style cleanup
...
Use this to check:
flake8 --count mitmproxy netlib pathod examples test
2016-05-29 11:55:12 +02:00
Aldo Cortesi
f3bee6f245
Merge pull request #1172 from cortesi/solidcore
...
First steps to solidifying the core
2016-05-29 20:03:40 +12:00
Maximilian Hils
85aa5da6e3
fix tests
2016-05-28 19:31:43 -07:00
Aldo Cortesi
0a875421c5
handle_* -> *
...
Now that we have the controller.handler decorator, the _handler prefix
stutters.
2016-05-29 12:49:01 +12:00
Aldo Cortesi
8bb9285678
Explicitly list all events
2016-05-29 12:15:52 +12:00