Skip to content
Browse files

- Fix bug in HTTP Expect/Continue support. See

  #9 .

Closes #9.
  • Loading branch information...
1 parent 47d1ff8 commit 65a9c65ee753631b56950a629a028fc41b30c3c6 @mcdonc mcdonc committed
Showing with 25 additions and 4 deletions.
  1. +4 −0 CHANGES.txt
  2. +1 −1 waitress/channel.py
  3. +20 −3 waitress/tests/test_channel.py
View
4 CHANGES.txt
@@ -19,6 +19,10 @@ Bug Fixes
- Don't complain if there's a response to a HEAD request that contains a
Content-Length > 0. See https://github.com/Pylons/waitress/pull/7.
+- Fix bug in HTTP Expect/Continue support. See
+ https://github.com/Pylons/waitress/issues/9 .
+
+
0.8.2 (2012-11-14)
------------------
View
2 waitress/channel.py
@@ -191,7 +191,7 @@ def received(self, data):
# there's no current task, so we don't need to try to
# lock the outbuf to append to it.
self.outbufs[-1].append(b'HTTP/1.1 100 Continue\r\n\r\n')
- self.sent_expect_continue = True
+ self.sent_continue = True
self._flush_some()
request.completed = False
if request.completed:
View
23 waitress/tests/test_channel.py
@@ -357,7 +357,7 @@ def test_received_preq_completed_n_lt_data(self):
self.assertEqual(len(inst.requests), 2)
self.assertEqual(len(inst.server.tasks), 1)
- def test_received_headers_finished_not_expect_continue(self):
+ def test_received_headers_finished_expect_continue_false(self):
inst, sock, map = self._makeOneWithMap()
inst.server = DummyServer()
preq = DummyParser()
@@ -372,7 +372,7 @@ def test_received_headers_finished_not_expect_continue(self):
self.assertEqual(inst.server.tasks, [])
self.assertEqual(inst.outbufs[0].get(100), b'')
- def test_received_headers_finished_expect_continue(self):
+ def test_received_headers_finished_expect_continue_true(self):
inst, sock, map = self._makeOneWithMap()
inst.server = DummyServer()
preq = DummyParser()
@@ -385,7 +385,24 @@ def test_received_headers_finished_expect_continue(self):
self.assertEqual(inst.request, preq)
self.assertEqual(inst.server.tasks, [])
self.assertEqual(sock.sent, b'HTTP/1.1 100 Continue\r\n\r\n')
- self.assertEqual(inst.sent_expect_continue, True)
+ self.assertEqual(inst.sent_continue, True)
+ self.assertEqual(preq.completed, False)
+
+ def test_received_headers_finished_expect_continue_true_sent_true(self):
+ inst, sock, map = self._makeOneWithMap()
+ inst.server = DummyServer()
+ preq = DummyParser()
+ inst.request = preq
+ preq.expect_continue = True
+ preq.headers_finished = True
+ preq.completed = False
+ preq.empty = False
+ inst.sent_continue = True
+ inst.received(b'GET / HTTP/1.1\n\n')
+ self.assertEqual(inst.request, preq)
+ self.assertEqual(inst.server.tasks, [])
+ self.assertEqual(sock.sent, b'')
+ self.assertEqual(inst.sent_continue, True)
self.assertEqual(preq.completed, False)
def test_service_no_requests(self):

0 comments on commit 65a9c65

Please sign in to comment.
Something went wrong with that request. Please try again.