Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Bug 709349 - Getting broken pipe running talos in --develop mode #3

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions mozhttpd/mozhttpd/mozhttpd.py
Expand Up @@ -39,7 +39,10 @@

import BaseHTTPServer
import SimpleHTTPServer
import errno
import logging
import threading
import socket
import sys
import os
import urllib
Expand All @@ -48,6 +51,20 @@

class EasyServer(ThreadingMixIn, BaseHTTPServer.HTTPServer):
allow_reuse_address = True
acceptable_errors = (errno.EPIPE, errno.ECONNABORTED)

def handle_error(self, request, client_address):
error = sys.exc_value

if (isinstance(error, socket.error) and \
isinstance(error.args, tuple) and \
error.args[0] in self.acceptable_errors) or \
(isinstance(error, IOError) and \
error.errno in self.acceptable_errors):
pass # remote hang up before the result is sent
else:
logging.error(error)


class MozRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
docroot = os.getcwd() # current working directory at time of import
Expand Down
2 changes: 1 addition & 1 deletion mozhttpd/setup.py
Expand Up @@ -44,7 +44,7 @@
except IOError:
description = None

version = '0.1'
version = '0.2'

deps = []

Expand Down