On 04/29/2018 03:14 PM, Austin Einter wrote:
> Dear All
> I am very new to libmicrohttpd.
> I am planning to use libmicrohttpd in one of my project.
> 
> I have basic two questions
> 
> 1) Can I send HTTP responses in an asynch manner. 
> Example - Say I get a GET request in my libmicrohttpd server.
> Say answer_to_connection callback got called. I do not want to send
> response immediately. I will interact with my application server (which
> is in a separate machine). After my interaction with my application
> server I want to send response for GET request. Is it possible? If so
> please help how to achieve it.

Yes, this is possible. In thread-per-connection mode, you can just block
in the callback. If you use an event loop, you must call
MHD_suspend_connection(), and then MHD_resume_connection() once you are
ready to serve the reply.

> 
> 2)I know libmicrohttpd is a server. Is it possible to use it as a
> client, like send a GET or POST request to another web server.

Nope, but there are libraries like libwget2 and libcurl for that.
git.taler.net/twister contains an example for implementing a proxy
combining MHD and libgnurl.

Best regards,

Christian

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to