X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fdispatch.py;h=10cc2f6ef8014d451e330ebdf9119eee00bf3627;hb=10ba659d32518d2d09b12ada86a380798b378fe7;hp=e51559e1fbe4b477a847af6bc1ea985a588393f2;hpb=3e91bb195838a6c561358a44f654f41f46e9c95f;p=wrw.git diff --git a/wrw/dispatch.py b/wrw/dispatch.py index e51559e..10cc2f6 100644 --- a/wrw/dispatch.py +++ b/wrw/dispatch.py @@ -1,5 +1,5 @@ import sys, traceback -from . import env +from . import env, req, proto __all__ = ["restart"] @@ -73,3 +73,9 @@ def handle(req, startreq, handler): 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)