libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Query on async response using microhttpd


From: Geetha Shanmugam
Subject: Re: [libmicrohttpd] Query on async response using microhttpd
Date: Tue, 23 Aug 2016 01:06:00 +0530

Hi, 
I am trying this model with MHD_USE_SELECT_INTERNALLY (instead of a external select as explained in the earlier e-mail). 
However have not been able to successful in doing so.

1. Process P1, start the MHD daemon and defines answer_to_connection() function.
2. answer_to_connection, then verifies for basic authentication, if successful, suspends the connections 
3. It then retrieves the required request header and url argument and frames another request to process P2 and exits answer_to_connection() function.
4. P2 process the request and responds with an answer
5. Function send_final_response() in process P1, resumes the connection and sends the response received from process P2 using MHD_create_response_from_buffer(). 
6. MHD_create_response_from_buffer return error and the response is not sent out.

Observations:
1. If the response is sent from answer_to_connection function, there are no error. The response is sent out successfully. 
2. Implemented MHD_RequestCompletedCallback() function and noticed that the callback is being called immediately after exiting the answer_to_connection() function. Ie, at step3. with toe vaule (MHD_RequestTerminationCode ) as 1 (MHD_REQUEST_TERMINATED_WITH_ERROR)

How can i debug this case further?
1. Is there a way to find out if MHD_resume_connection returned an error? (i am using MHD version 0.9.50 and resume and suspend returns void)
2. MHD_USE_SELECT_INTERNALLY can handle multiple simultaneous connections, right? How can i differentiate the connection pointers with respect be multiple connection?


Any pointer on how to debug this further will be of great help. 

Thanks, 
Geetha


On Mon, Aug 1, 2016 at 6:51 PM, Geetha Shanmugam <address@hidden> wrote:
Thanks very much for the response, Andreas Wehrmann. It helps.

~Geetha


On Fri, Jul 29, 2016 at 10:58 PM, Geetha Shanmugam <address@hidden> wrote:

Hi,

We are trying to use libmircohttpd in the following scenario.

 

Process P1 start MHD daemon in the external select mode.

It has to communicate to another process say P2 to send out the response.

The communication between P1 and P2 are via sockets (already tested and working model)

P1 should be able to receive and process multiple request without blocking.

The response should be sent asynchronously, not from the access handler callback function.

 

Is there an example that I can refer to understand how this can be done?

 

From reading thru the archive and manual, i understand that we can use the following APIs

1. MHD_suspend connection() can be called from access handler callback function, so the daemon can process the other incoming request, when the first one is being processed.

2. MHD_resume_connection() to send out the response once it is ready.

3. MHD_create_response_from_callback() - with a content reader callback and content reader free callback.

But unable to get the complete flow as how this can be done.

 

Thanks,

Geetha




reply via email to

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