Ticket #35440: diff.txt

File diff.txt, 932 bytes (added by Pravin, 9 days ago)
Line 
1diff --git a/django/utils/http.py b/django/utils/http.py
2index 2950f3e695..068fc11e72 100644
3--- a/django/utils/http.py
4+++ b/django/utils/http.py
5@@ -341,6 +341,21 @@ def parse_header_parameters(line, max_length=MAX_HEADER_LENGTH):
6
7 if max_length is not None and len(line) > max_length:
8 raise ValueError("Unable to parse header parameters (value too long).")
9+
10+ if ";" not in line:
11+ return line.lower().strip(), {}
12+
13+ if '"' not in line and "*" not in line and "\\" not in line:
14+ parts = line.split(";")
15+ key = parts[0].lower().strip()
16+ pdict = {}
17+ for p in parts[1:]:
18+ if "=" in p:
19+ name, value = p.split("=", 1)
20+ name = name.strip().lower()
21+ if name:
22+ pdict[name] = value.strip()
23+ return key, pdict
24
25 parts = _parseparam(";" + line)
26 key = parts.__next__().lower()
Back to Top