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

Changeset 2487

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

Fix for #951 (Content-Length breaks curl on 100-Continue) for python3.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/python3/cherrypy/test/test_conn.py

    r2438 r2487  
    456456        self.assertEqual(status, 100) 
    457457        while True: 
    458             skip = response.fp.readline().strip() 
    459             if not skip: 
     458            line = response.fp.readline().strip() 
     459            if line: 
     460                self.fail("100 Continue should not output any headers. Got %r" % line) 
     461            else: 
    460462                break 
    461463         
  • branches/python3/cherrypy/wsgiserver/__init__.py

    r2482 r2487  
    466466        # but it seems like it would be a big slowdown for such a rare case. 
    467467        if environ.get("HTTP_EXPECT", "") == "100-continue": 
    468             self.simple_response(100) 
     468            # Don't use simple_response here, because it emits headers 
     469            # we don't want. See http://www.cherrypy.org/ticket/951 
     470            msg = bytes("%s 100 Continue\r\n\r\n" % 
     471                        self.environ['ACTUAL_SERVER_PROTOCOL'], 
     472                        'ISO-8859-1') 
     473            try: 
     474                self.wfile.write(msg) 
     475            except socket.error as x: 
     476                if x.args[0] not in socket_errors_to_ignore: 
     477                    raise 
    469478         
    470479        self.ready = True 

Hosted by WebFaction

Log in as guest/cpguest to create tickets