X-Git-Url: http://dolda2000.com/gitweb/?p=wrw.git;a=blobdiff_plain;f=wrw%2Fdispatch.py;h=10cc2f6ef8014d451e330ebdf9119eee00bf3627;hp=e51559e1fbe4b477a847af6bc1ea985a588393f2;hb=10ba659d32518d2d09b12ada86a380798b378fe7;hpb=5d0ae1011cdaf805d3d4b7cefb204f70dfd03689 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)