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
00a35aa895
Merge pull request #1297 from dufferzafar/py3-flow-export
...
Python 3 - test_flow_export
2016-07-05 15:17:18 -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
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
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
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
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
Maximilian Hils
63c6660895
update examples, tests, docs
2016-06-13 18:17:09 -07: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
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
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
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
09da1febbd
Shift a bunch more string-related functions to strutils
2016-06-02 13:04:19 +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
Aldo Cortesi
42e91fcfe1
http2.frame -> http2.framereader
2016-05-31 20:32:28 +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
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
bc6509ab6d
Fix test import error
2016-05-31 10:25:02 +12:00
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
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
Aldo Cortesi
e4f043f69c
Flatten ServerMaster into Master
2016-05-29 12:01:46 +12:00
Aldo Cortesi
ed415877d4
Merge branch 'master' into solidcore
2016-05-29 11:14:46 +12:00
Thomas Kriechbaumer
caee1adeb6
cleanup imports with flake8
2016-05-28 14:43:32 +02:00
Aldo Cortesi
f4813d5649
Make @controller.handler inheritance-friendly
...
Use this to adapt mitmweb and mitproxy console
2016-05-28 12:38:07 +12:00
Aldo Cortesi
f29f6210bb
Mandate that all handlers must be wrapped, make tests pass
...
mitmproxy, mitmdump and mitmweb masters still to be done
2016-05-28 11:00:00 +12:00
Aldo Cortesi
7c4843857b
Sketch out a more solid core
...
- Decorator for handler methods
- Stricter checking for double-acks and non-acks
2016-05-28 11:00:00 +12:00
Thomas Kriechbaumer
ebaad91484
Merge pull request #1127 from mitmproxy/tcp-flows
...
mitmdump: Add Basic Support for TCP Flows
2016-05-23 20:54:14 +02:00
Aldo Cortesi
97f3077082
Merge branch 'mhils-multidict'
2016-05-21 15:01:19 +12:00
Aldo Cortesi
123e3b130c
We don't need 3 slightly different implementations of Data
2016-05-21 11:53:14 +12:00
Maximilian Hils
a3946d2a2d
tests++
2016-05-20 13:27:26 -07:00
Maximilian Hils
f96697646c
add FlowMaster.active_flows
2016-05-19 22:09:00 -07:00
Maximilian Hils
d38989fe7e
tests: finish connections properly
2016-05-19 22:07:56 -07:00
Maximilian Hils
d3c30d9005
fix tests, don't double-add error'd flows
2016-05-19 22:07:56 -07:00
Maximilian Hils
acd51befbb
minor fixes, adjust tests
2016-05-19 22:07:56 -07:00
Maximilian Hils
6f8db2d7eb
improve MultiDict, add ImmutableMultiDict, adjust response.cookies
2016-05-18 22:50:19 -07:00
Maximilian Hils
8e39b7bf38
test flow export with duplicate query string
2016-05-18 19:28:23 -07:00
Maximilian Hils
44ac64aa72
add MultiDict
...
This commit introduces MultiDict, a multi-dictionary similar to
ODict, but with improved semantics (as in the Headers class).
MultiDict fixes a few issues that were present in the Request/Response
API. In particular, `request.cookies["foo"] = "bar"` has previously been a
no-op, as the cookies property returned a mutable _copy_ of the cookies.
2016-05-18 18:46:42 -07:00
Thomas Kriechbaumer
09b90fce9e
remove debug print
2016-05-17 22:45:09 -07:00
Thomas Kriechbaumer
e61014d203
http2: add connection-lost test
2016-05-17 21:25:10 -07:00
Aldo Cortesi
d27fd55657
Fix broken test_flow_export tests
...
- Make the tests safe for concurrency
- Fix a test that only passed due to prior modification of global state
This also fixes the project generally for parallel test execution.
2016-05-18 12:34:45 +12:00
Aldo Cortesi
00cc836470
Clean up flow export tests
...
- Externalise test data
- Define a less finicky comparator for Python code
2016-05-18 12:16:50 +12:00
Thomas Kriechbaumer
f4a13d6f9f
http2: improve header tests ( #1143 ) ( #1144 )
2016-05-14 10:14:42 -07:00
Thomas Kriechbaumer
7a813936c6
disable http2 header encoding, use bytes everywhere
2016-05-11 16:47:58 -05:00
Thomas Kriechbaumer
bef72c1b02
Merge pull request #1121 from Kriechi/fix-cookies
...
improve cookie parsing
2016-05-11 12:30:44 -05:00
Thomas Kriechbaumer
e2ee48a0ee
replace SimpleCookie with our own parser lib
2016-05-11 12:20:21 -05:00
Maximilian Hils
67a37e6d1f
improve script loading
2016-05-11 11:15:36 -06:00
Maximilian Hils
74cfd7a4e2
stateobject: support lists
2016-04-29 20:59:26 -07:00
Maximilian Hils
317b4becca
mitmdump: don't fail for other flowtypes
2016-04-29 20:18:32 -07:00
Maximilian Hils
909d5ec87e
FlowReadError -> FlowReadException
2016-04-29 11:17:49 -07:00
Steven Van Acker
66267ad276
support for setting/sending multiple cookies ( #1091 )
...
* support for setting/sending multiple cookies
* py.test for multiple cookie support
2016-04-22 11:16:05 -07:00
Maximilian Hils
028f5c4929
downgrade pyparsing to fix #1087 and #1090
2016-04-21 17:11:28 -07:00
Maximilian Hils
423c076c61
cleanup mitmproxy.controller, raise Kill in Channel ( #1085 )
2016-04-14 12:03:29 -07:00
Maximilian Hils
bc60c26c7b
py3++
2016-04-13 22:34:28 -07:00
Maximilian Hils
70e35b7017
peer_address -> ip_address
2016-04-11 14:14:18 -07:00
Maximilian Hils
dcdee7dc46
server replay: keep --kill active
2016-04-09 16:47:05 -07:00
Maximilian Hils
0259f47997
Merge branch 'better-replace'
2016-04-03 08:17:30 -07:00
Thomas Kriechbaumer
f5fe93bf13
Merge pull request #1074 from mitmproxy/move-response-refresh
...
move HTTPResponse.refresh into netlib
2016-04-03 10:16:39 +02:00
Maximilian Hils
4e2acc4d9d
move HTTPResponse.refresh into netlib
2016-04-02 22:49:05 +02:00
Maximilian Hils
e6fa2688c9
form_(in|out) -> first_line_format
2016-04-02 21:57:35 +02:00
Maximilian Hils
610842cda5
fix FlowMaster.create_request, add test
2016-04-02 21:15:55 +02:00
Maximilian Hils
806aa0f41c
improve .replace() and move it into netlib
2016-04-02 14:38:33 +02:00
Zohar Lorberbaum
cd2ef2fe13
merge
2016-03-28 10:17:58 -07:00
Zohar Lorberbaum
37483e228f
Merge remote-tracking branch 'mitmproxy/master'
...
Merge with master
2016-03-28 10:06:02 -07:00
Zohar Lorberbaum
6d16f44ab7
Merge with master
2016-03-28 10:03:26 -07:00
Zohar Lorberbaum
e56198ae7c
cleaner target url
2016-03-28 09:51:06 -07:00
Zohar Lorberbaum
ef3d24e8c8
locust_task re-use locust_code.
2016-03-27 21:42:52 -07:00
Zohar Lorberbaum
9f77c80a32
pep8
2016-03-25 17:29:42 -07:00
Zohar Lorberbaum
5b07e8b3af
Add UI shortcuts.
2016-03-24 20:29:53 -07:00
Zohar Lorberbaum
a44062effb
Flow export to locust.io load test tool.
2016-03-23 01:49:18 -07:00
Maximilian Hils
726536689b
py3++
2016-03-20 22:58:35 +01:00
Maximilian Hils
2ce023a991
py3++
2016-03-20 22:50:03 +01:00
Maximilian Hils
88d365cfe6
py3++: cStringIO
2016-03-20 19:40:03 +01:00
Maximilian Hils
c52c59f858
port mitmproxy.scripts to py3
2016-03-19 19:53:27 +01:00
Maximilian Hils
4be9074b49
fix tests on OSX
2016-03-19 19:19:36 +01:00
Maximilian Hils
fb0b17ee93
simplify tests for @concurrent
2016-03-19 03:04:55 +01:00
Maximilian Hils
7e49b8c186
add tests for mitmproxy.script.reloader
2016-03-19 03:04:55 +01:00
Maximilian Hils
898f5d10b9
improve mitmproxy.scripts semantics, clean up tests
2016-03-19 03:04:55 +01:00
Maximilian Hils
983b0dd4f6
Merge pull request #1014 from ikoz/master
...
New option: Add server certs to client chain
2016-03-17 02:28:00 +01:00
ikoz
9cc55f211f
Rename 'server' to 'upstream' in identifiers related to the AddServerCertsToClientChain feature
2016-03-16 19:20:18 +00:00
ikoz
d26c7f4ca5
Move more init things inside AddServerCertsToClientChainMixin
2016-03-16 18:43:51 +00:00
ikoz
efc3e942d5
Restructuring of the AddServerCertsToClientChain test so that it uses a Mixin - also removed some extra printf statements
2016-03-16 17:43:48 +00:00
Thomas Kriechbaumer
0ab9e60168
Merge pull request #1019 from lilydjwg/master
...
add resolved IP address in "Details" tab
2016-03-15 23:28:08 +01:00
ikoz
776e625413
Add tests for add-server-certs-to-client-chain feature
2016-03-15 14:58:38 +00:00
lilydjwg
eecadadce3
use "peer_address" instead of "sock_address"
2016-03-15 21:32:06 +08:00
lilydjwg
20ec502032
fix tests for "sock_address"
2016-03-14 22:17:12 +08:00
Shadab Zafar
5a1c3c4ad8
Update contentview test
2016-03-11 18:40:51 +05:30
Shadab Zafar
35204ecb1c
Move har_extractor tests to the examples file
2016-03-11 17:57:57 +05:30
Shadab Zafar
7c5791e51a
Use the contextmanager in all tests
2016-03-11 17:57:57 +05:30
Shadab Zafar
af9442a9ba
Add contextmanager to load an example
2016-03-11 17:57:57 +05:30
Shadab Zafar
b95cc63b87
Add tests for redirect_requests example
2016-03-11 17:57:57 +05:30
Shadab Zafar
2cd5392657
Add test for iframe_injector example
2016-03-11 17:57:57 +05:30
Shadab Zafar
ba1cf18f42
Add tests for custom_contentviews example
2016-03-11 17:57:57 +05:30
Shadab Zafar
5eca2223d5
Add tests for modify_response_body example
2016-03-11 17:57:57 +05:30
Shadab Zafar
c378fe2199
Remove missing import
2016-03-11 17:57:57 +05:30
Shadab Zafar
9ef1522b5f
Update modify_querystring example & add test for it
2016-03-11 17:57:57 +05:30
Shadab Zafar
96df077d54
Add tests for add_header example
2016-03-11 17:57:57 +05:30
Shadab Zafar
a2274f52e4
Add tests for modify_form example
2016-03-11 17:57:57 +05:30
Thomas Kriechbaumer
f59770e949
Merge pull request #969 from dufferzafar/pretty-export
...
Indent JSON body while exporting it as code
2016-03-04 19:57:22 +01:00
Thomas Kriechbaumer
428da2c4b1
Merge pull request #989 from dufferzafar/har-extractor
...
Improve HAR Extractor Script
2016-03-04 19:55:52 +01:00
yonder
0e27dfd9c1
Improve test case
2016-03-04 11:12:03 -05:00
Shadab Zafar
d17cd5c6ec
Use custom Context object
2016-03-04 03:13:40 +05:30
Shadab Zafar
6a4f1ae7c7
Test har_extractor.response
2016-03-04 03:10:29 +05:30
Shadab Zafar
c982f579dd
Add basic test for har_extractor
2016-03-04 02:32:01 +05:30
Shadab Zafar
48f1c9afc2
Add a test for json request
2016-03-04 01:06:09 +05:30
yonder
b8ae666c78
Add test for upstream-auth
2016-03-02 12:19:33 -05:00
Maximilian Hils
ecb26c3c82
Merge remote-tracking branch 'duffer/pretty-host'
2016-02-18 23:17:02 +01:00
Shadab Zafar
d6ab9901d1
Fixup more tests
2016-02-18 21:58:32 +05:30
Maximilian Hils
20352f3453
fix test paths, move coverage config into setup.py
2016-02-18 13:24:17 +01:00
Aldo Cortesi
b6e5e50c24
Make fuzzing run again
2016-02-18 10:40:16 +13:00
Aldo Cortesi
92597f82ea
Docs and examples to top level
2016-02-18 09:27:08 +13:00
Will Coster
595d2a2fa0
Add a content view for query parameters
...
The query content view uses format_dict to display a table of query
parameters and is made the default content view for requests with
query parameters and no request body.
To facilitate this the query parameter dictionary of HTTPRequests is
added to the metadata content view parameter under the "query" key.
Additionally, the logic for handling "no content" messages is moved
from contentviews.get_content_view to ViewAuto. This is necessary as
it allows the query content view to be displayed when there is no
request body.
2016-02-16 18:50:10 -08:00
Thomas Kriechbaumer
6b585023fd
move tservers helper
2016-02-16 21:53:16 +01:00
Thomas Kriechbaumer
8242f2cc9d
rename ProxTest -> ProxyTest
2016-02-16 21:15:50 +01:00
Thomas Kriechbaumer
1785f70a19
fix all libpathod->pathod references
2016-02-16 21:11:19 +01:00
Thomas Kriechbaumer
d95a1f9819
fix all libmproxy->mitmproxy references
2016-02-16 20:56:33 +01:00
Maximilian Hils
fc9fa87827
fix ALPN checks
2016-02-15 18:43:06 +01:00
Maximilian Hils
d7158f975e
move tests into shared folder
2016-02-15 16:34:22 +01:00