This commit is contained in:
Jack Robison 2018-08-01 20:58:21 -04:00
parent 2b2d3e0eb1
commit 293a57156a
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -1,3 +1,4 @@
import logging
from twisted.web.client import HTTPConnectionPool, _HTTP11ClientFactory
from twisted.web._newclient import HTTPClientParser, BadResponseVersion, HTTP11ClientProtocol, RequestNotSent
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
log = logging.getLogger()
class DirtyHTTPParser(HTTPClientParser):
def parseVersion(self, strversion):
"""
@ -18,6 +22,7 @@ class DirtyHTTPParser(HTTPClientParser):
major, minor = strnumber.split(b'.')
major, minor = int(major), int(minor)
except ValueError as e:
log.exception("got a bad http version: %s", strversion)
if b'HTTP1.1' in strversion:
return ("HTTP", 1, 1)
raise BadResponseVersion(str(e), strversion)