libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Parsing multipart/formdata


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Parsing multipart/formdata
Date: Tue, 21 Apr 2020 16:25:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

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

Attachment: 0x939E6BE1E29FC3CC.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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