comparison contrib/win32/hgwebdir_wsgi.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
99 win32traceutil.SetupForPrint # silence unused import warning 99 win32traceutil.SetupForPrint # silence unused import warning
100 100
101 import isapi_wsgi 101 import isapi_wsgi
102 from mercurial.hgweb.hgwebdir_mod import hgwebdir 102 from mercurial.hgweb.hgwebdir_mod import hgwebdir
103 103
104
105 # Example tweak: Replace isapi_wsgi's handler to provide better error message 104 # Example tweak: Replace isapi_wsgi's handler to provide better error message
106 # Other stuff could also be done here, like logging errors etc. 105 # Other stuff could also be done here, like logging errors etc.
107 class WsgiHandler(isapi_wsgi.IsapiWsgiHandler): 106 class WsgiHandler(isapi_wsgi.IsapiWsgiHandler):
108 error_status = '500 Internal Server Error' # less silly error message 107 error_status = '500 Internal Server Error' # less silly error message
109 108
113 # Only create the hgwebdir instance once 112 # Only create the hgwebdir instance once
114 application = hgwebdir(hgweb_config) 113 application = hgwebdir(hgweb_config)
115 114
116 115
117 def handler(environ, start_response): 116 def handler(environ, start_response):
117
118 # Translate IIS's weird URLs 118 # Translate IIS's weird URLs
119 url = environ['SCRIPT_NAME'] + environ['PATH_INFO'] 119 url = environ['SCRIPT_NAME'] + environ['PATH_INFO']
120 paths = url[1:].split('/')[path_strip:] 120 paths = url[1:].split('/')[path_strip:]
121 script_name = '/' + '/'.join(paths[:path_prefix]) 121 script_name = '/' + '/'.join(paths[:path_prefix])
122 path_info = '/'.join(paths[path_prefix:]) 122 path_info = '/'.join(paths[path_prefix:])