Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/hgweb_mod.py @ 36904:d0b0fedbfb53
hgweb: change how dispatch path is reported
When I implemented the new request object, I carried forward some
ugly hacks until I could figure out what was happening. One of those
was the handling of PATH_INFO to determine how to route hgweb
requests.
Essentially, if we have PATH_INFO data, we route according to
that. But if we don't, we route by the query string. I question
if we still need to support query string routing. But that's for
another day, I suppose.
In this commit, we clean up the ugly "havepathinfo" hack and
replace it with a "dispatchpath" attribute that can hold None or
empty string to differentiate between the presence of PATH_INFO.
This is still a bit hacky. But at least the request parsing
and routing code is explicit about the meaning now.
Differential Revision: https://phab.mercurial-scm.org/D2820
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 11 Mar 2018 13:38:56 -0700 |
parents | 4daa22071d5d |
children | 84110a1d0f7d |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Mar 11 13:11:13 2018 -0700 +++ b/mercurial/hgweb/hgweb_mod.py Sun Mar 11 13:38:56 2018 -0700 @@ -324,7 +324,11 @@ if handled: return res.sendresponse() - if req.havepathinfo: + # Old implementations of hgweb supported dispatching the request via + # the initial query string parameter instead of using PATH_INFO. + # If PATH_INFO is present (signaled by ``req.dispatchpath`` having + # a value), we use it. Otherwise fall back to the query string. + if req.dispatchpath is not None: query = req.dispatchpath else: query = req.querystring.partition('&')[0].partition(';')[0]