Ticket #4444: django_core_servers_basehttp-fix-broken-pipe.diff
| File django_core_servers_basehttp-fix-broken-pipe.diff, 1.3 kB (added by trbs, 2 years ago) |
|---|
-
a/django/core/servers/basehttp.py
old new 13 13 import re 14 14 import sys 15 15 import urllib 16 import socket 16 17 17 18 from django.utils.http import http_date 18 19 … … 487 488 488 489 def handle_error(self): 489 490 """Log current error, and send error output to client if possible""" 490 self.log_exception(sys.exc_info()) 491 exc_type, exc_value = sys.exc_info()[:2] 492 if issubclass(exc_type, socket.error) and exc_value.args[0]==32: 493 #self.request_handler.log_request(self.status.split(' ',1)[0], "%s %s" % (self.bytes_sent, exc_value.args[1])) 494 format = '\"%s\" %s %s %s' 495 args = ( 496 self.request_handler.requestline, 497 self.status.split(' ',1)[0], 498 self.bytes_sent, 499 exc_value.args[1] 500 ) 501 sys.stderr.write("[%s] %s\n" % (self.request_handler.log_date_time_string(), format % args)) 502 else: 503 self.log_exception(sys.exc_info()) 491 504 if not self.headers_sent: 492 505 self.result = self.error_output(self.environ, self.start_response) 493 506 self.finish_response()
