self.finish not terminating the http connection #694

Closed
shaileshgupta opened this Issue Mar 11, 2013 · 4 comments

Projects

None yet

3 participants

@shaileshgupta

Upon executing self.write_error(401), the connection is not terminated, but proceeds to next line. This is not the expected behavior. Can anyone confirm.

@ajdavis

The underlying socket is closed by write_error, but the following lines of code are executed anyway. write_error() does not cause the calling method (your code) to terminate. This is expected. You can do things like write log messages, etc., after sending your response to the client.

@bdarnell
tornadoweb member

The underlying socket shouldn't be closed, assuming the client is using HTTP 1.1. The connection will be kept alive for future requests unless the client closes the connection. This is also expected.

@ajdavis

Ah, thanks, didn't notice that in the code.

@bdarnell bdarnell closed this Mar 13, 2013
@shaileshgupta

Thanks. Will try it and revert if any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment