libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Accessing raw POST payload


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Accessing raw POST payload
Date: Thu, 16 Oct 2014 14:08:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.0

Ah, yes, the MHD PostProcessor does not support 'all' possible
encoding types. If your client sends an unsupported encoding,
you need to parse "*upload_data" yourself.  Note that the
MHD_PostProcessor only exists for convenience, you could write that
entire logic as a client.  So please simply look at what the PP does for
the supported encodings, and then write a 'custom' PP for JSON.

Happy hacking!

Christian

On 10/16/2014 02:02 PM, Matej Svejda wrote:
> Hi Christian, thank you for your reply. It seems to me that the problem
> is that post_iterator works only for data submitted by HTML forms and
> not for custom POST data. For example, if I send a request with
> Content-Type application/json to the post_example.c I get:
> 
> Failed to setup post processor for `/2'
> Internal application error, closing connection.
> 
> If i set the Content-Type to x-www-form-urlencoded it works but still
> tries to parse it as key-value pairs, which in my case it shouldn't. I
> am looking for a way to directly access the data submitted by post,
> regardles of the Content-Type.
> 
> Regards,
> Matej

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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