Dear Greg, Yes, full support for WebSockets is more complex and an open feature request for a while (https://gnunet.org/bugs/view.php?id=2102). I would like to do this "right", but other things are keeping me busy.
I thought your patch's goal was merely to enable a slightly more "compliant" failure situtation for WebSocket clients. If Intel has a strong need for 'real' WebSocket support in MHD, we should discuss this off-list, as this not a 'tiny request' anymore ;-). Happy hacking! Christian On 12/04/2014 01:39 AM, Junker, Gregory wrote: > Thanks Christian > > Unfortunately, I realized that is not actually enough. WebSocket uses > the existing TCP connection with the webserver for further > WebSocket-framed traffic. This requires that MHD "orphan" the > MHD_Connection it originally set up for the incoming request (and > release the existing socket descriptor to ownership and control of > user code). I've been looking through the source in daemon.c and it > looks like a fairly complex (various combinations of > polling/not-polling/selecting/thread-or-not-thread-per-connection, > and so on). Am I just overreading the amount of work, or is it > actually non-trivial to pull this off? > > Thanks again! Greg > > -----Original Message----- From: > [email protected] > [mailto:[email protected]] On > Behalf Of Christian Grothoff Sent: Wednesday, December 3, 2014 3:47 > PM To: [email protected] Subject: Re: [libmicrohttpd] Tiny > request > > Done (SVN 34474). -Christian > > On 12/04/2014 12:30 AM, Junker, Gregory wrote: >> Hi all >> >> I need a tiny addition made to connection.c. >> >> In keepalive_possible(), can we change the line that says >> >> if (0 == strcasecmp (end, "close")) >> >> to >> >> >> >> if (0 == strcasecmp (end, "close") || 0 == strcasecmp (end, >> "upgrade")) >> >> ? >> >> This would make it possible to use libmicrohttpd in a WebSocket >> (RFC6455) environment. Currently, the way that the WebSocket >> protocol works, it sends "Connection: Upgrade" in the headers with >> the initial handshake, which causes this check to fail and >> (ultimately) insert "Connection: Keep-Alive" in the response >> headers (which cause any compliant WebSocket client to fail the >> handshake, since it needs "Connection: Upgrade" in the response >> headers, and there is no way to remove this keepalive header from >> the response from outside of MHD, as it is added automatically to >> the response buffer). >> >> Note that this is only an HTTP/1.1 issue, AFAIK (I am pretty sure, >> though not positive, that WebSocket is not compatible with >> HTTP/1.0). >> >> Thanks! Greg >> > >
signature.asc
Description: OpenPGP digital signature
