</body>
</html>
""" % (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