libmicrohttpd
[Top][All Lists]
Advanced

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

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


From: Dirk Brinkmeier
Subject: [libmicrohttpd] How to determine the file size for an upload and how to read complete query string
Date: Tue, 3 Nov 2015 18:55:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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]