mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
improve ALPN support on travis
This commit is contained in:
parent
ff478b5290
commit
4666d1e7bb
53
.travis.yml
53
.travis.yml
@ -1,26 +1,67 @@
|
||||
language: python
|
||||
|
||||
sudo: false
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
- pypy
|
||||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: 2.7
|
||||
env: OPENSSL=1.0.2
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
# Debian sid currently holds OpenSSL 1.0.2
|
||||
# change this with future releases!
|
||||
- debian-sid
|
||||
packages:
|
||||
- libssl-dev
|
||||
- python: pypy
|
||||
env: OPENSSL=1.0.2
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
# Debian sid currently holds OpenSSL 1.0.2
|
||||
# change this with future releases!
|
||||
- debian-sid
|
||||
packages:
|
||||
- libssl-dev
|
||||
|
||||
install:
|
||||
- "pip install --src . -r requirements.txt"
|
||||
# command to run tests, e.g. python setup.py test
|
||||
|
||||
before_script:
|
||||
- "openssl version -a"
|
||||
|
||||
script:
|
||||
- "nosetests --with-cov --cov-report term-missing"
|
||||
- "./check_coding_style.sh"
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "irc.oftc.net#mitmproxy"
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
# exclude cryptography from cache
|
||||
# it depends on libssl-dev version
|
||||
# which needs to be compiled specifically to each version
|
||||
before_cache:
|
||||
- pip uninstall -y cryptography
|
||||
- rm -rf /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/cryptography/
|
||||
- rm -rf /home/travis/virtualenv/pypy-2.5.0/site-packages/cryptography/
|
||||
- rm /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
|
||||
- rm /home/travis/virtualenv/pypy-2.5.0/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages
|
||||
- /home/travis/virtualenv/python2.7.9/bin
|
||||
- /home/travis/virtualenv/pypy-2.5.0/site-packages
|
||||
- /home/travis/virtualenv/pypy-2.5.0/bin
|
||||
- /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages
|
||||
- /home/travis/virtualenv/python2.7.9/bin
|
||||
- /home/travis/virtualenv/pypy-2.5.0/site-packages
|
||||
- /home/travis/virtualenv/pypy-2.5.0/bin
|
||||
|
@ -6,6 +6,8 @@ import sys
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
|
||||
import OpenSSL
|
||||
from OpenSSL import SSL
|
||||
|
||||
from . import certutils
|
||||
@ -401,16 +403,17 @@ class _Connection(object):
|
||||
if log_ssl_key:
|
||||
context.set_info_callback(log_ssl_key)
|
||||
|
||||
# advertise application layer protocols
|
||||
if alpn_protos is not None:
|
||||
context.set_alpn_protos(alpn_protos)
|
||||
if OpenSSL._util.lib.Cryptography_HAS_ALPN:
|
||||
# advertise application layer protocols
|
||||
if alpn_protos is not None:
|
||||
context.set_alpn_protos(alpn_protos)
|
||||
|
||||
# select application layer protocol
|
||||
if alpn_select is not None:
|
||||
def alpn_select_f(conn, options):
|
||||
return bytes(alpn_select)
|
||||
# select application layer protocol
|
||||
if alpn_select is not None:
|
||||
def alpn_select_f(conn, options):
|
||||
return bytes(alpn_select)
|
||||
|
||||
context.set_alpn_select_callback(alpn_select_f)
|
||||
context.set_alpn_select_callback(alpn_select_f)
|
||||
|
||||
return context
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user