libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] chunked data mixed across multiple GETs


From: Conor Lennon
Subject: Re: [libmicrohttpd] chunked data mixed across multiple GETs
Date: Fri, 18 Jun 2021 20:59:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Hi Evgeny,

Thanks for that useful advice.

Yes - I think my issue is that I'm getting several requests.

Is there any way to configure libmicrohttpd to not accept a new HTTP request, 
or at least not call MHD_AccessHandlerCallback, until the previous
(chunked) response has completed?

Looking at the MHD_FLAGS enumeration,  nothing is jumping out at me.

Regards,

Conor


On 18/06/2021 15:18, Evgeny Grin wrote:
> Hi Conor,
>
> If I've got you right, the question is not about large responses, but about 
> simultaneous handling of several responses at the same time.
>
> It is implemented very easily. When your application processes request, it 
> should decide how you construct your response: for example, make
> request A for database B or read picture X and convert it to to the format Z.
> Then you need to put all parameters (the name of database and the request or 
> picture location and final format) to the callback parameter
> variable. See chunked_example.c, where 'callback_param' is always initialized 
> with the same date. In practice it should be initialized with
> data varied depending on the request.
>
> If you are reusing the same response (struct MHD_Response object) for several 
> requests, you must ensure that your callback generates response
> data for response position provided as callback parameter. In this case it 
> doesn't matter which request is served, the data is determined by
> response object and position.
>
> Alternatively, if you are using unique responses for each request (as it was 
> done in the example), you can put (update) number of last line
> sent to the client into your callback parameter and start your next chunk 
> from the next line.
>
-- 
Regards,
Conor Lennon
Druid Software Ltd.

Next scheduled leave:
August 2nd to August 13th inclusive





reply via email to

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