diff options
| author | Maximilian Hils <git@maximilianhils.com> | 2015-11-17 11:19:33 +0100 |
|---|---|---|
| committer | Maximilian Hils <git@maximilianhils.com> | 2015-11-17 11:19:33 +0100 |
| commit | 4d17ddba381cf42e2b5ca2c7aade527d11989964 (patch) | |
| tree | 872aff4aefc9cc599cca4915fc65e80817f305f5 | |
| parent | 0df7e27c3b43164dc41f5b37a6e425e8a719c6e9 (diff) | |
| parent | 52c02bc930b380f741b9bb295aa019e22687d5d3 (diff) | |
| download | mitmproxy-4d17ddba381cf42e2b5ca2c7aade527d11989964.tar.gz mitmproxy-4d17ddba381cf42e2b5ca2c7aade527d11989964.tar.bz2 mitmproxy-4d17ddba381cf42e2b5ca2c7aade527d11989964.zip | |
Merge pull request #105 from bltb/master
Allow empty HTTP header value.
| -rw-r--r-- | netlib/http/http1/read.py | 2 | ||||
| -rw-r--r-- | test/http/http1/test_read.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/netlib/http/http1/read.py b/netlib/http/http1/read.py index 0f6de26c..6e3a1b93 100644 --- a/netlib/http/http1/read.py +++ b/netlib/http/http1/read.py @@ -321,7 +321,7 @@ def _read_headers(rfile): try: name, value = line.split(b":", 1) value = value.strip() - if not name or not value: + if not name: raise ValueError() ret.append([name, value]) except ValueError: diff --git a/test/http/http1/test_read.py b/test/http/http1/test_read.py index 45f61b4f..8a315508 100644 --- a/test/http/http1/test_read.py +++ b/test/http/http1/test_read.py @@ -297,6 +297,10 @@ class TestReadHeaders(object): with raises(HttpSyntaxException): self._read(data) + def test_read_empty_value(self): + data = b"bar:" + headers = self._read(data) + assert headers.fields == [[b"bar", b""]] def test_read_chunked(): req = treq(content=None) |
