diff options
| author | Maximilian Hils <git@maximilianhils.com> | 2016-05-18 18:46:42 -0700 | 
|---|---|---|
| committer | Maximilian Hils <git@maximilianhils.com> | 2016-05-18 18:46:42 -0700 | 
| commit | 44ac64aa7235362acbb96e0f12aa27534580e575 (patch) | |
| tree | c03b8c3519c273a4f42b60cb2bce8cc0dd524925 /netlib/http/http1 | |
| parent | 4c3fb8f5097fad2c5de96104dae3f8026b0b4666 (diff) | |
| download | mitmproxy-44ac64aa7235362acbb96e0f12aa27534580e575.tar.gz mitmproxy-44ac64aa7235362acbb96e0f12aa27534580e575.tar.bz2 mitmproxy-44ac64aa7235362acbb96e0f12aa27534580e575.zip | |
add MultiDict
This commit introduces MultiDict, a multi-dictionary similar to
ODict, but with improved semantics (as in the Headers class).
MultiDict fixes a few issues that were present in the Request/Response
API. In particular, `request.cookies["foo"] = "bar"` has previously been a
no-op, as the cookies property returned a mutable _copy_ of the cookies.
Diffstat (limited to 'netlib/http/http1')
| -rw-r--r-- | netlib/http/http1/read.py | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/netlib/http/http1/read.py b/netlib/http/http1/read.py index 6e3a1b93..d30976bd 100644 --- a/netlib/http/http1/read.py +++ b/netlib/http/http1/read.py @@ -316,14 +316,14 @@ def _read_headers(rfile):              if not ret:                  raise HttpSyntaxException("Invalid headers")              # continued header -            ret[-1][1] = ret[-1][1] + b'\r\n ' + line.strip() +            ret[-1] = (ret[-1][0], ret[-1][1] + b'\r\n ' + line.strip())          else:              try:                  name, value = line.split(b":", 1)                  value = value.strip()                  if not name:                      raise ValueError() -                ret.append([name, value]) +                ret.append((name, value))              except ValueError:                  raise HttpSyntaxException("Invalid headers")      return Headers(ret) | 
