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

%s

+

%s

+ + +""" % (title, title, htmlq(msg)) + buf = buf.encode("us-ascii") + 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