Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.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.060 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'ideally': 0.04; 'intermittent': 0.16; 'received:195.158': 0.16; 'suggestion.': 0.16; 'exception': 0.16; 'server,': 0.19; '>>>': 0.22; 'reset': 0.22; 'header:User-Agent:1': 0.23; 'body,': 0.24; 'from:addr:chris': 0.24; 'skip:" 30': 0.26; 'subject:/': 0.26; 'raise': 0.29; '(like': 0.30; 'usually': 0.31; '"",': 0.31; 'raised': 0.31; 'file': 0.32; 'skip:c 30': 0.32; 'another': 0.32; '(most': 0.33; 'skip:_ 10': 0.34; 'connection': 0.35; 'idle': 0.36; 'charset:us-ascii': 0.36; 'possible': 0.36; 'version,': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'entire': 0.61; 'content- disposition:inline': 0.62; 'getresponse': 0.84; 'subject:skip:H 10': 0.84; 'state.': 0.95 Date: Mon, 26 Aug 2013 11:45:38 +0200 From: Chris Down To: python-list@python.org Subject: Resetting state of http.client/httplib HTTPSConnection objects MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dCSxeJc5W8HZXZrD" Content-Disposition: inline PGP-Key: http://chrisdown.name/pgp User-Agent: Mutt/1.5.21 (2010-09-15) 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: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377510344 news.xs4all.nl 15942 [2001:888:2000:d::a6]:47877 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52998 --dCSxeJc5W8HZXZrD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is a crosspost from python-tutor upon suggestion. I am experiencing intermittent issues where an exception will be raised when calling getresponse(), which makes the entire connection stuck in Request-sent state. Is it possible to reset to idle state somehow without reinstantiating the HTTPSConnection? I ideally want to keep the connection to the server, and just reset the state to idle so that I can make another request (like you would usually do by calling getresponse()). >>> a.conn >>> a.conn.getresponse() Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.3/http/client.py", line 1143, in getresponse response.begin() File "/usr/lib64/python3.3/http/client.py", line 354, in begin version, status, reason = self._read_status() File "/usr/lib64/python3.3/http/client.py", line 324, in _read_status raise BadStatusLine(line) http.client.BadStatusLine: '' >>> a.conn.request("GET", "foo") Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.3/http/client.py", line 1061, in request self._send_request(method, url, body, headers) File "/usr/lib64/python3.3/http/client.py", line 1089, in _send_request self.putrequest(method, url, **skips) File "/usr/lib64/python3.3/http/client.py", line 944, in putrequest raise CannotSendRequest(self.__state) http.client.CannotSendRequest: Request-sent --dCSxeJc5W8HZXZrD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (GNU/Linux) iQEcBAEBAgAGBQJSGyPCAAoJEK7pd0+nzJtNrY4H/0U1lVOupse+F7mWUUhcz9Dk xBJ2XdxRUlVQK71872ulJWSDY84wAC+/xGj5Z6hXCbG/r/3H1RFIMmkLEmvkD9th cFzle8OsLHeQLMb0gOFsd3ydFuMoGshtmFqzBdLtQF9KCP1V/F0EehKZ2c2y1NON wQr8gsrkPK7HnYR+2wOTCnxObGgBglA5Lz0Rl1V+7e4Fbdn2sScsBFUdOWdBIrjI 6sqOQ76+AIMdDrGJuHchR/d3Qx02hvLk1txFukVFaZg9ZxgvZYAL23RuaBBFumvt wvSsi1mgw+XpfzdRk8nW9bPY/iMMIKT/WR9CmXqgDM6lQ3iuceSuhprisn/4E/A= =19JN -----END PGP SIGNATURE----- --dCSxeJc5W8HZXZrD--