libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] About an HTTPS connection Upgraded


From: Nicolas Mora
Subject: Re: [libmicrohttpd] About an HTTPS connection Upgraded
Date: Sun, 7 May 2017 18:00:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Le 2017-05-07 à 16:51, Christian Grothoff a écrit :
Hmm.  Try 'strace' on IO operations (only, i.e. "strace -e
trace=network,ipc,desc").  When you 'send' to the Web socket, it should
be writing to a socketpair(), followed by MHD 'recv'ing from that
socketpair() and then GnuTLS ultimately send'ing to the actual TCP
socket. Equivalent for 'recv()'.

Thanks for the help, I tried that and I didn't get more useful data, the strace stays with the message "read(0, " when the websocket is ready, and nothing else is displayed during the websocket communication.

One possible cause is that you somehow fail to trigger the MHD event
loop, but your example is too complex for me to tell quickly.  Also, I'd
not exclude the possibility of a bug, given that "Upgrade" is still
relatively new (and you didn't write which version of MHD you are using...).


The example program I use to test the websockets is available here:
https://github.com/babelouest/ulfius/blob/2.0b/example_programs/websocket_example/websocket_example.c
If you execute the program with no option, the mode is http, if you add -https, the mode is https. The only change is the MHD daemon ran in secure mode or not.

If you want to test, clone the repository, checkout the branch 2.0b, then go to the folder example_programs/websocket_example/ and run "make test", this will run the program in http mode, for https mode, run manually "LD_LIBRARY_PATH=../../src: ./websocket_example -https".

Then, with the browser, go to http[s]://localhost:9275/static/ to run the test.

I use the MHD 0.9.53, compiled with debug option.

Also, I don't know if it's relevant, bu I reused the code from the test_upgrade.c file to put the MHD_sock in block mode, otherwise I couldn't tell if the connection is still open or not:

flags = fcntl (sock, F_GETFL);
if (-1 == flags) {
  return;
}
if ((flags & ~O_NONBLOCK) != flags && -1 == fcntl (sock, F_SETFL, flags & ~O_NONBLOCK)) {
  return;
}

/Nicolas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]