libmicrohttpd
[Top][All Lists]
Advanced

[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: Evgeny Grin
Subject: Re: [libmicrohttpd] How can I decode the form-data fields with MHD_http_unescape() function?
Date: Tue, 16 Feb 2016 13:34:40 +0300
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

May be we should change decoding algorithm.
According to current HTML standard
https://www.w3.org/TR/html5/forms.html#url-encoded-form-data symbol
"+" must be decoded as space. This standard uses old RFC for
encoding/decoding http://www.ietf.org/rfc/rfc1738.txt
But in "path" part of URI, space symbol must be encoded as %20.

- -- 
Best Wishes,
Evgeny Grin
On 16.02.2016 12:26, Christian Grothoff wrote:
> 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".
> 
> On 02/16/2016 03:32 AM, silvioprog wrote:
>> 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?
>> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWwvtAAAoJEL96xKXqwrr0lNMIAJ7x/CPFoB5CpuFnhXB46B3Z
dZY3jNhff0T9JxfKmQPHNC/PJCPjNb8P5eVBiIHVnN4OMRD2DO9TiTDhX9pudynZ
tHQeuWEZVr39Q7vqcerxNjsCtLnYvXqcIeDUoMElSvQ0jY7PBDHURd2bkzKkuM7q
BAaS+EjbyON7UqqPc2NBMjIW0cBoUBqSnIh4gSNrZKJWuHQMPWwItu2QnUB6HQub
ZczuiodEZgg3ETBe1oZHnHBa798gJwEdG1iGZCtP/QUMsFjgQuxbbUb20sRNoTQ4
zgy8Ul0kGvL63CV6ZiwU2h7xRbKtVeAznXR63QhXfwjIconE1o60Du6eOxvP4Dk=
=yzPm
-----END PGP SIGNATURE-----



reply via email to

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