X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fproto.py;h=96a88781ba5e7eda8267ae100ad17fc41e5e65f9;hb=babf3e21cb06bf867e3ec98003d4a077090b8839;hp=4cf19519bb739832d841defe522ae5a49f80ec6a;hpb=10ba659d32518d2d09b12ada86a380798b378fe7;p=wrw.git diff --git a/wrw/proto.py b/wrw/proto.py index 4cf1951..96a8878 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -98,13 +98,15 @@ def simpleerror(env, startreq, code, title, msg): """ % (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