[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] How to give busy message to second file upload clie
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] How to give busy message to second file upload client when 1st client file |
Date: |
Sat, 23 Aug 2008 13:59:20 -0600 |
User-agent: |
KMail/1.9.9 |
On Saturday 23 August 2008 10:30:15 am Sebastian Gerhardt wrote:
> Hello,
>
> Christian, I am a bit confused over this. Are you proposing that
> such a response should be built in the RequestCompletedCallback
> function? This seems counter-intuitive because the
> RequestTerminationCode is MHD_REQUEST_TERMINATED_COMPLETED_OK
> (Manual: "We finished sending the response."), suggesting that the
> response has already been sent.
No, you queue the response in the normal AccessHandlerCallback, at the place
marked below (minor variant on the minimal_example.c from the distribution):
if (0 != strcmp (method, "POST"))
return MHD_NO; /* unexpected method */
if (&aptr != *ptr)
{
// If you want to generate an ERROR on POST,
// this is where you WILL queue the response (in contrast
// to what the above comment in minimal_example.c may
// suggest...
ret = MHD_queue_response(...);
*ptr = &aptr;
return ret;
}
(again, this is the NULL / called-before check that is usually done first in
the AccessHandlerCallback).
> Reading the homepage, which says
>
> "-- if the client queues a response during this first call, a 100
> CONTINUE response will be suppressed, the request body will not be
> read and the connection will be closed after sending the response."
>
> I would expect the MHD_AccessHandlerCallback to be the most appropriate
> place to built and queue this response--returning with MHD_YES.
Yes.
> This version works for GET requests, but it does not work for POST
> requests. The connection is just closed by MHD and nothing is sent.
For POST request it is important to do this in the right place; for GET
requests the 100 CONTINUE does not really apply (since the client does not
send anything after the header anyway).
> The only way to get a response sent for POST requests that I found so
> far is to create the postprocessor and do at least one post_data
> iteration.
Creating the postprocessor does nothing for the actual HTTP processing -- the
entire postprocessor code does not interact with the networking code.
I hope this really clarifies the issue...
Christian