Changeset View
Changeset View
Standalone View
Standalone View
mercurial/hgweb/request.py
Show All 11 Lines | |||||
from ..thirdparty import attr | from ..thirdparty import attr | ||||
from .. import ( | from .. import ( | ||||
encoding, | encoding, | ||||
error, | error, | ||||
pycompat, | pycompat, | ||||
util, | util, | ||||
) | ) | ||||
from ..utils import ( | |||||
urlutil, | |||||
) | |||||
class multidict(object): | class multidict(object): | ||||
"""A dict like object that can store multiple values for a key. | """A dict like object that can store multiple values for a key. | ||||
Used to store parsed request parameters. | Used to store parsed request parameters. | ||||
This is inspired by WebOb's class of the same name. | This is inspired by WebOb's class of the same name. | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | def parserequestfromenv(env, reponame=None, altbaseurl=None, bodyfh=None): | ||||
# Some hosting solutions are emulating hgwebdir, and dispatching directly | # Some hosting solutions are emulating hgwebdir, and dispatching directly | ||||
# to an hgweb instance using this environment variable. This was always | # to an hgweb instance using this environment variable. This was always | ||||
# checked prior to d7fd203e36cc; keep doing so to avoid breaking them. | # checked prior to d7fd203e36cc; keep doing so to avoid breaking them. | ||||
if not reponame: | if not reponame: | ||||
reponame = env.get(b'REPO_NAME') | reponame = env.get(b'REPO_NAME') | ||||
if altbaseurl: | if altbaseurl: | ||||
altbaseurl = util.url(altbaseurl) | altbaseurl = urlutil.url(altbaseurl) | ||||
# https://www.python.org/dev/peps/pep-0333/#environ-variables defines | # https://www.python.org/dev/peps/pep-0333/#environ-variables defines | ||||
# the environment variables. | # the environment variables. | ||||
# https://www.python.org/dev/peps/pep-0333/#url-reconstruction defines | # https://www.python.org/dev/peps/pep-0333/#url-reconstruction defines | ||||
# how URLs are reconstructed. | # how URLs are reconstructed. | ||||
fullurl = env[b'wsgi.url_scheme'] + b'://' | fullurl = env[b'wsgi.url_scheme'] + b'://' | ||||
if altbaseurl and altbaseurl.scheme: | if altbaseurl and altbaseurl.scheme: | ||||
▲ Show 20 Lines • Show All 437 Lines • Show Last 20 Lines |