aboutsummaryrefslogtreecommitdiffstats
path: root/test/h2/example.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-05-28 17:46:30 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-05-29 15:31:22 +0200
commite2de49596d0e60e343c71c73e0847b17fb27ac3c (patch)
tree283e0953b28d1fcea210f4b657e9746eba369e1c /test/h2/example.py
parent780836b182cd982b978f16218299f2b77a8ed204 (diff)
downloadmitmproxy-e2de49596d0e60e343c71c73e0847b17fb27ac3c.tar.gz
mitmproxy-e2de49596d0e60e343c71c73e0847b17fb27ac3c.tar.bz2
mitmproxy-e2de49596d0e60e343c71c73e0847b17fb27ac3c.zip
add HTTP/2-capable client
Diffstat (limited to 'test/h2/example.py')
-rw-r--r--test/h2/example.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/h2/example.py b/test/h2/example.py
new file mode 100644
index 00000000..ca7c6c38
--- /dev/null
+++ b/test/h2/example.py
@@ -0,0 +1,20 @@
+from netlib import tcp
+from netlib.h2.frame import *
+from netlib.h2.h2 import *
+from hpack.hpack import Encoder, Decoder
+
+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()