diff options
| author | Julien Kasarherou <julien@openio.io> | 2018-09-08 09:54:46 +0900 |
|---|---|---|
| committer | Julien Kasarherou <julien@openio.io> | 2018-09-09 02:57:37 +0900 |
| commit | a2bede696493ab29d18bd8a85d42e89d302e7558 (patch) | |
| tree | add8c6b9f6c790c396d325d7388d0504e7203c9d /tests | |
| parent | 4fd014761cde870a755472793bfe0b7aa8f73f26 (diff) | |
| download | eventlet-a2bede696493ab29d18bd8a85d42e89d302e7558.tar.gz | |
wsgi: make Expect 100-continue field-value case-insensitive.
See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.20
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/wsgi_test.py | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/tests/wsgi_test.py b/tests/wsgi_test.py index 93996f0..b135ffe 100644 --- a/tests/wsgi_test.py +++ b/tests/wsgi_test.py @@ -748,27 +748,29 @@ class TestHttpd(_TestBase): result = read_http(sock) self.assertEqual(result.status, 'HTTP/1.1 417 Expectation Failed') self.assertEqual(result.body, b'failure') - fd.write( - b'PUT / HTTP/1.1\r\nHost: localhost\r\nContent-length: 7\r\n' - b'Expect: 100-continue\r\n\r\ntesting') - fd.flush() - header_lines = [] - while True: - line = fd.readline() - if line == b'\r\n': - break - else: - header_lines.append(line) - assert header_lines[0].startswith(b'HTTP/1.1 100 Continue') - header_lines = [] - while True: - line = fd.readline() - if line == b'\r\n': - break - else: - header_lines.append(line) - assert header_lines[0].startswith(b'HTTP/1.1 200 OK') - assert fd.read(7) == b'testing' + + for expect_value in ('100-continue', '100-Continue'): + fd.write( + 'PUT / HTTP/1.1\r\nHost: localhost\r\nContent-length: 7\r\n' + 'Expect: {}\r\n\r\ntesting'.format(expect_value).encode()) + fd.flush() + header_lines = [] + while True: + line = fd.readline() + if line == b'\r\n': + break + else: + header_lines.append(line) + assert header_lines[0].startswith(b'HTTP/1.1 100 Continue') + header_lines = [] + while True: + line = fd.readline() + if line == b'\r\n': + break + else: + header_lines.append(line) + assert header_lines[0].startswith(b'HTTP/1.1 200 OK') + assert fd.read(7) == b'testing' fd.close() sock.close() |
