diff options
Diffstat (limited to 'paste/__init__.py')
-rw-r--r-- | paste/__init__.py | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/paste/__init__.py b/paste/__init__.py index f22b5d7..3ee4468 100644 --- a/paste/__init__.py +++ b/paste/__init__.py @@ -54,25 +54,6 @@ def simple_response( return [body] -def redirect(start_response: StartResponse, location: bytes, typ: str) -> Response: - status = { - "text/x.redirect.301": "301 Moved Permanently", - "text/x.redirect.302": "302 Found", - }.get(typ) - if not status: - return simple_response(start_response, "500 Internal Server Error") - body = location - start_response( - status, - [ - ("Location", location.decode()), - ("Content-Type", "text/plain"), - ("Content-Length", str(len(body))), - ], - ) - return [body] - - ProtoMiddleware = Callable[[App, Env, StartResponse], Response] Middleware = Callable[[App], App] @@ -222,8 +203,6 @@ def application(environ: Env, start_response: StartResponse) -> Response: if not row: return simple_response(start_response, "404 Not Found") content_type, content_hash, content = row - if content_type.startswith("text/x.redirect"): - return redirect(start_response, content, content_type) start_response( "200 OK", [ @@ -237,9 +216,7 @@ def application(environ: Env, start_response: StartResponse) -> Response: row = store.head(conn, name) if not row: return simple_response(start_response, "404 Not Found") - content_type, content_hash, content_length, opt_content = row - if content_type.startswith("text/x.redirect"): - return redirect(start_response, opt_content, content_type) + content_type, content_hash, content_length = row start_response( "200 OK", [ |