##// END OF EJS Templates
hgweb: use url.url when setting CGI environment variables
Brodie Rao -
r13821:a35aff48 default
parent child Browse files
Show More
@@ -6,10 +6,10 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 import os, re, time, urlparse
9 import os, re, time
10 10 from mercurial.i18n import _
11 11 from mercurial import ui, hg, util, templater
12 from mercurial import error, encoding
12 from mercurial import error, encoding, url
13 13 from common import ErrorResponse, get_mtime, staticfile, paritygen, \
14 14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
15 15 from hgweb_mod import hgweb
@@ -361,17 +361,9 b' class hgwebdir(object):'
361 361 return tmpl
362 362
363 363 def updatereqenv(self, env):
364 def splitnetloc(netloc):
365 if ':' in netloc:
366 return netloc.split(':', 1)
367 else:
368 return (netloc, None)
369
370 364 if self._baseurl is not None:
371 urlcomp = urlparse.urlparse(self._baseurl)
372 host, port = splitnetloc(urlcomp[1])
373 path = urlcomp[2]
374 env['SERVER_NAME'] = host
375 if port:
376 env['SERVER_PORT'] = port
377 env['SCRIPT_NAME'] = path
365 u = url.url(self._baseurl)
366 env['SERVER_NAME'] = u.host
367 if u.port:
368 env['SERVER_PORT'] = u.port
369 env['SCRIPT_NAME'] = '/' + u.path
General Comments 0
You need to be logged in to leave comments. Login now