]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - extlib/HTTP/Request2/Adapter.php
update HTTP_Request2 to 2.0.0RC1
[quix0rs-gnu-social.git] / extlib / HTTP / Request2 / Adapter.php
index 39b092b346e451f962412ea4f51d81e674efa7c6..2cabbf897b8ddcbe3e2a54d549461d3d7e70ac3a 100644 (file)
@@ -6,7 +6,7 @@
  *\r
  * LICENSE:\r
  *\r
- * Copyright (c) 2008, 2009, Alexey Borzov <avb@php.net>\r
+ * Copyright (c) 2008-2011, Alexey Borzov <avb@php.net>\r
  * All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or without\r
@@ -37,7 +37,7 @@
  * @package    HTTP_Request2\r
  * @author     Alexey Borzov <avb@php.net>\r
  * @license    http://opensource.org/licenses/bsd-license.php New BSD License\r
- * @version    CVS: $Id: Adapter.php 274684 2009-01-26 23:07:27Z avb $\r
+ * @version    SVN: $Id: Adapter.php 308322 2011-02-14 13:58:03Z avb $\r
  * @link       http://pear.php.net/package/HTTP_Request2\r
  */\r
 \r
@@ -50,13 +50,13 @@ require_once 'HTTP/Request2/Response.php';
  * Base class for HTTP_Request2 adapters\r
  *\r
  * HTTP_Request2 class itself only defines methods for aggregating the request\r
- * data, all actual work of sending the request to the remote server and \r
+ * data, all actual work of sending the request to the remote server and\r
  * receiving its response is performed by adapters.\r
  *\r
  * @category   HTTP\r
  * @package    HTTP_Request2\r
  * @author     Alexey Borzov <avb@php.net>\r
- * @version    Release: 0.4.1\r
+ * @version    Release: 2.0.0RC1\r
  */\r
 abstract class HTTP_Request2_Adapter\r
 {\r
@@ -109,8 +109,8 @@ abstract class HTTP_Request2_Adapter
    /**\r
     * Calculates length of the request body, adds proper headers\r
     *\r
-    * @param    array   associative array of request headers, this method will \r
-    *                   add proper 'Content-Length' and 'Content-Type' headers \r
+    * @param    array   associative array of request headers, this method will\r
+    *                   add proper 'Content-Length' and 'Content-Type' headers\r
     *                   to this array (or remove them if not needed)\r
     */\r
     protected function calculateRequestLength(&$headers)\r
@@ -133,13 +133,15 @@ abstract class HTTP_Request2_Adapter
         if (in_array($this->request->getMethod(), self::$bodyDisallowed) ||\r
             0 == $this->contentLength\r
         ) {\r
-            unset($headers['content-type']);\r
             // No body: send a Content-Length header nonetheless (request #12900),\r
             // but do that only for methods that require a body (bug #14740)\r
             if (in_array($this->request->getMethod(), self::$bodyRequired)) {\r
                 $headers['content-length'] = 0;\r
             } else {\r
                 unset($headers['content-length']);\r
+                // if the method doesn't require a body and doesn't have a\r
+                // body, don't send a Content-Type header. (request #16799)\r
+                unset($headers['content-type']);\r
             }\r
         } else {\r
             if (empty($headers['content-type'])) {\r