On 09/23/2015 03:41 PM, [email protected] wrote:
>  
> 
> Hi Christian,
> 
> You're right, I am walking through the URL to extract the keys and values.

Great, that explains it then.

> I wrote this 5 years ago and I must have misunderstood the mechanism at
> the time. I still don't quite understand why the strlen method fails for
> escaped characters.

Because MHD tries to avoid moving data in memory, so when it unescapes
the URL, it only moves the rest of the current key or value, but keeps
the starting points of subsequent key-value pairs unchanged. Thus,
unescaping creates an unpredictable gap after the end of the string.

> I guess I need to rewrite it and call MHD_get_connection_values with a
> callback to handle all possible name/value pairs. This sounds like a
> better option than multiple calls to MHD_lookup_connection_value, as
> there are lots of key/value pairs which are optionally present in the
> API URL.

Sure, that's why we have two functions, which one you use totally
depends on your application.

Happy hacking!

Christian

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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to