X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fproto.py;h=8c8dcee1b0d54d398fa681d56f9bb12ab1d0f3a5;hb=3985f4bbbfd3740d955ec766fb5fb912efcb0d59;hp=8474b3a16e533b2d1cf702d1f7e5ab40eb07a1e7;hpb=31d48e693453899e96b19ce14acab633d26fcf0b;p=wrw.git diff --git a/wrw/proto.py b/wrw/proto.py index 8474b3a..8c8dcee 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -85,10 +85,27 @@ def htmlq(html): ret += c return ret +def simpleerror(env, startreq, code, title, msg): + buf = """ + + + +%s + + +

%s

+

%s

+ + +""" % (title, title, htmlq(msg)) + startreq("%i %s" % (code, title), [("Content-Type", "text/html"), ("Content-Length", str(len(buf)))]) + return [buf] + def urlq(url): ret = "" + invalid = "&=#?/\"'" for c in url: - if c == "&" or c == "=" or c == "#" or c == "?" or c == "/" or (ord(c) <= 32): + if c in invalid or (ord(c) <= 32): ret += "%%%02X" % ord(c) else: ret += c