Bug #4110
closedホスト名の先頭が数字であるとき、WEBrickのテストでErrorが出る
Description
=begin
ホスト名の先頭が数字であるような環境において、WEBrickのテストでErrorが出ます。
これは、WEBrick::HTTPRequest#parse_uriの中においてURI#host=でホスト名を設定する際、
先頭が数字であるような(ドットを含まない)ホスト名は許されないので例外が発生しているためです。
ひとまず、設定の:ServerNameを'localhost'にしてみたらテストは通りました。
$ ~/local/ruby-trunk/bin/ruby -v test/webrick/test_filehandler.rb
ruby 1.9.3dev (2010-12-02 trunk 30021) [x86_64-linux]
test/webrick/test_filehandler.rb:187: warning: assigned but unused variable - this_file
test/webrick/test_filehandler.rb:202: warning: assigned but unused variable - this_file
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/minitest/unit.rb:623: warning: assigned but unused variable - ac
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/minitest/unit.rb:624: warning: assigned but unused variable - tc
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:232: warning: assigned but unused variable - canon
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:232: warning: assigned but unused variable - sw
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:232: warning: assigned but unused variable - cn
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:446: warning: shadowing outer local variable - s
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:13536: warning: assigned but unused variable - s
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:447: warning: shadowing outer local variable - s
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:13536: warning: assigned but unused variable - s
Run options:
Running tests:¶
..E....
Finished tests in 0.657798s, 10.6416 tests/s, 83.6123 assertions/s.
- Error:
test_make_partial_content(WEBrick::TestFileHandler):
WEBrick::HTTPStatus::BadRequest: bad URI/'. test/webrick/test_filehandler.rb:35:in
make_range_response'
test/webrick/test_filehandler.rb:47:in `test_make_partial_content'
7 tests, 55 assertions, 0 failures, 1 errors, 0 skips
$ ~/local/ruby-trunk/bin/ruby -v test/webrick/test_httprequest.rb
ruby 1.9.3dev (2010-12-02 trunk 30021) [x86_64-linux]
test/webrick/test_httprequest.rb:321: warning: ambiguous first argument; put parentheses or even spaces
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/minitest/unit.rb:623: warning: assigned but unused variable - ac
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/minitest/unit.rb:624: warning: assigned but unused variable - tc
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:232: warning: assigned but unused variable - canon
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:232: warning: assigned but unused variable - sw
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:232: warning: assigned but unused variable - cn
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:446: warning: shadowing outer local variable - s
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:14640: warning: assigned but unused variable - s
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:447: warning: shadowing outer local variable - s
/home/yanagi/local/ruby-trunk/lib/ruby/1.9.1/optparse.rb:14640: warning: assigned but unused variable - s
Run options:
Running tests:¶
..EE.EEE.E....
Finished tests in 0.015776s, 887.4239 tests/s, 3866.6329 assertions/s.
-
Error:
test_continue_not_sent(TestWEBrickHTTPRequest):
WEBrick::HTTPStatus::BadRequest: bad URI/path'. test/webrick/test_httprequest.rb:332:in
test_continue_not_sent' -
Error:
test_continue_sent(TestWEBrickHTTPRequest):
WEBrick::HTTPStatus::BadRequest: bad URI/path'. test/webrick/test_httprequest.rb:316:in
test_continue_sent' -
Error:
test_parse_09(TestWEBrickHTTPRequest):
WEBrick::HTTPStatus::BadRequest: bad URI/'. test/webrick/test_httprequest.rb:12:in
test_parse_09' -
Error:
test_parse_10(TestWEBrickHTTPRequest):
WEBrick::HTTPStatus::BadRequest: bad URI/'. test/webrick/test_httprequest.rb:29:in
test_parse_10' -
Error:
test_parse_11(TestWEBrickHTTPRequest):
WEBrick::HTTPStatus::BadRequest: bad URI/path'. test/webrick/test_httprequest.rb:46:in
test_parse_11' -
Error:
test_parse_header2(TestWEBrickHTTPRequest):
WEBrick::HTTPStatus::BadRequest: bad URI/foo/bar/../baz?q=a'. test/webrick/test_httprequest.rb:117:in
test_parse_header2'
14 tests, 61 assertions, 0 failures, 6 errors, 0 skips
=end
Files
Updated by naruse (Yui NARUSE) almost 14 years ago
=begin
RFC 2396 では以下の通りだったけれど、
hostport = host [ ":" port ]
host = hostname | IPv4address
hostname = *( domainlabel "." ) toplabel [ "." ]
domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
toplabel = alpha | alpha *( alphanum | "-" ) alphanum
RFC 3986 で変わって許されるようになったんですね。とりあえず対処を入れます。
authority = [ userinfo "@" ] host [ ":" port ]
host = IP-literal / IPv4address / reg-name
reg-name = *( unreserved / pct-encoded / sub-delims )
=end
Updated by naruse (Yui NARUSE) almost 14 years ago
- Status changed from Open to Assigned
- Assignee set to naruse (Yui NARUSE)
=begin
=end
Updated by taca (Takahiro Kambe) almost 14 years ago
=begin
In message 4cf7d921e329c_5e69b630e7e65d@redmine.ruby-lang.org
on Fri, 3 Dec 2010 02:36:34 +0900,
Yui NARUSE redmine@ruby-lang.org wrote:
RFC 2396 では以下の通りだったけれど、
hostport = host [ ":" port ]
host = hostname | IPv4address
hostname = *( domainlabel "." ) toplabel [ "." ]
domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
toplabel = alpha | alpha *( alphanum | "-" ) alphanum
RFC 3986 で変わって許されるようになったんですね。とりあえず対処を入れます。
authority = [ userinfo "@" ] host [ ":" port ]
host = IP-literal / IPv4address / reg-name
reg-name = *( unreserved / pct-encoded / sub-delims )
元々、DNS的ドメイン名は RFC-1123 で「ホスト名の最初が英文字だけ」とい
う制限を外しているので、 RFC-2936 の定義がそれを失念してたという感じじゃ
ないでしょうか。変わったというより、誤りを正したという感じで。
--
神戸 隆博 (かんべ たかひろ) at 仕事場
=end
Updated by naruse (Yui NARUSE) almost 14 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r30089.
Kouhei, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end