I'm using MHD versions 0.9.54 and latest from git on both FreeBSD 11 and
Linux (I think CentOS 7 with v3.10 kernel).
No extra args to ./configure on Linux.
HTTPS, gnutls and libgcrypt related args to ./configure on FreeBSD.
My MHD_UpgradeHandler creates a new thread, immediately detached, which
does the following:
Put socket into blocking mode
Loop doing read() and processing received data until error, EOF or
"close" websocket frame
Call MHD_upgrade_action(urh, MHD_UPGRADE_ACTION_CLOSE)
Exit thread
It is also possible that I might call "shutdown(sock, SHUT_RDWR)" from
another thread to cause above loop to exit.