diff options
-rw-r--r-- | includes/common.inc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc index 3ace4c637..1a1caad76 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -536,8 +536,9 @@ function drupal_http_request($url, array $options = array()) { // or PUT request. Some non-standard servers get confused by Content-Length in // at least HEAD/GET requests, and Squid always requires Content-Length in // POST/PUT requests. - if (!empty($options['data']) || $options['method'] == 'POST' || $options['method'] == 'PUT') { - $options['headers']['Content-Length'] = strlen($options['data']); + $content_length = strlen($options['data']); + if ($content_length > 0 || $options['method'] == 'POST' || $options['method'] == 'PUT') { + $options['headers']['Content-Length'] = $content_length; } // If the server URL has a user then attempt to use basic authentication. |