Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Markus Doppelbauer
Hello, Writing directly to the socket does not bother me. My problem is: In order to use websockets we need a second "select/poll/epoll" event loop (which is not that easy if you don't want to pull in 'libev'). Would it be possible to register the socket to the MHD event loop? So that MHD could tel

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Evgeny Grin
Hi Markus, We are trying to avoid blocking of MHD by external processing of "upgraded" socket data. Currently these is no way to register such notification and it couldn't be easily added for non-TLS connections. But even if we'll add it - it will block MHD if you will process data in the caller t

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Markus Doppelbauer
Dear Evgeny, Thanks a lot for your answer. I will have to live with this API - but I don't like it. A great API would be something similar to "MHD_create_response_from_callback()" and "suspend/resume_connection()". But I understand that this is very difficult to implement. Maybe I am wrong, but thi

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Evgeny Grin
Dear Markus, It's clear how to use this logic for HTTP connections. But application may use any arbitrary protocol for "upgraded" sockets so MHD doesn't know what should be interpreted as "request"(if word "request" is applicable for protocol). The best what MHD could do with "upgraded" sockets -

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Markus Doppelbauer
Dear Evgeny, > The best what MHD could do with "upgraded" sockets - is > to forward data to application and back to remote. Yes - as much as data until the socket blocks. And it should hide everything else from the application, e.g. "sha1('Sec-WebSocket-Accept')". Is is easy to figure out, whether

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Evgeny Grin
Dear Markus, You are talking only about WebSockets protocol, but HTTP "Upgrade" can be used for many other things. MHD leave implementation of "upgraded" protocol to application. As mentioned in RFC6455: The WebSocket Protocol is an independent TCP

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Christian Grothoff
I would add that I personally would prefer to see such an implementation of WebSockets kept outside of libmicrohttpd.so proper. HTTP Upgrade/switching protocols is part of the HTTP core standard and thus must be provided by MHD. However, WebSockets is something that can and should be separate, as

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Markus Doppelbauer
All major browser support Websockets nowadays so it would be a great step ahead.  My skills are limited when it comes to low level programming, so my estimation could be wrong: But if it is only a small piece of code maybe it would be useful to be integrated in MHD. >From a user perspective I would

Re: [libmicrohttpd] Protocol upgrade

2016-11-14 Thread Junker, Gregory
On Mon, 2016-11-14 at 18:00 +0100, Christian Grothoff wrote: > I would add that I personally would prefer to see such an implementation > of WebSockets kept outside of libmicrohttpd.so proper.  Agreed Greg