Commit Graph

971 Commits

Author SHA1 Message Date
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
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
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