[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] About an HTTPS connection Upgraded
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] About an HTTPS connection Upgraded |
Date: |
Sun, 7 May 2017 21:42:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 05/07/2017 09:20 PM, Nicolas Mora wrote:
> Hello,
>
> I'm still working on a websocket implementation based on MHD, the non
> secure websocket works fine, but the secure websocket doesn't work yet.
>
> I'm having problems with the socket and the tls session. I get my
> inspiration from the test_upgrade.c file but I can't have a valid tls
> session anyway.
>
> Inside the upgrade callback function, I use the same sequence as in the
> example program to initiate the tls session and the result tells me it's
> connected:
> https://github.com/babelouest/ulfius/blob/2.0/src/u_websocket.c#L127
>
> But when it comes to reading or sending data, I got nothing or errors,
> whether the socket is in blocking mode or not.
>
> The read/write functions are at the end of the file:
> https://github.com/babelouest/ulfius/blob/2.0/src/u_websocket.c#L720
>
> Does anyone see what's wrong with my code?
Eh, what is wrong is that you use "gnutls_record_send". MHD will do
this for you, you should just use "send/recv", even in HTTPS mode! In
fact, your code (short of MHD_start_daemon) can be exactly the same for
HTTP and HTTPS.
signature.asc
Description: OpenPGP digital signature