Ticket #4444: django_core_servers_basehttp-fix-broken-pipe.2.diff

File django_core_servers_basehttp-fix-broken-pipe.2.diff, 942 bytes (added by trbs, 16 years ago)
  • django/core/servers/basehttp.py

    diff -r f3a3129a0a26 django/core/servers/basehttp.py
    a b  
    1313import re
    1414import sys
    1515import urllib
     16import socket
    1617
    1718from django.utils.http import http_date
    1819
     
    487488
    488489    def handle_error(self):
    489490        """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        else:
     495            self.log_exception(sys.exc_info())
    491496        if not self.headers_sent:
    492497            self.result = self.error_output(self.environ, self.start_response)
    493498            self.finish_response()
Back to Top