Bug Report #4722

Kohana's PUT request via HTTP Body (CURL)

Added by k03 n00b over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:03/21/2013
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Internals
Target version:3.3.1
Resolution:worksforme Points:1

Description

I have two computers in local network with Windows XAMPP installed and Kohana 3.3.0 running.
My "server" is using custom port 81.

When I'm sending PUT request via plain CURL like this:

$handler = curl_init();
curl_setopt($handler, CURLOPT_POSTFIELDS, 'THE BODY');
curl_setopt($handler, CURLOPT_URL, 'http://localnetwork:81/test');
curl_setopt($handler, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($handler, CURLOPT_RETURNTRANSFER, TRUE);
echo curl_exec($handler);

Everything works and I'm getting "THE BODY" to the "server".

When I'm trying same with Kohana request:

$request = Request::factory('http://localnetwork:81/test')
->method(Request::PUT)
->body(json_encode('THE BODY'))
->headers('Content-Type', 'application/json');
$response = $request->execute();
echo $response->body();

The "server" doesn't get "THE BODY" and $this->request->body(); stays empty.

More examples:
http://forum.kohanaframework.org/discussion/11623/problem-with-external-put-request-body-stays-empty-kohana-3-3-0

History

#1 Updated by k03 n00b over 1 year ago

It seems that you're using CURLOPT_PUT in

/system/classes/Kohana/Request/Client/Curl.php:126

In PHP manual there's a text:

TRUE to HTTP PUT a file.
The file to PUT must be set with CURLOPT_INFILE and CURLOPT_INFILESIZE.

So maybe problem is that I'm not sending any file?
Should this be changed to CURLOPT_CUSTOMREQUEST ?

#3 Updated by Jeremy Bush over 1 year ago

  • Status changed from New to Closed
  • Priority changed from High to Normal
  • Target version changed from Unscheduled to 3.3.1
  • Resolution set to worksforme

Also available in: Atom PDF