[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] How can I decode the form-data fields with MHD_http_
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] How can I decode the form-data fields with MHD_http_unescape() function? |
Date: |
Tue, 16 Feb 2016 10:26:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
For (2), as you said, MHD_http_unescape does not replace the "+". The
reason is that there are some situations in the HTTP protocol where that
is undesirable. So yes, in your case, you need to yourself replace the
"+" with space, and that should be the only further transformation required.
I'm not sure I understand question (1) -- what else would you pass? --
but the answer seems to be "yes".
Happy hacking!
Christian
On 02/16/2016 03:32 AM, silvioprog wrote:
> Hello,
>
> I have following form-data:
>
> Content-Type: multipart-form-data
> id=10&name=Silvio+Cl%C3%A9cio
> ... some uploads here ...
>
> But when I decode it with MHD_http_unescape() function:
>
> ..., char *key, ...
> MHD_http_unescape(key);
>
> I got:
>
> Silvio+Clécio
>
> But I need the full unescaped value, that is "Silvio Clécio" (without
> quotes). So, I have two questions:
>
> 1. is it correct to pass only the reference of my variable to this function?
> 2. is it correct to replece all "+" occurrences after to use the HTTP
> unescape function, or do I need to replace other chars?
>
> Thank you!
>
signature.asc
Description: OpenPGP digital signature