aboutsummaryrefslogtreecommitdiffstats
path: root/test/h2/example.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-05-30 12:01:19 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-05-30 12:01:19 +1200
commit5e4850d3b3056d90a798d1563f0a619c5ef37e8c (patch)
treee9db4d5b1ee750cf96e8bed35b23195d3a5eb631 /test/h2/example.py
parente805f2d06609a297391e4486f9a8e5394bac5435 (diff)
parent629fa8e5528783501e402a7e33ac6199bb38ece6 (diff)
downloadmitmproxy-5e4850d3b3056d90a798d1563f0a619c5ef37e8c.tar.gz
mitmproxy-5e4850d3b3056d90a798d1563f0a619c5ef37e8c.tar.bz2
mitmproxy-5e4850d3b3056d90a798d1563f0a619c5ef37e8c.zip
Merge pull request #62 from Kriechi/h2-client
H2 client
Diffstat (limited to 'test/h2/example.py')
-rw-r--r--test/h2/example.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/h2/example.py b/test/h2/example.py
new file mode 100644
index 00000000..fc4f2f10
--- /dev/null
+++ b/test/h2/example.py
@@ -0,0 +1,18 @@
+from netlib.h2.frame import *
+from netlib.h2.h2 import *
+
+c = H2Client(("127.0.0.1", 443))
+c.connect()
+
+c.send_frame(HeadersFrame(
+ flags=(Frame.FLAG_END_HEADERS | Frame.FLAG_END_STREAM),
+ stream_id=0x1,
+ headers=[
+ (b':method', 'GET'),
+ (b':path', b'/index.html'),
+ (b':scheme', b'https'),
+ (b':authority', b'localhost'),
+ ]))
+
+while True:
+ print c.read_frame().human_readable()