Robert Brewer committed 01eb43f

Fix for #951 (Content-Length breaks curl on 100-Continue) for 3.0, 3.1, 3.2 trunk.

Comments (0)

Files changed (2)


         version, status, reason = response._read_status()
         self.assertEqual(status, 100)
         while True:
-            skip = response.fp.readline().strip()
-            if not skip:
+            line = response.fp.readline().strip()
+            if line:
+      "100 Continue should not output any headers. Got %r" % line)
+            else:
         # ...send the body


         # We used to do 3, but are now doing 1. Maybe we'll do 2 someday,
         # but it seems like it would be a big slowdown for such a rare case.
         if environ.get("HTTP_EXPECT", "") == "100-continue":
-            self.simple_response(100)
+            # Don't use simple_response here, because it emits headers
+            # we don't want. See
+            msg = "%s 100 Continue\r\n\r\n" % self.environ['ACTUAL_SERVER_PROTOCOL']
+            try:
+                self.wfile.sendall(msg)
+            except socket.error, x:
+                if x.args[0] not in socket_errors_to_ignore:
+                    raise
         self.ready = True
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.