libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Problem about MHD post processor


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Problem about MHD post processor
Date: Mon, 03 Jun 2013 19:36:31 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

On 06/03/2013 04:40 PM, wan_guangping wrote:
> Dear christian,
> 
> I am very sorry to bother you again.I have implemented a HTTP server with 
> your MHD(libmicrohttpd).But my HTTP server has a problem about POST/PUT 
> operation.I test the example problem largepost.c ,I could get the right 
> result when I use the curl command,
> 
> curl -F "address@hidden;filename=test.jpg" 127.0.0.1:8888/postform,
> 
> however,I cannot get the right result when I use other methods to send HTTP 
> request,I just can get that the problem that :
> 
> con_info->postprocessor =
>             MHD_create_post_processor (connection, 
> POSTBUFFERSIZE,iterate_post, (void *) con_info);
>     if (NULL == con_info->postprocessor)
>     {
>         free (con_info);
>         return MHD_NO;
>     }
> 
> ererytime it returns from here.The  MHD_create_post_processor have not been 
> called  successfully.

The post processor only supports URL and Multipart-encodings
(see http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4, and
#define MHD_HTTP_POST_ENCODING_FORM_URLENCODED 
"application/x-www-form-urlencoded"
#define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data").

So if your browser / client uses a different method (or fails to specify which
method it uses), MHD's post processor won't work.  You can then set the method
manually before creating the post processor, or if it is not one of those two
methods you have to do the parsing of the client output yourself.

>So I want to know ,in which case the  function MHD_create_post_processor  will 
>not be called rightly.I use MHD to implement a  REST server,and I use the 
>Amazon S3 API to send HTTP request to PUT/POST objects.Every time the program 
>failed because after the MHD_create_post_processor  called, 
>con_info->postprocessor==NULL,Could you please help me to solve this problem  
>.Thank you very much.

It is not that you're calling the create_post_processor the 'wrong' way, the 
most
likely cause is an unspecified or unsupported POST encoding.

Happy hacking!

Christian



reply via email to

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