req_err(self._req, reason)
def req_ok(req, resp):
- log_debug(DBG.HTTP_CTRL, 'req_ok ' + str(resp), idof=req)
+ log_debug(DBG.HTTP_CTRL,
+ 'req_ok %d %s %s' % (resp.code, repr(resp.phrase), str(resp)),
+ idof=req)
+ if resp.code != 200:
+ try:
+ phrase = resp.phrase.decode('utf-8')
+ except UnicodeDecodeError:
+ phrase = repr(resp.phrase)
+ req_err(req, "FAILED %d %s" % (resp.code, phrase))
+ return
+
rc = ResponseConsumer(req)
resp.deliverBody(rc)
req_fin(req)