code = 505
-class HttpJsonConverter:
+class HttpJsonConverter: # pylint: disable-msg=W0232
CONTENT_TYPE = "application/json"
- def Encode(self, data):
+ @staticmethod
+ def Encode(data):
return serializer.DumpJson(data)
- def Decode(self, data):
+ @staticmethod
+ def Decode(data):
return serializer.LoadJson(data)
if not io_events:
# Timeout
return None
- for (evfd, evcond) in io_events:
+ for (_, evcond) in io_events:
if evcond & check:
return evcond
finally:
if event is None:
raise HttpSocketTimeout()
- if (op == SOCKOP_RECV and
- event & (select.POLLNVAL | select.POLLHUP | select.POLLERR)):
- return ""
+ if event & (select.POLLNVAL | select.POLLHUP | select.POLLERR):
+ # Let the socket functions handle these
+ break
if not event & wait_for_event:
continue
we do on our side.
"""
+ # some parameters are unused, but this is the API
+ # pylint: disable-msg=W0613
assert self._ssl_params, "SSL not initialized"
return (self._ssl_cert.digest("sha1") == cert.digest("sha1") and
# the CRLF."
if idx == 0:
# TODO: Limit number of CRLFs/empty lines for safety?
- buf = buf[:2]
+ buf = buf[2:]
continue
if idx > 0:
if hdr_content_length:
try:
self.content_length = int(hdr_content_length)
- except ValueError:
+ except (TypeError, ValueError):
self.content_length = None
if self.content_length is not None and self.content_length < 0:
self.content_length = None