Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 2488

Show
Ignore:
Timestamp:
08/04/09 19:23:34
Author:
fumanchu
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cherrypy-3.0.x/cherrypy/test/test_conn.py

    r1565 r2488  
    332332        self.assertEqual(status, 100) 
    333333        while True: 
    334             skip = response.fp.readline().strip() 
    335             if not skip: 
     334            line = response.fp.readline().strip() 
     335            if line: 
     336                self.fail("100 Continue should not output any headers. Got %r" % line) 
     337            else: 
    336338                break 
    337339         
  • branches/cherrypy-3.0.x/cherrypy/wsgiserver/__init__.py

    r2250 r2488  
    294294        # but it seems like it would be a big slowdown for such a rare case. 
    295295        if environ.get("HTTP_EXPECT", "") == "100-continue": 
    296             self.simple_response(100) 
     296            # Don't use simple_response here, because it emits headers 
     297            # we don't want. See http://www.cherrypy.org/ticket/951 
     298            msg = "%s 100 Continue\r\n\r\n" % self.environ['ACTUAL_SERVER_PROTOCOL'] 
     299            try: 
     300                self.sendall(msg) 
     301            except socket.error, x: 
     302                if x.args[0] not in socket_errors_to_ignore: 
     303                    raise 
    297304         
    298305        self.ready = True 
  • branches/cherrypy-3.1.x/cherrypy/test/test_conn.py

    r2483 r2488  
    429429        self.assertEqual(status, 100) 
    430430        while True: 
    431             skip = response.fp.readline().strip() 
    432             if not skip: 
     431            line = response.fp.readline().strip() 
     432            if line: 
     433                self.fail("100 Continue should not output any headers. Got %r" % line) 
     434            else: 
    433435                break 
    434436         
  • branches/cherrypy-3.1.x/cherrypy/wsgiserver/__init__.py

    r2483 r2488  
    472472        # but it seems like it would be a big slowdown for such a rare case. 
    473473        if environ.get("HTTP_EXPECT", "") == "100-continue": 
    474             self.simple_response(100) 
     474            # Don't use simple_response here, because it emits headers 
     475            # we don't want. See http://www.cherrypy.org/ticket/951 
     476            msg = "%s 100 Continue\r\n\r\n" % self.environ['ACTUAL_SERVER_PROTOCOL'] 
     477            try: 
     478                self.wfile.sendall(msg) 
     479            except socket.error, x: 
     480                if x.args[0] not in socket_errors_to_ignore: 
     481                    raise 
    475482         
    476483        self.ready = True 
  • trunk/cherrypy/test/test_conn.py

    r2437 r2488  
    457457        self.assertEqual(status, 100) 
    458458        while True: 
    459             skip = response.fp.readline().strip() 
    460             if not skip: 
     459            line = response.fp.readline().strip() 
     460            if line: 
     461                self.fail("100 Continue should not output any headers. Got %r" % line) 
     462            else: 
    461463                break 
    462464         
  • trunk/cherrypy/wsgiserver/__init__.py

    r2485 r2488  
    457457        # but it seems like it would be a big slowdown for such a rare case. 
    458458        if environ.get("HTTP_EXPECT", "") == "100-continue": 
    459             self.simple_response(100) 
     459            # Don't use simple_response here, because it emits headers 
     460            # we don't want. See http://www.cherrypy.org/ticket/951 
     461            msg = "%s 100 Continue\r\n\r\n" % self.environ['ACTUAL_SERVER_PROTOCOL'] 
     462            try: 
     463                self.wfile.sendall(msg) 
     464            except socket.error, x: 
     465                if x.args[0] not in socket_errors_to_ignore: 
     466                    raise 
    460467         
    461468        self.ready = True 

Hosted by WebFaction

Log in as guest/cpguest to create tickets