Make sure we don't accidentally trigger curl's file uploading
authorChuck Hagenbuch <chuck@horde.org>
Wed, 9 Sep 2009 01:51:53 +0000 (21:51 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Wed, 9 Sep 2009 01:51:53 +0000 (21:51 -0400)
framework/Http/lib/Horde/Http/Request/Curl.php

index c13d779..8c4469b 100644 (file)
@@ -36,9 +36,13 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $this->uri);
         curl_setopt($curl, CURLOPT_FILE, $body);
-        curl_setopt($curl, CURLOPT_POSTFIELDS, $this->data);
         curl_setopt($curl, CURLOPT_WRITEHEADER, $headers);
 
+        // If we don't set POSTFIELDS to a string, and the first value begins
+        // with @, it will be treated as a filename, and the proper POST data
+        // isn't passed.
+        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->data));
+
         $result = curl_exec($curl);
 
         rewind($body);