Dolda2000 GitWeb
/
wrw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
b0f95b2
)
Merge branch 'master' into python3
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 11 Jan 2014 04:46:51 +0000
(
05:46
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 11 Jan 2014 04:46:51 +0000
(
05:46
+0100)
wrw/dispatch.py
patch
|
blob
|
blame
|
history
diff --git
a/wrw/dispatch.py
b/wrw/dispatch.py
index
2ece093
..
7f1066a
100644
(file)
--- a/
wrw/dispatch.py
+++ b/
wrw/dispatch.py
@@
-55,3
+55,15
@@
def handleenv(env, startreq, handler):
return proto.simpleerror(env, startreq, 400, "Bad Request", "Request must include Host header.")
r = req.origrequest(env)
return handle(r, startreq, handler)
+
+def exterror(env, startreq):
+ def handler(req):
+ import resp
+ code = 404
+ if "Response-Code" in req.ihead:
+ try:
+ code = int(req.ihead["Response-Code"])
+ except ValueError:
+ pass
+ raise resp.httperror(code)
+ return handleenv(env, startreq, handler)