Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/request.py @ 36873:a755fd3b7146
hgweb: expose URL scheme and REMOTE_* attributes
These are consulted by the HTTP wire protocol handler by reading from
the env dict. Let's expose them as attributes instead.
With the wire protocol handler updates to use the new attributes, we
no longer have any consumers of the legacy wsgirequest type in the
wire protocol code (outside of a proxied call to the permissions
checker). So, we remove most references to it.
Differential Revision: https://phab.mercurial-scm.org/D2783
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 14:00:40 -0800 |
parents | cf69df7ea385 |
children | 8ddb5c354906 |
line wrap: on
line diff
--- a/mercurial/hgweb/request.py Sat Mar 10 12:31:11 2018 -0800 +++ b/mercurial/hgweb/request.py Sat Mar 10 14:00:40 2018 -0800 @@ -129,6 +129,12 @@ # of HTTP: Host header for hostname. This is likely what clients used. advertisedurl = attr.ib() advertisedbaseurl = attr.ib() + # URL scheme (part before ``://``). e.g. ``http`` or ``https``. + urlscheme = attr.ib() + # Value of REMOTE_USER, if set, or None. + remoteuser = attr.ib() + # Value of REMOTE_HOST, if set, or None. + remotehost = attr.ib() # WSGI application path. apppath = attr.ib() # List of path parts to be used for dispatch. @@ -270,6 +276,9 @@ url=fullurl, baseurl=baseurl, advertisedurl=advertisedfullurl, advertisedbaseurl=advertisedbaseurl, + urlscheme=env['wsgi.url_scheme'], + remoteuser=env.get('REMOTE_USER'), + remotehost=env.get('REMOTE_HOST'), apppath=apppath, dispatchparts=dispatchparts, dispatchpath=dispatchpath, havepathinfo='PATH_INFO' in env,