import sys, traceback
-import env
+import env, req, proto
__all__ = ["restart"]
return resp
finally:
req.cleanup()
+
+def handleenv(env, startreq, handler):
+ if not "HTTP_HOST" in env:
+ return proto.simpleerror(env, startreq, 400, "Bad Request", "Request must include Host header.")
+ r = req.origrequest(env)
+ return handle(r, startreq, handler)
def wsgiwrap(callable):
def wrapper(env, startreq):
- return dispatch.handle(req.origrequest(env), startreq, callable)
+ return dispatch.handleenv(env, startreq, callable)
return wrapper
def formparams(callable):