libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Scenario when a http response is not sent in MHD_Acc


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Scenario when a http response is not sent in MHD_AccessHandlerCallback
Date: Thu, 18 Feb 2010 12:45:59 +0100
User-agent: KMail/1.12.4 (Linux/2.6.31-14-generic; KDE/4.3.5; i686; ; )

Dear John,

Hard to say precisely what's going on without seeing your code, but based on 
what you say I suspect you call MHD_queue_response too early.  You should only 
call it *after* all of the upload data has been given to you, which you know 
by "0 == *upload_data_size" being true for the same connection for a second 
time (the first time you are also allowed to give a response, but in that case 
the 100 CONTINUE would be suppressed).

You are right in that you should return control back to MHD (without queuing a 
response) so that MHD can continue to process other requests. HTTP does not 
allow MHD to process additional requests on this connection until you've given 
MHD a response.  As far as "upload_data_size" is concerned, you should (most 
likely) set it to "0" each time to indicate that you have in fact processed 
the uploaded data (so that MHD can receive more).

I hope this helps!

Christian

On Wednesday 17 February 2010 05:54:10 pm John Lee wrote:
> Hello there,
> My plan is for my app to receive HTTP request post payload in
> MHD_AccessHandlerCallback and from there to queue up these HTTP requests to
> be processed by a thread in my app storing off the MHD_Connection *. When
> the thread in my app has successfully processed the HTTP request it then
> uses the MHD_Connection * to send the HTTP response into MHD. The problem
> I'm having is when I return control back to MHD from
> MHD_AccessHandlerCallback with a return of MHD_YES. Even though I may
> generate say 465 HTTP requests from a test script and my app responds with
> 465 responses, MHD generates 4584 HTTP requests with 4584 - 464 errors
> getting reported when calling MHD_queue response (as the response has
> already been queued)?
> 
> My intention is to return control back to MHD when I receive a HTTP request
> without sending a response back immediately, and I want MHD to then still
> process new incoming HTTP requests. Should I be using upload_data_size to
> indicate an unprocessed request along with MHD_YES; and shall this allow
>  MHD to serve new HTTP requests on the same or different connections?
> BRs //John.
> 




reply via email to

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