libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] How to determine the file size for an upload and how


From: Christian Grothoff
Subject: Re: [libmicrohttpd] How to determine the file size for an upload and how to read complete query string
Date: Tue, 03 Nov 2015 22:49:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

Somehow mailman discarded this reply by Dirk Brinkmeier
<address@hidden>, but fortunately it notified me:

Hi Ken.

I also used MHD_get_connection_values() with MHD_HEADER_KIND before to
store the browser connection values in a map.
So with MHD_GET_ARGUMENT_KIND I got all the things I need.
Thank you for the hint!

But regarding the file size, I saw that wget is able to read the correct
file size on start of download.
I tried to figure out how wget is determine the size, but I got lost in
the code somehow.

Any further ideas are very welcome.

Regards,
Dirk.


On 11/03/2015 06:55 PM, Dirk Brinkmeier wrote:
> Hi.
> 
> I'm very excited in using libmicrohttpd.
> It has helped me a lot to develop a web server enabled application!
> 
> But I have 2 questions:
> 
> The first is regarding the complete size of a POSTed upload (e.g. file
> upload).
> Currently I'm using the value delivered by:
> 
> MHD_lookup_connection_value(connection, MHD_HEADER_KIND,
> MHD_HTTP_HEADER_CONTENT_LENGTH)
> 
> But this value always seems to be higher than the actual data that is sent.
> Or in other words it is higher than the file size to be uploaded.
> So I wait for *upload_data_size to be empty an then I assume that the
> POST upload is finished.
> But I can't verify the uploaded file size to the real file size.
> 
> Is the any chance to estimate the correct file size for an upload?
> 
> 
> The second question belongs to requests that contains query data.
> For example:
> https://localhost:8099/json/T_Personal.json?order=asc&limit=10&offset=0&_=1436290313274
> 
> 
> I'm reading each parameter by calling MHD_lookup_connection_value:
> MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "order");
> MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "offset");
> MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "limit");
> MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "search");
> MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "_");
> 
> This has the disadvantage that I always have to know the parameters that
> I expect.
> Is there a way to get the complete query string (for parsing it
> afterwards in my application)?
> In the example above "order=asc&limit=10&offset=0&_=1436290313274"
> 
> 
> Hope you can give me some hints...
> I also hope that I don't have missed some basic chapters in the
> documentation ;-)
> 
> Thanks a lot in advance,
> Dirk.
> 
> 
> 
> 
> 



reply via email to

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