libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Problem with PUT requests


From: Jordan Henderson
Subject: Re: [libmicrohttpd] Problem with PUT requests
Date: Mon, 3 Mar 2014 07:51:52 -0500

Christian,

Thanks.  I believe I can add in headers with the curl command line client.  I'll try that and see if it works better.  Since PUT support is very client specific, this would certainly work for me.


On Mon, Mar 3, 2014 at 3:48 AM, Christian Grothoff <address@hidden> wrote:
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




--
----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]