mercurial/hgweb/server.py
changeset 4015 769be3c57564
parent 3836 925b1816c746
child 4016 a195f11ed1a2
child 4079 40c9710e8182
equal deleted inserted replaced
4014:509342f95564 4015:769be3c57564
     6 # This software may be used and distributed according to the terms
     6 # This software may be used and distributed according to the terms
     7 # of the GNU General Public License, incorporated herein by reference.
     7 # of the GNU General Public License, incorporated herein by reference.
     8 
     8 
     9 from mercurial.demandload import demandload
     9 from mercurial.demandload import demandload
    10 import os, sys, errno
    10 import os, sys, errno
    11 demandload(globals(), "urllib BaseHTTPServer socket SocketServer")
    11 demandload(globals(), "urllib BaseHTTPServer socket SocketServer traceback")
    12 demandload(globals(), "mercurial:ui,hg,util,templater")
    12 demandload(globals(), "mercurial:ui,hg,util,templater")
    13 demandload(globals(), "hgweb_mod:hgweb hgwebdir_mod:hgwebdir request:wsgiapplication")
    13 demandload(globals(), "hgweb_mod:hgweb hgwebdir_mod:hgwebdir request:wsgiapplication")
    14 from mercurial.i18n import gettext as _
    14 from mercurial.i18n import gettext as _
    15 
    15 
    16 def _splitURI(uri):
    16 def _splitURI(uri):
    53                                               self.log_date_time_string(),
    53                                               self.log_date_time_string(),
    54                                               format % args))
    54                                               format % args))
    55 
    55 
    56     def do_POST(self):
    56     def do_POST(self):
    57         try:
    57         try:
    58             self.do_hgweb()
    58             try:
    59         except socket.error, inst:
    59                 self.do_hgweb()
    60             if inst[0] != errno.EPIPE:
    60             except socket.error, inst:
    61                 raise
    61                 if inst[0] != errno.EPIPE:
       
    62                     raise
       
    63         except StandardError, inst:
       
    64             self._start_response("500 Internal Server Error", [])
       
    65             self._write("Internal Server Error")
       
    66             tb = "".join(traceback.format_exception(*sys.exc_info()))
       
    67             self.log_error("Exception happened during processing request '%s':\n%s",
       
    68                            self.path, tb)
    62 
    69 
    63     def do_GET(self):
    70     def do_GET(self):
    64         self.do_POST()
    71         self.do_POST()
    65 
    72 
    66     def do_hgweb(self):
    73     def do_hgweb(self):