Author: gillou.ray
Description:
Source of http://[2a01:e0b:1:47:240:63ff:fee8:c3a]/index.php/Accueil
I use Linux 2.6.24-gentoo-r3 on Gentoo release 1.12.11.1 with PHP 5.2.6RC4-pl0-gentoo, and mediawiki SVN r38180.
My mediawiki website is unaccessible from the given URL. The browser try to access the path "/" and is redirected to
http://2a01:e0b:1:47:240:63ff:fee8:c3a/index.php/Accueil, which lacks the brackets.
Here are the HTTP headers sent:
GET / HTTP/1.1
Host: [2a01:e0b:1:47:240:63ff:fee8:c3a]
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008062122 Minefield/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr-fr,fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.1 301 Moved Permanently
Date: Tue, 29 Jul 2008 14:06:12 GMT
Server: Apache
X-Powered-By: PHP/5.2.6RC4-pl0-gentoo
Vary: Accept-Encoding,Cookie
X-Vary-Options: Accept-Encoding;list-contains=gzip,Cookie;string-contains=wikidbToken;string-contains=wikidbLoggedOut;string-contains=wikidb_session
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: private, must-revalidate, max-age=0
Last-modified: Tue, 29 Jul 2008 14:06:12 GMT
Location: http://2a01:e0b:1:47:240:63ff:fee8:c3a/index.php/Accueil
Content-Encoding: gzip
Content-Length: 26
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
As you can see, the "Location: ..." line is wrong. I searched why, and discovered that all the full URLs are contructed using $wgServer, which equals to "http://2a01:e0b:1:47:240:63ff:fee8:c3a" in the example above.
This variable is built by includes/DefaultSettings.php, thanks to $_SERVER['SERVER_NAME'], which equals to "2a01:e0b:1:47:240:63ff:fee8:c3a".
In short, we need to add brackets to IPv6 URLs. All the URLs of the website that include the server IP are wrong, such as the RSS and ATOM links. No problems with IPv4 (88.191.47.48).
I'm wondering if we can consider that this bug would be redirected to PHP, as the $_SERVER['SERVER_NAME'] variable is involved into URL building 99% of the time. Also, correcting our URLs would involve a heavy test on the variable to determine if it's an IPv6. However, $_SERVER['HTTP_HOST'] (the "Host: ..." line of the browser) could be used because it contains the brackets.
I set the bug severity to minor, because navigation from the main page is still possible, as many of the href links do not include the server IP. I also attached the wiki main page source to let you see what's in if you have not an IPv6 access.
Version: 1.14.x
Severity: major
OS: Linux
Platform: PC
URL: http://[2a01:e0b:1:47:240:63ff:fee8:c3a]/
Attached: