You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
In the current design of
ServerHttpProtocol
user needs to createResponse
object himself inhandle_request
and set up a lot of stuff himself - like settingclosing = True
ifmessage.version == (1, 0)
, remember to callwrite_eof()
after callingsend_headers()
if themessage.method == 'HEAD'
, settingkeep_alive
onServerHttpProtocol
instance ifresponsonse.keep_alive()
returnsTrue
, and so on... These are really tedious tasks that could be solved byServerHttpProtocol
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
The text was updated successfully, but these errors were encountered: