Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'startup': 0.05; 'error:': 0.07; 'subject:support': 0.07; 'enhancements': 0.09; 'implements': 0.09; 'pep': 0.09; 'pyopenssl': 0.09; 'subject:2.7': 0.09; 'url:archive': 0.09; 'python': 0.11; '2.7': 0.14; 'from:addr:poczta.fm': 0.16; 'pypi.': 0.16; 'received:217.74': 0.16; 'received:217.74.65': 0.16; 'received:interia.pl': 0.16; 'received:poczta.interia.pl': 0.16; 'received:smtpo.poczta.interia.pl': 0.16; 'tls': 0.16; 'url:gz': 0.16; 'url:tar': 0.16; 'subject:python': 0.16; 'url:)': 0.16; 'trying': 0.19; "python's": 0.19; 'import': 0.22; 'install': 0.23; 'load': 0.23; '2.x': 0.24; 'finally,': 0.24; 'ssl': 0.24; "i've": 0.25; 'skip:" 40': 0.26; 'switch': 0.26; 'post': 0.26; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'idea': 0.28; 'skip:p 30': 0.29; "i'm": 0.30; 'requests': 0.31; 'too.': 0.31; 'disable': 0.31; 'writes:': 0.31; 'yesterday': 0.31; 'file': 0.32; "we're": 0.32; 'run': 0.32; 'url:python': 0.33; 'running': 0.33; 'skip:_ 10': 0.34; 'could': 0.34; 'skip:s 30': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'described': 0.36; 'module.': 0.36; 'options:': 0.36; 'done': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'two': 0.37; 'list': 0.37; 'starting': 0.37; 'christian': 0.38; 'branch': 0.38; 'to:addr :python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'according': 0.40; 'skip:u 10': 0.60; 'received:217': 0.63; 'header:Message-Id:1': 0.63; 'skip:n 10': 0.64; 'prompt': 0.68; 'received:pl': 0.69; 'url:a': 0.72; 'verification': 0.83; 'partial': 0.84; 'url:cpython': 0.84; 'officially': 0.91; 'url:latest': 0.91 Date: Wed, 01 Oct 2014 11:27:47 +0200 From: Reddy Subject: Re: SNI support in python 2.7 for Locust load tests To: python-list@python.org X-Mailer: interia.pl/pf09 In-Reply-To: <87tx3opc45.fsf@handshake.de> References: <87tx3opc45.fsf@handshake.de> X-Originating-IP: 192.100.124.156 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1412155668; bh=YtJnsr4fSer+H4/OQlJW0yaeuLdHrx11yszLWe2CIbI=; h=Date:From:Subject:To:X-Mailer:In-Reply-To:References: X-Originating-IP:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding; b=TqXan6aaIXqp6BwI2Vfv+TX4zJD6XvvuDRGrpy5lD+jE8L/EVNF5wz2/1eL5UcQoZ D4TvEYh/lOTlmPEIA784HsvskXuJcYdwiAT402o9UC7e9u9ExGqVA8pQ65axg191Oz EpwPlZPLeNp+nWb0WkFhXMt+BEz1Xum7n+1M6u/o= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412155669 news.xs4all.nl 2871 [2001:888:2000:d::a6]:36760 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78530 Hi, > Reddy writes: > > ... > > I'm trying to use locust (http://locust.io/) to run load test of one site we're developing. Everything was running nice and smooth until we switch the servers to use SNI. SNI is not officially supported in python 2.7.5 > you have two options: > > Python 2.7.9 implements PEP 466 "Network Security Enhancements for > Python 2.7.x" including TLS 1.1, 1.2 and SNI support. 2.7.9 will be > released shortly. You could try the 2.7 branch from hg.python.org. > > Use PyOpenSSL instead of Python's ssl module. It supports SNI, too. > A recent post in this list regarding missing SNI support in Python 2.x > got as a suggestion to use the "backports.ssl" package on PyPI. Thanks Christian and Dieter for your prompt responses! I tried yesterday with Python built from https://hg.python.org/cpython/archive/9b4673d7b046.tar.gz. I also do use pyOpenSSL as described at http://stackoverflow.com/a/19477363 so I used pip to install pyOpenSSL, ndg-httpsclient and pyasn1 as well as patched locust startup file with the following: from urllib3.contrib import pyopenssl pyopenssl.inject_into_urllib3() I also tried adding the following: from functools import partial ssl.wrap_socket = partial(ssl.wrap_socket, ssl_version=ssl.PROTOCOL_TLSv1) Finally, I've just tried with: /usr/local/bin/pip2.7 install backports.ssl and patching the lucust file with: import backports.ssl as ssl import backports.ssl.monkey as monkey import requests monkey.patch() I've also added verify=False to my locust test scripts to disable certificate verification according to http://docs.locust.io/en/latest/api.html ...And I still get exactly the same error: [2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: File "build/bdist.linux-x86_64/egg/OpenSSL/SSL.py", line 977, in sendall [2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: File "build/bdist.linux-x86_64/egg/OpenSSL/SSL.py", line 849, in _raise_ssl_error [2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: OpenSSL.SSL [2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: . [2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: WantWriteError Now I'm starting to think it's something else than SNI, but all those scripts were working nice before and the only change done was turning on the SNI on tested servers... Any idea what my actually cause this WantWriteError?