equal
deleted
inserted
replaced
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
5 # |
5 # |
6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
9 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback |
9 from __future__ import absolute_import |
10 from mercurial import util, error |
10 |
11 from mercurial.hgweb import common |
11 import BaseHTTPServer |
12 from mercurial.i18n import _ |
12 import SocketServer |
|
13 import errno |
|
14 import os |
|
15 import socket |
|
16 import sys |
|
17 import traceback |
|
18 import urllib |
|
19 |
|
20 from ..i18n import _ |
|
21 |
|
22 from .. import ( |
|
23 error, |
|
24 util, |
|
25 ) |
|
26 |
|
27 from . import ( |
|
28 common, |
|
29 ) |
13 |
30 |
14 def _splitURI(uri): |
31 def _splitURI(uri): |
15 """Return path and query that has been split from uri |
32 """Return path and query that has been split from uri |
16 |
33 |
17 Just like CGI environment, the path is unquoted, the query is |
34 Just like CGI environment, the path is unquoted, the query is |
217 self.connection = self.request |
234 self.connection = self.request |
218 self.rfile = socket._fileobject(self.request, "rb", self.rbufsize) |
235 self.rfile = socket._fileobject(self.request, "rb", self.rbufsize) |
219 self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) |
236 self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) |
220 |
237 |
221 try: |
238 try: |
222 from threading import activeCount |
239 import threading |
223 activeCount() # silence pyflakes |
240 threading.activeCount() # silence pyflakes and bypass demandimport |
224 _mixin = SocketServer.ThreadingMixIn |
241 _mixin = SocketServer.ThreadingMixIn |
225 except ImportError: |
242 except ImportError: |
226 if util.safehasattr(os, "fork"): |
243 if util.safehasattr(os, "fork"): |
227 _mixin = SocketServer.ForkingMixIn |
244 _mixin = SocketServer.ForkingMixIn |
228 else: |
245 else: |