Compare commits

..

8 Commits
v1.0 ... v1.0.1

Author SHA1 Message Date
Maximilian Hils
6ae378aa20 bump version to 1.0.1 2016-12-27 19:26:28 +01:00
Maximilian Hils
141897c7fc turns out we need this 2016-12-27 19:14:46 +01:00
Maximilian Hils
c78ffbf16d fix url.parse tests for Python 3.6
This is a simpler version of @Kriechi's patch.
2016-12-27 19:09:56 +01:00
Thomas Kriechbaumer
51d57cfd4a py36: fix type information 2016-12-27 16:28:12 +01:00
Thomas Kriechbaumer
0bde932b78 run tests on Python 3.6 2016-12-27 16:28:12 +01:00
Maximilian Hils
38198769eb pyinstaller: use fixed bootloaders on linux 2016-12-27 03:09:43 +01:00
Maximilian Hils
2735338815 update windows dev script 2016-12-26 19:55:18 +01:00
Maximilian Hils
4b1224e592 add mitmweb explanation to introduction 2016-12-26 18:33:58 +01:00
10 changed files with 58 additions and 16 deletions

View File

@@ -7,6 +7,9 @@ environment:
matrix:
- PYTHON: "C:\\Python35"
TOXENV: "py35"
# TODO: ENABLE WHEN AVAILABLE
# - PYTHON: "C:\\Python36"
# TOXENV: "py36"
SNAPSHOT_HOST:
secure: NeTo57s2rJhCd/mjKHetXVxCFd3uhr8txnjnAXD1tUI=

View File

@@ -31,6 +31,16 @@ matrix:
- debian-sid
packages:
- libssl-dev
- python: 3.6
env: TOXENV=py36 OPENSSL_ALPN
addons:
apt:
sources:
# Debian sid currently holds OpenSSL 1.1.0
# change this with future releases!
- debian-sid
packages:
- libssl-dev
- python: 3.5
env: TOXENV=docs
git:

View File

@@ -1,7 +1,12 @@
$ErrorActionPreference = "Stop"
$VENV = ".\venv"
python3 -m venv $VENV --copies
$pyver = python --version
if($pyver -notmatch "3\.[5-9]") {
Write-Warning "Unexpected Python version, expected Python 3.5 or above: $pyver"
}
python -m venv $VENV --copies
& $VENV\Scripts\activate.ps1
python -m pip install --disable-pip-version-check -U pip

2
dev.sh
View File

@@ -2,7 +2,7 @@
set -e
set -x
PYVERSION=3.5
PYVERSION=${1:-3.5}
VENV="venv$PYVERSION"
echo "Creating dev environment in $VENV using Python $PYVERSION"

View File

@@ -6,6 +6,8 @@ with a console interface.
**mitmdump** is the command-line version of mitmproxy. Think tcpdump for HTTP.
**mitmweb** is a web-based interface for mitmproxy.
Documentation, tutorials and distribution packages can be found on the
mitmproxy website: `mitmproxy.org <https://mitmproxy.org/>`_

View File

@@ -1,4 +1,5 @@
import typing
import sys
def check_type(attr_name: str, value: typing.Any, typeinfo: type) -> None:
@@ -21,8 +22,15 @@ def check_type(attr_name: str, value: typing.Any, typeinfo: type) -> None:
type(value)
))
if typeinfo.__qualname__ == "Union":
for T in typeinfo.__union_params__:
typename = str(typeinfo)
if typename.startswith("typing.Union"):
if sys.version_info < (3, 6):
types = typeinfo.__union_params__
else:
types = typeinfo.__args__
for T in types:
try:
check_type(attr_name, value, T)
except TypeError:
@@ -30,21 +38,26 @@ def check_type(attr_name: str, value: typing.Any, typeinfo: type) -> None:
else:
return
raise e
elif typeinfo.__qualname__ == "Tuple":
elif typename.startswith("typing.Tuple"):
if sys.version_info < (3, 6):
types = typeinfo.__tuple_params__
else:
types = typeinfo.__args__
if not isinstance(value, (tuple, list)):
raise e
if len(typeinfo.__tuple_params__) != len(value):
if len(types) != len(value):
raise e
for i, (x, T) in enumerate(zip(value, typeinfo.__tuple_params__)):
for i, (x, T) in enumerate(zip(value, types)):
check_type("{}[{}]".format(attr_name, i), x, T)
return
elif typeinfo.__qualname__ == "Sequence":
elif typename.startswith("typing.Sequence"):
T = typeinfo.__args__[0]
if not isinstance(value, (tuple, list)):
raise e
for v in value:
check_type(attr_name, v, T)
elif typeinfo.__qualname__ == "IO":
elif typename.startswith("typing.IO"):
if hasattr(value, "read"):
return
elif not isinstance(value, typeinfo):

View File

@@ -1,4 +1,4 @@
IVERSION = (1, 0, 0)
IVERSION = (1, 0, 1)
VERSION = ".".join(str(i) for i in IVERSION)
PATHOD = "pathod " + VERSION
MITMPROXY = "mitmproxy " + VERSION

View File

@@ -35,6 +35,7 @@ setup(
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Security",

View File

@@ -1,3 +1,6 @@
import pytest
import sys
from mitmproxy.test import tutils
from mitmproxy.net.http import url
@@ -42,14 +45,18 @@ def test_parse():
# Null byte in host
with tutils.raises(ValueError):
url.parse("http://foo\0")
# Port out of range
_, _, port, _ = url.parse("http://foo:999999")
assert port == 80
# Invalid IPv6 URL - see http://www.ietf.org/rfc/rfc2732.txt
with tutils.raises(ValueError):
url.parse('http://lo[calhost')
@pytest.mark.skipif(sys.version_info < (3, 6), reason='requires Python 3.6 or higher')
def test_parse_port_range():
# Port out of range
with tutils.raises(ValueError):
url.parse("http://foo:999999")
def test_unparse():
assert url.unparse("http", "foo.com", 99, "") == "http://foo.com:99"
assert url.unparse("http", "foo.com", 80, "/bar") == "http://foo.com/bar"

View File

@@ -1,10 +1,9 @@
[tox]
envlist = py35, docs, lint
envlist = py35, py36, docs, lint
skipsdist = True
toxworkdir={env:TOX_WORK_DIR:.tox}
[testenv]
basepython = python3.5
deps =
{env:CI_DEPS:}
-rrequirements.txt
@@ -52,6 +51,8 @@ deps =
# The 3.2 release is broken 🎉
# the next commit after this updates the bootloaders, which then segfault! 🎉
# https://github.com/pyinstaller/pyinstaller/issues/2232
git+https://github.com/pyinstaller/pyinstaller.git@483c819d6a256b58db6740696a901bd41c313f0c
git+https://github.com/pyinstaller/pyinstaller.git@483c819d6a256b58db6740696a901bd41c313f0c; sys_platform == 'win32'
git+https://github.com/mhils/pyinstaller.git@d094401e4196b1a6a03818b80164a5f555861cef; sys_platform != 'win32'
commands =
rtool {posargs}