Issue #201 resolved

Use correct status codes on error

Robert Brewer
created an issue

When a status other than "200 OK" is returned to the client, Internet Explorer will show the user a "Friendly error message" instead of the response body. This behavior can be changed by the client, but nobody ever does. ;)

In an effort to work around this behavior, CP returns 200 even when an error has occurred. As described here (http://archive.apache.org/gnats/5173), it may be possible to correct this behavior, and use more appropriate status codes, by sending a "large enough" body (1392 bytes).

Comments (3)

  1. Robert Brewer reporter

    Looks like for IE 6.0.2800, the magic number is 512; that is, anything 512 bytes or less gets the "friendly error message". Here's the test:

    import cherrypy
    
    class Root:
        def index(self, size, status=500):
            cherrypy.response.status = status
            return "x" * int(size)
        index.exposed = True
    
    cherrypy.root = Root()
    cherrypy.config.update({'server.environment': 'production'})
    cherrypy.server.start()
    

    If people could test this with other versions of IE, it would be nice. But I'll try to write the fix today.

  2. Robert Brewer reporter

    OK, this would be better as a filter. CherryPy already returns correct codes; however, it doesn't solve the IE issue. If you really need to fix this for IE, use the FriendlyErrorFilter.

  3. Log in to comment