Commit Graph

205 Commits

Author SHA1 Message Date
Shadab Zafar
03ce09ca99 Py3: Split on byte newlines in pathod.log 2016-06-15 09:49:39 +02:00
Shadab Zafar
22a94f06e6 Py3: Find Content-Length header by bytes 2016-06-15 09:49:38 +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
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
e6fd98bb72 Start rolling out leak detection in netlib 2016-06-14 14:32:18 +12:00
Aldo Cortesi
e58a2bf095 Merge branch 'master' into appveyor 2016-06-12 11:27:16 +12:00
Aldo Cortesi
dc545ca0f6 Make the tcp connection closer cancellable
And use this to make pathoc error handling more sophisticated
2016-06-12 11:17:05 +12:00
Aldo Cortesi
728d5caa22 Fold mitmproxy.version and pathod.version into netlib.version 2016-06-12 10:29:12 +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
11fb217191 Fix a crash when pathoc connections fail
Use the new handler to tidy this up.
2016-06-10 11:14:23 +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
Shadab Zafar
7d62121b85 Py3: encode() the spec before appending to path 2016-06-08 16:29:21 +05:30
Shadab Zafar
70216673a1 Py3: Find content-length header by bytes 2016-06-08 16:28:39 +05:30
Shadab Zafar
e187358e97 Py3: Pass bytes to http Request and Response 2016-06-08 16:17:00 +05:30
Shadab Zafar
4f97216501 Py3: Properly encode() access to user_agents 2016-06-08 16:15:54 +05:30
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
75ebd638eb Merge remote-tracking branch 'upstream/master' 2016-06-07 12:56:51 +12:00
Aldo Cortesi
e037fe05ff Migrate pathod docs to Sphinx
All the content of the pathod docs are moved into Sphinx. The interactive
format has not translated well to static docs, and there's still a lot of
rewriting, format fixing, structuring, etc to be done.
2016-06-07 12:55:32 +12: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
afa2ad81df Py3: encode() status code responses 2016-06-06 11:52:45 -07:00
Shadab Zafar
b03a98f9fc Py3: Exception doesn't have to be bytes 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
daba944151 Py3: Store base.Integer value as bytes 2016-06-06 11:52:45 -07:00
Shadab Zafar
78b2fa3a13 Py3: UASTRINGS should be indexed by and return bytes 2016-06-06 11:52:45 -07:00
Shadab Zafar
da38ce2e6e Py3: decode() input before creating new Header token 2016-06-06 11:52:45 -07:00
Shadab Zafar
c4ac19be9f Py3: Use bytes_to_escaped_str for escaping message 2016-06-06 11:52:45 -07:00
Shadab Zafar
4813f9c69e Py3: More byte literals 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
07a0d6dcc2 Py3: Return bytes from _Component class 2016-06-06 11:51:36 -07:00
Maximilian Hils
1214085f67 fix pathod test on Windows 2016-06-06 11:37:49 -07:00
Aldo Cortesi
210c376901 Fix sequencing in Pathoc websocket termination test 2016-06-06 18:17:22 +12:00
Aldo Cortesi
21c7218ee3 Close when Pathoc.connect raises an exception 2016-06-06 16:52:51 +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
Shadab Zafar
cff54edf6b Py3: Use functools.total_ordering for better rich comparison 2016-06-06 00:07:44 +05:30
Shadab Zafar
bda30efb35 Py3: Use rich comparison methods (__eq__, __lt__) instead of __cmp__ 2016-06-06 00:07:44 +05:30
Aldo Cortesi
a31c183a0f Ditch pathod static assets 2016-06-05 13:28:57 +12:00
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
Shadab Zafar
2dec2db756 Py3: Return path unescaped
[skip appveyor]
2016-06-04 18:31:31 +05:30
Shadab Zafar
1c82231129 Use encode to detect if string is valid ASCII 2016-06-04 12:49:11 +02:00
Shadab Zafar
ae553ef472 Fix Docstring: "inject" can be an action too 2016-06-04 15:23:09 +05:30
Aldo Cortesi
6943d7e397 More explicit name for the tcp.Server handler counter 2016-06-03 13:57:12 +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
36383a6146 Pathod websocket service threads should not be immortal 2016-06-03 11:58:05 +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
Shadab Zafar
8e60a9bca9 Handle the slice object case in TransformGenerator.__getitem__ 2016-06-03 02:00:58 +05:30
Maximilian Hils
5e385405ca please flake8 2016-06-02 09:54:19 -07:00
Maximilian Hils
29c52d98dc Merge remote-tracking branch 'duffer/pathod-lang-generators' 2016-06-02 09:53:22 -07:00
Shadab Zafar
75ce2498e8 Simplify rand_byte by creating a special case for Python 2 2016-06-02 13:34:18 +05:30
Aldo Cortesi
69de78515d Make last_log actually return last log 2016-06-02 19:45:18 +12:00
Shadab Zafar
ec5d931ee3 Remove redundant __getslice__ from TransformGenerator 2016-06-02 13:02:17 +05:30
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
40156ce123 Bump error timeout 2016-06-02 17:55:11 +12:00
Aldo Cortesi
5e12384486 Remove debug print 2016-06-02 17:54:34 +12:00
Aldo Cortesi
92decf96dd Add expect_log to the pathod test truss, and use it for last_log 2016-06-02 17:46:37 +12:00
Aldo Cortesi
29bcdc8250 Fix lock over pathod locks
There were basically a nop before... o_O
2016-06-02 16:08:17 +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
3d9dbd6a49 xrepr is used exactly once. move to pathoc.py. 2016-06-02 12:37:24 +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
Shadab Zafar
42f16d5d40 Py3: Use six.string_types instead of basestring 2016-05-31 00:49:44 +05:30
Shadab Zafar
769e20f2a9 Py3: Use range from six.moves 2016-05-31 00:41:44 +05:30
Aldo Cortesi
b2f63458fc Move human-friendly format functions to netlib.human, remove redundant implementations 2016-05-31 19:32:08 +12:00
Thomas Kriechbaumer
e2447406cc more style cleanup 2016-05-29 13:43:20 +02:00
Thomas Kriechbaumer
e4045dc7f8 pathod: fix most flake8 offenses 2016-05-28 22:44:28 +02:00
Thomas Kriechbaumer
caee1adeb6 cleanup imports with flake8 2016-05-28 14:43:32 +02:00
Shadab Zafar
4ec56808dd remove str() 2016-05-26 23:07:37 +05:30
Shadab Zafar
1bbb178b6a Remove inner_repr, fixup escape_unprintables 2016-05-26 23:07:37 +05:30
Shadab Zafar
1699592f09 Use escaped_str functions for TokValueLiteral 2016-05-26 23:07:37 +05:30
Shadab Zafar
daaa672d39 Remove Py3 specific check 2016-05-26 23:07:37 +05:30
Shadab Zafar
5c62fabc84 Use BytesIO in pathod app 2016-05-26 23:07:37 +05:30
Shadab Zafar
22e4bc1938 Py3: Handle bytes case in inner_repr 2016-05-26 23:07:37 +05:30
Shadab Zafar
e5cebb81fb Removed wrong import 2016-05-26 23:07:37 +05:30
Shadab Zafar
88e42bab6d Py3: inner_repr and escape_unprintables 2016-05-26 23:07:37 +05:30
Shadab Zafar
f3932b27da Py3: Import and Other misc. stuff 2016-05-26 23:07:37 +05:30
Aldo Cortesi
123e3b130c We don't need 3 slightly different implementations of Data 2016-05-21 11:53:14 +12:00
Thomas Kriechbaumer
55a17b2ed3 fix encoding error on *too* random bytes
This should fix things like:

def __init__(self, val):
    self.val = val.decode("string_escape")
ValueError: Trailing \ in string
pathod/language/base.py:108: ValueError

test/pathod/test_language_websocket.py:83: in fr
    return netlib.websockets.Frame.from_bytes(tutils.render(wf, settings))
test/pathod/tutils.py:123: in render
    r = r.resolve(settings)
pathod/language/websockets.py:179: in resolve
    Key(base.TokValueLiteral(os.urandom(4)))
2016-05-15 10:41:54 -07:00
Maximilian Hils
acab4fea5a fix version.NAME 2016-05-11 13:02:19 -06:00
Maximilian Hils
bc60c26c7b py3++ 2016-04-13 22:34:28 -07:00
Maximilian Hils
35a6d6e7f6 response.msg -> response.reason 2016-04-02 22:54:46 +02:00
Thomas Kriechbaumer
ec68d8b8e4 s/nocover/no cover/g
according to coveralls docs
2016-03-27 12:02:41 +02: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
ikoz
9b970b0303 fix for sslinfo cert chain printing bug - now all certs get printed 2016-03-15 14:40:54 +00:00
Maximilian Hils
d33d3663ec combine projects 2016-02-18 13:03:40 +01:00
Maximilian Hils
294774d6f0 move pathod/.sources to root 2016-02-18 12:29:49 +01:00
Aldo Cortesi
36e070ee25 Pull bin to the top, move pathod examples to examples dir 2016-02-18 10:15:59 +13:00
Maximilian Hils
b7701eb8c1 add combined MANIFEST.in and CHANGELOG 2016-02-17 00:02:18 +01:00
Thomas Kriechbaumer
1785f70a19 fix all libpathod->pathod references 2016-02-16 21:11:19 +01:00
Thomas Kriechbaumer
dedca54099 rename pathod source directory 2016-02-16 20:37:53 +01:00
Maximilian Hils
5101843683 fix wheel creation, re-add MANIFEST.in 2016-02-16 04:28:10 +01:00
Maximilian Hils
4583fa7922 remove MANIFEST.in, move Dockerfile to root 2016-02-16 00:57:42 +01:00
Maximilian Hils
10f9b6faa7 fix release tool, refs #947 2016-02-16 00:22:38 +01:00