I believe that Drupal is negatively impacted by an ugly combination of PHP and IPv6 on Windows. I don't know if this is something which the Drupal developers should consider handling or just documenting, but I believe it's important enough to deserve some attention. If you don't address it now, it's just going to result in a ton of preventable bug reports, installation problems, discussions, flames, etc.

Specifically, drupal_http_request() in common.inc uses @fsockopen() and passes the hostname as the first parameter. Unfortunately that hostname will sometimes translate to an IPv6 address depending on a variety of factors, and somewhere in the chain that's not handled properly by PHP/Windows/Apache.

The simplest and most common test case for this is simply using localhost. If you have IPv6 installed, you'll likely have a hosts entry for localhost which is ::1 in addition to the more IPv4 entry of 127.0.0.1. This was the default on my new Vista computer, so I'm sure more & more people will experience this over time.

Try pinging localhost and see if you get ::1 (rather than 127.0.0.1). If so, then drupal_http_request() may in fact fail because localhost will resolve to ::1 which will fail when calling @fsockopen(). If your ping doesn't return ::1, put it in your hosts file or change the order of your hosts file such that is the result of ping, and then you should see the failure.

Here is a simple test case that will fail if localhost resolves to ::1


$fp = @fsockopen('localhost', 80, $errno, $errstr, 15);
if (! $fp)
{
  echo "Error: $errno $errstr\n";
} else {
  fclose($fp);
}

You can see a discussion on the same situation (though unrelated to Drupal) here: http://gallery.menalto.com/node/59777

Comments

anarcat’s picture

Issue tags: +ipv6

tagging

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.