Current code doesn't allow to do interesting stuff, because every HTTP request is parsed only from beginning of the connection.
##
<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/650-use-http-keep-alive?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github).
</bountysource-plugin>
<!-- github-sync-id:6176039 -->
I want a module to use long polling for its web needs.
If to use OnWebPreRequest and send Connection: keep-alive myself without closing the socket, browser will see the open socket, and will send through it not only request related to the module, but to the whole ZNC.
Also there's no good way to read from the socket, which wasn't closed via returning true from OnWebPreRequest(), because ZNC is event-driven, and such socket doesn't notify my module about new data.
Moving support for keep-alive to core would help, it'll just do OnWebRequest() on the module not only on new connections, but on old ones too.
I want a module to use long polling for its web needs.
If to use OnWebPreRequest and send Connection: keep-alive myself without closing the socket, browser will see the open socket, and will send through it not only request related to the module, but to the whole ZNC.
Also there's no good way to read from the socket, which wasn't closed via returning true from OnWebPreRequest(), because ZNC is event-driven, and such socket doesn't notify my module about new data.
Moving support for keep-alive to core would help, it'll just do OnWebRequest() on the module not only on new connections, but on old ones too.
<!-- github-comment-id:7674344 -->
How about this: Return true from OnWebPreRequest() and use the socket manager's SwapSockByAddr() to replace the HTTP socket with your own code.
How about this: Return true from OnWebPreRequest() and use the socket manager's SwapSockByAddr() to replace the HTTP socket with your own code.
<!-- github-comment-id:7674643 -->
It doesn't stop browser to do requests via this connection unrelated to my module.
Browsers don't know that this connection is only for that ZNC module, they just see site name.
It doesn't stop browser to do requests via this connection unrelated to my module.
Browsers don't know that this connection is only for that ZNC module, they just see site name.
<!-- github-comment-id:7674685 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Current code doesn't allow to do interesting stuff, because every HTTP request is parsed only from beginning of the connection.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/650-use-http-keep-alive?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github).Define "interesting stuff", please (and how keep-alive helps with it)
I want a module to use long polling for its web needs.
If to use OnWebPreRequest and send Connection: keep-alive myself without closing the socket, browser will see the open socket, and will send through it not only request related to the module, but to the whole ZNC.
Also there's no good way to read from the socket, which wasn't closed via returning true from OnWebPreRequest(), because ZNC is event-driven, and such socket doesn't notify my module about new data.
Moving support for keep-alive to core would help, it'll just do OnWebRequest() on the module not only on new connections, but on old ones too.
Even if it's not real "long polling"...
How about this: Return true from OnWebPreRequest() and use the socket manager's SwapSockByAddr() to replace the HTTP socket with your own code.
It doesn't stop browser to do requests via this connection unrelated to my module.
Browsers don't know that this connection is only for that ZNC module, they just see site name.
Uhm, just don't send back a keep-alive header. Just "replying slowly" should already work fine, shouldnt it?
dd576a0ccdf625c2df806a2e43cead1c60d41dae