comparison mercurial/hgweb/request.py @ 36902:b2a3308d6a21

tests: add test coverage for parsing WSGI requests A subsequent commit will need to make this code more complicated in order to support alternate base URLs. Let's establish some test coverage before we diverge too far from PEP 3333. As part of this, a minor bug related to a missing SCRIPT_NAME key has been squashed. Differential Revision: https://phab.mercurial-scm.org/D2818
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Mar 2018 12:53:47 -0700
parents ccb70a77f746
children d7fd203e36cc
comparison
equal deleted inserted replaced
36901:a5c478843c82 36902:b2a3308d6a21
220 # has the concept of "virtual" repositories. This is defined via REPO_NAME. 220 # has the concept of "virtual" repositories. This is defined via REPO_NAME.
221 # If REPO_NAME is defined, we append it to SCRIPT_NAME to form a new app 221 # If REPO_NAME is defined, we append it to SCRIPT_NAME to form a new app
222 # root. We also exclude its path components from PATH_INFO when resolving 222 # root. We also exclude its path components from PATH_INFO when resolving
223 # the dispatch path. 223 # the dispatch path.
224 224
225 apppath = env['SCRIPT_NAME'] 225 apppath = env.get('SCRIPT_NAME', '')
226 226
227 if env.get('REPO_NAME'): 227 if env.get('REPO_NAME'):
228 if not apppath.endswith('/'): 228 if not apppath.endswith('/'):
229 apppath += '/' 229 apppath += '/'
230 230