Dear Christian,
Would it be possible to skip the first iterator-callback if the
callbackcontains "size=0" data, but the multipart is not empty.
First callback - skipped because "upload-name" has
data: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 );
Best wishes from ViennaMarkus

-------- Weitergeleitete Nachricht --------Von: Christian Grothoff <
groth...@gnunet.org>Antwort an: libmicrohttpd development and user
mailinglist <libmicrohttpd@gnu.org>An: libmicrohttpd@gnu.orgBetreff:
Re: [libmicrohttpd] Parsing multipart/formdataDatum: 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 thatthere are possibly two variables with
*identical* key / content-type*values* and the first one has an 'empty'
value, and the second case isthat there is just one value and you got
called with size=0 merelybecause 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, asyou say). It's an interesting corner case, which we
may want to documentand/or fix in the v2.0 API -- unless someone has a
good proposal for howto 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 iteratorstops rightbefore 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 -
> butis also not 100% reliable.'malloc()' could provide the same
> address.
> Thanks a lotMarkus

Reply via email to