4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
5 # |
5 # |
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 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer |
9 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback |
10 from mercurial import ui, hg, util, templater |
10 from mercurial import ui, hg, util, templater |
11 from hgweb_mod import hgweb |
11 from hgweb_mod import hgweb |
12 from hgwebdir_mod import hgwebdir |
12 from hgwebdir_mod import hgwebdir |
13 from request import wsgiapplication |
13 from request import wsgiapplication |
14 from mercurial.i18n import gettext as _ |
14 from mercurial.i18n import gettext as _ |
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): |