Commit Graph

146 Commits

Author SHA1 Message Date
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
09da1febbd Shift a bunch more string-related functions to strutils 2016-06-02 13:04:19 +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
Maximilian Hils
2e633af5aa handle_* -> * leftovers 2016-05-29 13:01:45 -07: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
Thomas Kriechbaumer
0c2c017727 change comment indentation 2016-05-29 11:04:55 +02:00
Thomas Kriechbaumer
c707479bcd Merge pull request #1173 from mitmproxy/format-examples
Format examples
2016-05-29 11:03:54 +02:00
Aldo Cortesi
27fff86cf7 Update method names in /examples/flowbasic
Please enter the commit message for your changes. Lines starting
2016-05-29 20:51:30 +12:00
Maximilian Hils
17382b963e format examples 2016-05-29 01:23:39 -07:00
Aldo Cortesi
0176f50e4f Adapt examples 2016-05-29 12:54:52 +12:00
Maximilian Hils
6f8db2d7eb improve MultiDict, add ImmutableMultiDict, adjust response.cookies 2016-05-18 22:50:19 -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
Jason Pepas
b174fd5e1f Adding example which turns every reponse into an HTTP 500. (#1136)
* Adding example which turns every reponse into an HTTP 500.

* Prefer b"" over None for response.content.
2016-05-11 15:26:17 -06:00
Maximilian Hils
909d5ec87e FlowReadError -> FlowReadException 2016-04-29 11:17:49 -07: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
Maximilian Hils
6f902ffbb3 py3++: iteritems 2016-03-20 19:56:22 +01:00
Maximilian Hils
88d365cfe6 py3++: cStringIO 2016-03-20 19:40:03 +01:00
cle1000
0a478e4e39 Update modify_response_body.py
fix typo
2016-03-15 15:36:10 +01:00
Shadab Zafar
7c5791e51a Use the contextmanager in all tests 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
9ef1522b5f Update modify_querystring example & add test for it 2016-03-11 17:57:57 +05:30
Shadab Zafar
106b296871 Update modify_form example to not use deprecated functions 2016-03-11 17:57:57 +05:30
Maximilian Hils
167bd77683 fix content view example inline script 2016-03-10 21:17:05 +01:00
Shadab Zafar
7108d72705 Fix pprint import 2016-03-04 03:02:49 +05:30
Shadab Zafar
1c80599379 Use default empty page_list 2016-03-04 03:02:33 +05:30
Shadab Zafar
c982f579dd Add basic test for har_extractor 2016-03-04 02:32:01 +05:30
Shadab Zafar
1f41719bbc Remove some duplication and make more pythonic har_extractor 2016-03-02 11:39:48 +05:30
Shadab Zafar
27faea2355 Fixup HAR Extractor 2016-03-01 20:20:18 +05:30
Shadab Zafar
6bb27c162f har_extractor: Replace deprecated stuff with recommended ones 2016-02-20 21:01:59 +05:30
Shadab Zafar
be9329dfd4 har_extractor: Use items() instead of iteritems() 2016-02-20 21:01:27 +05:30
Aldo Cortesi
36e070ee25 Pull bin to the top, move pathod examples to examples dir 2016-02-18 10:15:59 +13:00
Aldo Cortesi
92597f82ea Docs and examples to top level 2016-02-18 09:27:08 +13:00
Maximilian Hils
33fa49277a move mitmproxy 2016-02-15 14:58:46 +01:00
Maximilian Hils
0f54f2990c Merge pull request #872 from bazzinotti/inline-tcp
Add "tcp_message" Inline Script Hook
2016-01-17 19:54:59 +01:00
Niko Kommenda
55e89865ff no longer strips Accept-Encoding as mitmproxy can handle compression 2016-01-12 22:25:42 +00:00
Niko Kommenda
25705af76d added sslstrip to inline script examples 2016-01-12 16:41:41 +00:00
Michael J. Bazzinotti
e766838a1a Add Inline Script Hooks to TCP mode 2016-01-10 13:05:01 -05:00
Stefan Wärting
27b801ebe2 Update redirect_requests.py
replace http version with "HTTP/1.1"
2016-01-08 16:02:27 +01:00
Maximilian Hils
247f27d821 minor stylistic fixes 2015-11-14 03:46:34 +01:00
Chris Czub
e72a9a62a1 Feedback from PR #832 2015-11-13 16:55:27 -05:00
Maximilian Hils
b13acd7956 adjust to netlib request changes + docs 2015-09-26 01:23:59 +02:00
Maximilian Hils
906360f63f code -> status_code, httpversion -> http_version 2015-09-17 15:16:33 +02:00
Maximilian Hils
14a5f405fd use new netlib exceptions 2015-09-17 02:13:28 +02:00
Maximilian Hils
0af0608978 adjust to netlib changes 2015-09-16 18:45:22 +02:00
Maximilian Hils
e63ef3a520 add inline script for conditional tls passthrough
fix #646
2015-09-08 21:35:15 +02:00
Maximilian Hils
5125c669cc adjust to new netlib Headers class 2015-09-05 20:45:58 +02:00
Maximilian Hils
a18db90ea3 update example inline scripts 2015-09-04 00:46:42 +02:00
Maximilian Hils
99126f62ed remove depth attribute from set_server 2015-09-03 18:25:36 +02:00