def handle(self, sock, read_data, path, headers):
assert self.type is not None<EOL>try:<EOL><INDENT>try:<EOL><INDENT>fh = open(os.path.join(self.balancer.static_dir, "<STR_LIT>" % self.type))<EOL><DEDENT>except IOError:<EOL><INDENT>fh = open(os.path.join(os.path.dirname(__file__), "<STR_LIT>", "<STR_LIT>" % self.type))<EOL><DEDENT>try:<EOL><INDENT>self._sendfile(sock.fileno(), fh.fileno(), <NUM_LIT:0>, os.fstat(fh.fileno()).st_size)<EOL><DEDENT>except (TypeError, AttributeError):<EOL><INDENT>sock.sendall(fh.read())<EOL><DEDENT>fh.close()<EOL>sock.close()<EOL><DEDENT>except socket.error as e:<EOL><INDENT>if e.errno != errno.EPIPE:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>
Sends back a static error page.