X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fdispatch.py;h=fa1f669d8f43099f6c41c3f919689496409cf725;hb=7450e2fcc553f66844b34d5c062a965b8fca28c5;hp=15ea99e8c537e74c77006d7ea052f32ebc5b859a;hpb=784d41f352527072fd9e26488f79e163868619b9;p=wrw.git diff --git a/wrw/dispatch.py b/wrw/dispatch.py index 15ea99e..fa1f669 100644 --- a/wrw/dispatch.py +++ b/wrw/dispatch.py @@ -1,5 +1,5 @@ import sys, traceback -import env +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)