libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] upgrading and life cycle of sockets


From: Christian Grothoff
Subject: Re: [libmicrohttpd] upgrading and life cycle of sockets
Date: Tue, 24 Nov 2020 15:34:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

Hi Jose,

Well, technically you can dup() around this and call action close early.
HOWEVER, this breaks BADLY if you ever use TLS connections: here, MHD
will right now ensure that you write plaintext into your socket and turn
it into ciphertext for the network. That's why MHD needs to keep some
state per connection, and if you break that, well, kiss TLS-support goodbye.

So I would not recommend for applications to try to take any 'full
control' of the socket, simply because it may not be the real socket and
merely be a socketpair to talk to MHD's TLS-adapter ;-).

Happy hacking!

Christian

On 11/24/20 3:23 PM, José Bollo wrote:
> Hi there,
> 
> After a switching protocol for web socket for example, libmicrohttp
> keeps the socket under the table until a call to MHD_upgrade_action
> (something, MHD_UPGRADE_ACTION_CLOSE).
> 
> So, it enforces to have a link to libmicrohttp when using such switched
> protocol socket.
> 
> Is it possible to break that link? To tell libmicrohttp to forget and
> clean things related to that socket and let far part of code use the
> socket freely?
> 
> Best
> José
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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