libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Parsing multipart/formdata


From: Markus Doppelbauer
Subject: Re: [libmicrohttpd] Parsing multipart/formdata
Date: Tue, 21 Apr 2020 17:08:19 +0200
User-agent: Evolution 3.30.5-1.1

Hi Christian,

No problem. Just a corner case as you say.
Thanks a lot for your answer.

Best wishes


-------- Weitergeleitete Nachricht --------
Von: Christian Grothoff <address@hidden>
Antwort an: libmicrohttpd development and user mailinglist <address@hidden>
An: address@hidden
Betreff: Re: [libmicrohttpd] Parsing multipart/formdata
Datum: Tue, 21 Apr 2020 16:25:53 +0200

Hi Markus,

Let me get this straight:
The scenario you are concerned with is to distinguish the case that
there are possibly two variables with *identical* key / content-type
*values* and the first one has an 'empty' value, and the second case is
that there is just one value and you got called with size=0 merely
because of 'unfortunate' network traffic. Is that right?

If so, I don't think the current API allows you to _reliably_
distinguish those two cases (cmp'ing pointers is an unreliable hack, as
you say). It's an interesting corner case, which we may want to document
and/or fix in the v2.0 API -- unless someone has a good proposal for how
to do address this case in a binary-API compatible way.


Happy hacking!

Christian


On 4/21/20 4:17 PM, Markus Doppelbauer wrote:
Hello,

Is there a reliable way to detect 'continution' in 'MHD_PostDataIterator()'?
To detect the beginning of a new variable I have tested: 'off == 0'.
But this is not reliable. It is a rare case but sometimes the iterator
stops right
before the first content-byte (if helpful I will provide a testcase):

first call:
MHD_PostDataIterator( cls, kind=MHD_POSTDATA_KIND, key="upload-name",
filename="video.mp4", content_type="video/mp4", transfer_encoding=nullptr,
data="" off=0, size=0 );

second call:
MHD_PostDataIterator( cls, kind=MHD_POSTDATA_KIND, key="upload-name",
filename="video.mp4", content_type="video/mp4", transfer_encoding=nullptr,
data="" off=0, size=64724 );

Pointer comparision of 'key', 'filename' and 'content_type' works - but
is also not 100% reliable.
'malloc()' could provide the same address.

Thanks a lot
Markus

reply via email to

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