diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-27 02:17:10 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-27 02:17:10 +0100 |
commit | c68ab3e60c7a27e1b74ecd14977bf137b2cde1b6 (patch) | |
tree | 6600a22b31c07582b20829e6bba5396b938c0b82 | |
parent | b8b37fdad696c98124828821715cf228191d8f59 (diff) | |
parent | 5950587f2732262474b77e66d4672d9ca7e4b7b4 (diff) | |
download | mitmproxy-c68ab3e60c7a27e1b74ecd14977bf137b2cde1b6.tar.gz mitmproxy-c68ab3e60c7a27e1b74ecd14977bf137b2cde1b6.tar.bz2 mitmproxy-c68ab3e60c7a27e1b74ecd14977bf137b2cde1b6.zip |
Merge branch 'master' of https://github.com/mitmproxy/mitmproxy
-rw-r--r-- | .appveyor.yml | 4 | ||||
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | dev.bat | 1 | ||||
-rwxr-xr-x | dev.sh | 1 | ||||
-rw-r--r-- | mitmproxy/protocol/http2.py | 24 |
5 files changed, 19 insertions, 17 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index d4b688e5..805be7e7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -13,8 +13,8 @@ environment: SNAPSHOT_PASS: secure: LPjrtFrWxYhOVGXzfPRV1GjtZE/wHoKq9m/PI6hSalfysUK5p2DxTG9uHlb4Q9qV install: - - "pip install --user -U pip setuptools" - - "pip install --user -r requirements.txt" + - "pip install --user -U virtualenv" + - "dev.bat" - "python -c \"from OpenSSL import SSL; print(SSL.SSLeay_version(SSL.SSLEAY_VERSION))\"" test_script: - "py.test" diff --git a/.travis.yml b/.travis.yml index 5804b5c7..ce48ab21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,11 +37,13 @@ install: brew outdated openssl || brew upgrade openssl brew install python fi - - "pip install -U pip setuptools" - - "pip install -r requirements.txt" + - pip install -U virtualenv + - ./dev.sh + - source ./venv/bin/activate before_script: - "openssl version -a" + - "python -c \"from OpenSSL import SSL; print(SSL.SSLeay_version(SSL.SSLEAY_VERSION))\"" script: - "py.test ./test/$SCOPE" @@ -12,4 +12,3 @@ echo. echo * Created virtualenv environment in %VENV%. echo * Installed all dependencies into the virtualenv. echo * Activated virtualenv environment. -pause
\ No newline at end of file @@ -4,6 +4,7 @@ VENV=./venv python -m virtualenv $VENV --always-copy . $VENV/bin/activate +pip install -U pip setuptools pip install -r requirements.txt echo "" diff --git a/mitmproxy/protocol/http2.py b/mitmproxy/protocol/http2.py index 3fbc500a..aa0d7825 100644 --- a/mitmproxy/protocol/http2.py +++ b/mitmproxy/protocol/http2.py @@ -4,14 +4,14 @@ import threading import time import Queue +import h2 +from h2.connection import H2Connection + from netlib.tcp import ssl_read_select from netlib.exceptions import HttpException from netlib.http import Headers from netlib.utils import http2_read_raw_frame -from h2.connection import H2Connection -from h2.events import * - from .base import Layer from .http import _HttpTransmissionLayer, HttpLayer from .. import utils @@ -139,27 +139,27 @@ class Http2Layer(Layer): else: eid = event.stream_id - if isinstance(event, RequestReceived): + if isinstance(event, h2.events.RequestReceived): headers = Headers([[str(k), str(v)] for k, v in event.headers]) self.streams[eid] = Http2SingleStreamLayer(self, eid, headers) self.streams[eid].timestamp_start = time.time() self.streams[eid].start() - elif isinstance(event, ResponseReceived): + elif isinstance(event, h2.events.ResponseReceived): headers = Headers([[str(k), str(v)] for k, v in event.headers]) self.streams[eid].queued_data_length = 0 self.streams[eid].timestamp_start = time.time() self.streams[eid].response_headers = headers self.streams[eid].response_arrived.set() - elif isinstance(event, DataReceived): + elif isinstance(event, h2.events.DataReceived): if self.config.body_size_limit and self.streams[eid].queued_data_length > self.config.body_size_limit: raise HttpException("HTTP body too large. Limit is {}.".format(self.config.body_size_limit)) self.streams[eid].data_queue.put(event.data) self.streams[eid].queued_data_length += len(event.data) source_conn.h2.safe_increment_flow_control(event.stream_id, event.flow_controlled_length) - elif isinstance(event, StreamEnded): + elif isinstance(event, h2.events.StreamEnded): self.streams[eid].timestamp_end = time.time() self.streams[eid].data_finished.set() - elif isinstance(event, StreamReset): + elif isinstance(event, h2.events.StreamReset): self.streams[eid].zombie = time.time() self.client_reset_streams.append(self.streams[eid].client_stream_id) if self.streams[eid].server_stream_id: @@ -171,14 +171,14 @@ class Http2Layer(Layer): other_stream_id = self.streams[eid].server_stream_id if other_stream_id is not None: other_conn.h2.safe_reset_stream(other_stream_id, event.error_code) - elif isinstance(event, RemoteSettingsChanged): + elif isinstance(event, h2.events.RemoteSettingsChanged): new_settings = dict([(id, cs.new_value) for (id, cs) in event.changed_settings.iteritems()]) other_conn.h2.safe_update_settings(new_settings) - elif isinstance(event, ConnectionTerminated): + elif isinstance(event, h2.events.ConnectionTerminated): # Do not immediately terminate the other connection. # Some streams might be still sending data to the client. return False - elif isinstance(event, PushedStreamReceived): + elif isinstance(event, h2.events.PushedStreamReceived): # pushed stream ids should be uniq and not dependent on race conditions # only the parent stream id must be looked up first parent_eid = self.server_to_client_stream_ids[event.parent_stream_id] @@ -194,7 +194,7 @@ class Http2Layer(Layer): self.streams[event.pushed_stream_id].timestamp_end = time.time() self.streams[event.pushed_stream_id].request_data_finished.set() self.streams[event.pushed_stream_id].start() - elif isinstance(event, TrailersReceived): + elif isinstance(event, h2.events.TrailersReceived): raise NotImplementedError() return True |