diff --git a/pywb/apps/frontendapp.py b/pywb/apps/frontendapp.py index c3ece2940..69382df2f 100644 --- a/pywb/apps/frontendapp.py +++ b/pywb/apps/frontendapp.py @@ -404,10 +404,12 @@ def serve_cdx(self, environ, coll='$root'): try: res = requests.get(cdx_url, stream=True) + status_line = '{} {}'.format(res.status_code, res.reason) content_type = res.headers.get('Content-Type') return WbResponse.bin_stream(StreamIter(res.raw), - content_type=content_type) + content_type=content_type, + status=status_line) except Exception as e: return WbResponse.text_response('Error: ' + str(e), status='400 Bad Request') diff --git a/pywb/warcserver/basewarcserver.py b/pywb/warcserver/basewarcserver.py index 0ef5f448e..f1d6b01b2 100644 --- a/pywb/warcserver/basewarcserver.py +++ b/pywb/warcserver/basewarcserver.py @@ -141,6 +141,9 @@ def send_error(self, errs, start_response, out_headers['ResErrors'] = res[0] message = message.encode('utf-8') - message = str(status) + ' ' + message + if isinstance(status, str): + message = status + else: + message = str(status) + ' ' + message start_response(message, list(out_headers.items())) return res