T. Muddletin
x at Vex.Net
Mon Nov 19 22:17:40 EST 2001
I found that some http clients (Opera on windows, specifically in my tests) use multi-line headers in some mime-parts... the same way email clients do (with whitespace leading the continued lines). mod_python's util.py appears to not support this. Here's my quick patch to hack around the problem for me, if anyone else is using multipart/form-data forms. Or maybe someone has a better hack... *** util.org.py Fri Nov 16 19:42:00 2001 --- util.py Mon Nov 19 01:18:30 2001 *************** *** 160,166 **** --- 160,173 ---- disp, disp_options = None, {} headers = apache.make_table() line = _req.readline() + lines = [] while line and line not in ["\n", "\r\n"]: + if line[0] not in string.whitespace: + lines.append(line) + else: + lines[-1] = lines[-1] + line + line = _req.readline() + for line in lines: h, v = string.split(line, ":", 1) headers.add(h, v) h = string.lower(h) *************** *** 168,174 **** disp, disp_options = parse_header(v) elif h == "content-type": ctype, type_options = parse_header(v) - line = _req.readline() if disp_options.has_key("name"): name = disp_options["name"] --- 175,180 ---- -- Tim Middleton | Cain Gang Ltd | There are a thousand hacking at the branches x at veX.net | www.Vex.Net | of evil [but who] at the root. --Thoreau (W)
|