Ethna がインストール出来ない
そろそろ Ethna に恩返しようと思い、何か commit 出来る事を探そうと、インストールを試みたら。
% pear -V PEAR Version: 1.7.1 PHP Version: 5.2.6-1+lenny16 Zend Engine Version: 2.2.0 Running on: Linux gw 2.6.26-2-686 #1 SMP Wed Sep 21 04:35:47 UTC 2011 i686 % sudo pear channel-discover pear.ethna.jp [sudo] password for yoya: Discovery of channel "pear.ethna.jp" failed (channel-add: Cannot open "http://pear.ethna.jp/channel.xml" (File http://pear.ethna.jp:80/channel.xml not valid (received: HTTP/1.1 404 Not Found )))
初めに結論
対処
if ($lastmodified === false || $lastmodified) { $request = "GET $path HTTP/1.1\r\n"; - $request .= "Host: $host:$port\r\n"; + $request .= "Host: $host\r\n"; } else { $request = "GET $path HTTP/1.0\r\n"; $request .= "Host: $host\r\n"; }
以下、調査。
エラーの場所
$loc = $downloader->downloadHttp($params[0], $this->ui, $tmpdir, null, false); var_dump($params); // ← 追加。 ↓ array(1) { [0]=> string(32) "http://pear.ethna.jp/channel.xml" }
あれ。ここでは :80 ついてない。
HTTP 叩いてみた
% telnet pear.ethna.jp 80 Trying 207.97.227.245... Connected to ethna.github.com. Escape character is '^]'. GET /channel.xml HTTP/1.1 Host:pear.ethna.jp:80 HTTP/1.1 404 Not Found Server: nginx/1.0.12 Date: Wed, 22 Feb 2012 16:12:03 GMT Content-Type: text/html Content-Length: 15773 Connection: keep-alive
% telnet pear.ethna.jp 80 Trying 207.97.227.245... GET /channel.xml HTTP/1.1 Host:pear.ethna.jp Connected to ethna.github.com. Escape character is '^]'. HTTP/1.1 200 OK Server: nginx/1.0.12 Date: Wed, 22 Feb 2012 16:13:21 GMT Content-Type: text/xml Content-Length: 797
ちょっと不安になったので。
HTTP/1.1 の仕様によれば、port 指定も許されるはず。
apache から nginx に移る時に問題になるかもと不安になったので、 apache に port 付き Host を送って試してみた。
yoya@yoya:~$ telnet awm.jp 80 Trying 49.212.17.121... Connected to awm.jp. Escape character is '^]'. GET /~yoya/ HTTP/1.1 Host: pwiki.awm.jp:80 HTTP/1.1 400 Bad Request
Apache でも駄目かな。
エラー文言からして apache.conf に :80 の VirtualName を明示的に入れても対応出来なさそうだし。
本気で検証するなら apache のソース見た上で色んな設定でゴニョゴニョするのを、複数のバージョンで試すけど、とりあえずココまで。