log it
This commit is contained in:
parent
2b2d3e0eb1
commit
293a57156a
1 changed files with 5 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import logging
|
||||||
from twisted.web.client import HTTPConnectionPool, _HTTP11ClientFactory
|
from twisted.web.client import HTTPConnectionPool, _HTTP11ClientFactory
|
||||||
from twisted.web._newclient import HTTPClientParser, BadResponseVersion, HTTP11ClientProtocol, RequestNotSent
|
from twisted.web._newclient import HTTPClientParser, BadResponseVersion, HTTP11ClientProtocol, RequestNotSent
|
||||||
from twisted.web._newclient import TransportProxyProducer, RequestGenerationFailed
|
from twisted.web._newclient import TransportProxyProducer, RequestGenerationFailed
|
||||||
|
@ -6,6 +7,9 @@ from twisted.internet.defer import Deferred, fail, maybeDeferred
|
||||||
from twisted.internet.defer import CancelledError
|
from twisted.internet.defer import CancelledError
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class DirtyHTTPParser(HTTPClientParser):
|
class DirtyHTTPParser(HTTPClientParser):
|
||||||
def parseVersion(self, strversion):
|
def parseVersion(self, strversion):
|
||||||
"""
|
"""
|
||||||
|
@ -18,6 +22,7 @@ class DirtyHTTPParser(HTTPClientParser):
|
||||||
major, minor = strnumber.split(b'.')
|
major, minor = strnumber.split(b'.')
|
||||||
major, minor = int(major), int(minor)
|
major, minor = int(major), int(minor)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
log.exception("got a bad http version: %s", strversion)
|
||||||
if b'HTTP1.1' in strversion:
|
if b'HTTP1.1' in strversion:
|
||||||
return ("HTTP", 1, 1)
|
return ("HTTP", 1, 1)
|
||||||
raise BadResponseVersion(str(e), strversion)
|
raise BadResponseVersion(str(e), strversion)
|
||||||
|
|
Loading…
Reference in a new issue