--- drupal-7.x-dev/includes/common.inc.orig 2009-02-17 07:49:13.000000000 +0000 +++ drupal-7.x-dev/includes/common.inc 2009-02-17 08:26:08.000000000 +0000 @@ -535,9 +535,18 @@ // host that do not take into account the port number. 'Host' => $host, 'User-Agent' => 'Drupal (+http://drupal.org/)', - 'Content-Length' => strlen($options['data']), ); + // Only add 'Content-Length' if we actually have any content or if it is a + // POST 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 (strlen($options['data']) || + $options['method'] == "POST" || + $options['method'] == "PUT") { + $options['headers']['Content-Length'] = strlen($options['data']); + } + // If the server url has a user then attempt to use basic authentication if (isset($uri['user'])) { $options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));