Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerHttpProtocol: automate Response object creation #5

Closed
telendt opened this issue Dec 1, 2013 · 1 comment
Closed

ServerHttpProtocol: automate Response object creation #5

telendt opened this issue Dec 1, 2013 · 1 comment
Labels

Comments

@telendt
Copy link

telendt commented Dec 1, 2013

In the current design of ServerHttpProtocol user needs to create Response object himself in handle_request and set up a lot of stuff himself - like setting closing = True if message.version == (1, 0), remember to call write_eof() after calling send_headers() if the message.method == 'HEAD', setting keep_alive on ServerHttpProtocol instance if responsonse.keep_alive() returns True, and so on... These are really tedious tasks that could be solved by ServerHttpProtocol implementation.

My suggestion is to make handle_request method abstract, and pass a specially prepared response object via additional argument when calling it. When request handler coroutine terminates the response object could be inspected (to set keep-alive). AFAIK NodeJS solves it in a similar way.

I'd like to help you with some code, but I'm still quite fresh to asyncio (I think I still don't fully get the differences between transport and protocol).

Best regards,
Tomasz

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants