#2819 lib: more portable BadStatusLine checking
Merged a year ago by tkopecek. Opened a year ago by tkopecek.
tkopecek/koji issue2789  into  master

file modified
+3 -7
@@ -2274,17 +2274,13 @@ 

      # these values, this is a connection error.

      if getattr(e, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):

          return True

-     if isinstance(e, six.moves.http_client.BadStatusLine):

+     if 'BadStatusLine' in str(e):

+         # we see errors like this in keep alive timeout races

+         # ConnectionError(ProtocolError('Connection aborted.', BadStatusLine("''",)),)

          return True

      try:

          if isinstance(e, requests.exceptions.ConnectionError):

-             # we see errors like this in keep alive timeout races

-             # ConnectionError(ProtocolError('Connection aborted.', BadStatusLine("''",)),)

              e2 = getattr(e, 'args', [None])[0]

-             if isinstance(e2, requests.packages.urllib3.exceptions.ProtocolError):

-                 e3 = getattr(e2, 'args', [None, None])[1]

-                 if isinstance(e3, six.moves.http_client.BadStatusLine):

-                     return True

              # same check as unwrapped socket error

              if getattr(e2, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):

                  return True

Metadata Update from @tkopecek:
- Pull-request tagged with: no_qe

a year ago

Commit e9cf974 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago
Metadata