libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Problem with PUT requests


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Problem with PUT requests
Date: Mon, 03 Mar 2014 09:48:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10

Dear Jordan,

While MHD does not behave differently between PUT and POST, it is
possible that the HTTP client changes the encoding of the upload.
With CURL, I suspect --upload-file you get the file directly without
encoding, while with --form you get it in one of the encodings suitable
for MHD's post processor.

Thus, in this case, you might need to check what the HTTP headers say
about how the data was encoded and either use the MHD post processor
or process the file data directly from the upload_data field.

The fact that PUT/POST _could_ use the same content encodings does not
mean that clients are likely to do that ;-).

Happy hacking!

Christian

On 03/02/14 19:55, Jordan Henderson wrote:
> Hi,
> 
> I'm playing with a REST framework.  I've not been able to get PUT
> requests to work as I would expect them to.  I think I have had some
> luck with PUT in earlier tests I performed, but I didn't save that code. 
> 
> I would expect to be able to use PUT and POST interchangeably, as the
> documentation and this message suggests:
> 
> http://lists.gnu.org/archive/html/libmicrohttpd/2012-08/msg00022.html
> 
> The attached code is tested with curl commands:
> 
> curl --upload-file uploadfile http://localhost:8080/FILE/foo.dat  # PUT test
> 
> curl --form address@hidden http://localhost:8080/FILE/foo.dat  #
> POST test
> 
> I'm seeing the print statements in the post_interator() routine executed
> for the POST request but not for the PUT request.
> 
> 
> 
> -- 
> ----Jordan Henderson
> 
> "I can picture in my mind a world without war, a world without hate. And
> I can picture us attacking that world, because they'd never expect it."
>   - Jack Handey



reply via email to

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