File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ the ``Host`` header to figure out the subdomain one simply looks at the
146
146
request path up to the first slash::
147
147
148
148
from threading import Lock
149
- from werkzeug.wsgi import pop_path_info, peek_path_info
149
+ from wsgiref.util import shift_path_info
150
150
151
151
class PathDispatcher:
152
152
@@ -166,13 +166,20 @@ request path up to the first slash::
166
166
return app
167
167
168
168
def __call__(self, environ, start_response):
169
- app = self.get_application(peek_path_info (environ))
169
+ app = self.get_application(self._peek_path_info (environ))
170
170
if app is not None:
171
- pop_path_info (environ)
171
+ shift_path_info (environ)
172
172
else:
173
173
app = self.default_app
174
174
return app(environ, start_response)
175
175
176
+ def _peek_path_info(environ):
177
+ segments = environ.get("PATH_INFO", "").lstrip("/").split("/", 1)
178
+ if segments:
179
+ return segments[0]
180
+
181
+ return None
182
+
176
183
The big difference between this and the subdomain one is that this one
177
184
falls back to another application if the creator function returns ``None ``::
178
185
You can’t perform that action at this time.
0 commit comments