c93614 / rolling-curl

Automatically exported from code.google.com/p/rolling-curl
0 stars 0 forks source link

getoptions don't set the Headers #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
RollingCurl.php 
Line346:         $headers = $request->headers;

Original issue reported on code.google.com by laneo...@gmail.com on 7 Apr 2011 at 8:36

GoogleCodeExporter commented 9 years ago
I found this bug too , spent me some time to find this issue , god 

Original comment by ganjian...@gmail.com on 14 Dec 2012 at 9:42

GoogleCodeExporter commented 9 years ago
I stumbled on this issue as well. Here's the patch:

--- a/rolling-curl-read-only/RollingCurl.php
+++ b/rolling-curl-read-only/RollingCurl.php
@@ -342,7 +342,10 @@ class RollingCurl {
             $options[CURLOPT_FOLLOWLOCATION] = 1;
             $options[CURLOPT_MAXREDIRS] = 5;
         }
-        $headers = $this->__get('headers');
+        $headers = array_merge (
+            array_values ($this->__get('headers')),
+            array_values ($request->headers)
+        );

         // append custom options for this specific request
         if ($request->options) {

Original comment by septagr...@gmail.com on 9 Jun 2013 at 3:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Stumbled across this one too! 
It only started working after header was separately specified as an option:

$options = array( CURLOPT_HTTPHEADER => array("content-type: 
application/json"));
$rc->request($url, "POST", $json_string, $doesntmatter_totallyIgnored, 
$options);

Original comment by minnieko...@gmail.com on 28 Feb 2014 at 1:05