diff --git a/lib/request/connect.py b/lib/request/connect.py index e6b8d5eaa..925611d06 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -371,15 +371,17 @@ class Connect(object): headers[HTTP_HEADER.CONTENT_TYPE] = "%s; boundary=%s" % (headers[HTTP_HEADER.CONTENT_TYPE], boundary) if auxHeaders: - for key, item in auxHeaders.items(): + for key, value in auxHeaders.items(): for _ in headers.keys(): if _.upper() == key.upper(): del headers[_] - headers[key] = item + headers[key] = value - for key, item in headers.items(): + for key, value in headers.items(): del headers[key] - headers[unicodeencode(key, kb.pageEncoding)] = unicodeencode(item, kb.pageEncoding) + headers[unicodeencode(key, kb.pageEncoding)] = unicodeencode(value, kb.pageEncoding) + for char in (r"\r", r"\n"): + value = re.sub(r"(%s)([^ \t])" % char, r"\g<1>\t\g<2>", value) url = unicodeencode(url) post = unicodeencode(post)