summaryrefslogtreecommitdiff
path: root/test/webrick/test_filehandler.rb
AgeCommit message (Collapse)Author
2020-12-10Move webrick library into internal test toolchainHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/3729
2020-09-24[ruby/webrick] Manually pick commit from upstream repoHiroshi SHIBATA
Fix test when run with US-ASCII encoding https://github.com/ruby/webrick/commit/f402aafb36bbd43be54621405da550643a1a1a4c
2020-09-24[ruby/webrick] Do not use ensure in a block without beginJeremy Evans
This syntax is not supported until Ruby 2.5, and Webrick still targets Ruby 2.3+. https://github.com/ruby/webrick/commit/fbe85b885f
2020-06-22Add tests of nested multibyte path and DirectoryIndexKazuhiro NISHIYAMA
2020-06-20Use section sign instead of Hiragana Letter AKazuhiro NISHIYAMA
It can convert to Windows-1252and Windows-31J. ``` "\u00a7".encode("Windows-1252") #=> "\xA7" "\u00a7".encode("Windows-31J") #=> "\x{8198}" ``` https://github.com/ruby/ruby/runs/788357527?check_suite_focus=true#step:14:959 ``` 1) Failure: WEBrick::TestFileHandler#test_cjk_in_path [D:/a/ruby/ruby/src/test/webrick/utils.rb:72]: exceptions on 2 threads: webrick log start: [2020-06-19 14:49:38] ERROR Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and Windows-1252 D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:341:in `+' D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:341:in `set_filename' D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:310:in `exec_handler' D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:245:in `do_GET' D:/a/ruby/ruby/src/lib/webrick/httpservlet/abstract.rb:105:in `service' D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:241:in `service' D:/a/ruby/ruby/src/lib/webrick/httpserver.rb:140:in `service' D:/a/ruby/ruby/src/lib/webrick/httpserver.rb:96:in `run' D:/a/ruby/ruby/src/lib/webrick/server.rb:307:in `block in start_thread' ```
2020-06-19Use filesystem encoding as FileHandler's encodingKazuhiro NISHIYAMA
instead of `@root.encoding`. And fallback to ASCII-8BIT when filesystem encoding is US-ASCII. When `@root.encoding` is not compatible filesystem encoding, `Encoding::CompatibilityError` raised at `webrick/httpservlet/filehandler.rb:341`. So `DocumentRoot` must be compatible with filesystem encoding.
2020-06-19Fix failure on mswin CIKazuhiro NISHIYAMA
https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20200619T054159Z.fail.html.gz ``` 1) Failure: WEBrick::TestFileHandler#test_cjk_in_path [D:/tmp/mswin-build20200619-14304-utgij/ruby/test/webrick/utils.rb:72]: exceptions on 2 threads: webrick log start: [2020-06-19 16:28:42] ERROR `/あ.txt' not found. webrick log end Filesystem encoding is Windows-31J. <"200"> expected but was <"404">. --- <[]> expected but was <["[2020-06-19 16:28:42] ERROR `/\xE3\x81\x82.txt' not found.\n"]>. ``` `prevent_directory_traversal` treats `path_info` as filesystem encoding. So path_info should be filesystem encoding in request URL. On some environments, fallback to ASCII-8BIT when EncodingError.
2020-06-18lib/webrick/httpservlet/filehandler.rb: always handle a path as UTF-8Yusuke Endoh
https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20200618T113134Z.fail.html.gz ``` 1) Failure: WEBrick::TestFileHandler#test_cjk_in_path [D:/tmp/mswin-build20200618-84004-1t0dh8f/ruby/test/webrick/utils.rb:72]: exceptions on 2 threads: webrick log start: [2020-06-18 22:18:07] ERROR `/??.txt' not found. webrick log end Filesystem encoding is Windows-31J. <"200"> expected but was <"404">. ```
2020-06-18Read in ASCII-8BIT to get rid of invalid encoding errorNobuyoshi Nakada
2020-06-18test/webrick/test_filehandler.rb: implicitly fall back to UTF-8Yusuke Endoh
https://ci.appveyor.com/project/ruby/ruby/builds/33588714/job/hcgin7xo3sarr0r2 ``` 2) Failure: WEBrick::TestFileHandler#test_cjk_in_path [D:/a/ruby/ruby/src/test/webrick/utils.rb:72]: exceptions on 1 threads: U+3042 to WINDOWS-1252 in conversion from UTF-8 to WINDOWS-1252 ```
2020-06-18test/webrick/test_filehandler.rb: remove unused variableYusuke Endoh
2020-06-18test/webrick/test_filehandler.rb: no `.encode("filesystem")` if US-ASCIIYusuke Endoh
http://ci.rvm.jp/logfiles/brlog.trunk-theap-asserts.20200618-002305 ``` I, [2020-06-18T00:28:11.661066 #31625] INFO -- : 1) Failure: I, [2020-06-18T00:28:11.661157 #31625] INFO -- : WEBrick::TestFileHandler#test_cjk_in_path [/tmp/ruby/v3/src/trunk-theap-asserts/test/webrick/utils.rb:72]: I, [2020-06-18T00:28:11.661216 #31625] INFO -- : exceptions on 1 threads: I, [2020-06-18T00:28:11.661269 #31625] INFO -- : U+3042 from UTF-8 to US-ASCII ```
2020-06-18test/webrick/test_filehandler.rb: Second try to fix the CI errorYusuke Endoh
93e6fa1d319d19ce7fba37e4b9924862447b9f38 failed to fix the issue. I suspect that the request path must be encoded as filesystem encoding.
2020-06-17Show filesystem encoding in failure messageKazuhiro NISHIYAMA
`test_cjk_in_path` failed on mswinci yet. https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20200616T192319Z.fail.html.gz ``` 1) Failure: WEBrick::TestFileHandler#test_cjk_in_path [D:/tmp/mswin-build20200617-120024-1brdn58/ruby/test/webrick/utils.rb:72]: exceptions on 2 threads: webrick log start: [2020-06-17 06:12:53] ERROR `/あ.txt' not found. webrick log end. <"200"> expected but was <"404">. --- <[]> expected but was <["[2020-06-17 06:12:53] ERROR `/\xE3\x81\x82.txt' not found.\n"]>. ```
2020-06-11[ruby/webrick] Fix httpd error in CJK directoryKazuhiro NISHIYAMA
[Bug #16753] https://github.com/ruby/webrick/commit/83cf440858
2020-02-29restore server[:DocumentRootOptions] setting.Koichi Sasada
Surprisingly (at least for me), `server[:DocumentRootOptions]` on Webrick is global information and it affect the result of test_short_filename. Random order test fails because of global information change. I doubt it is bug, but to fix random order test, I restore the value.
2020-02-13support multi-run test for test/webrick/test_filehandler.rbS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/2896
2019-11-30[ruby/webrick] Check the feature by itself, instead of the version numberNobuyoshi Nakada
https://github.com/ruby/webrick/commit/79d7922de9
2019-11-30[ruby/webrick] Allow WEBrick::HTTPServlet::CGIHandler :CGIInterpreter option ↵Jeremy Evans
to be array This way you don't need to escape each entry. Implements Ruby Feature 15170. https://github.com/ruby/webrick/commit/d8086e600c
2019-10-24[ruby/webrick] after ruby-2.6.0, set Net::HTTP#write_timeoutthekuwayama
https://github.com/ruby/webrick/commit/3b51f6b4d2
2019-06-06test/webrick/test_filehandler.rb: extend the timeout for Solaris CIYusuke Endoh
https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20190602T031908Z.fail.html.gz
2018-10-05Use binread because webrick also uses binreadnaruse
Reported-by: MSP-Greg [Bug #15203] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28test/webrick/test_filehandler.rb: stricter multipart range testnormal
We need to ensure we generate compatibile output in the face of future changes * test/webrick/test_filehandler.rb (test_make_partial_content): check response body git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick: use IO.copy_stream for single range responsenormal
This is also compatible with range responses generated by Rack::File (tested with rack 2.0.3). * lib/webrick/httpresponse.rb (send_body_io): use Content-Range * lib/webrick/httpservlet/filehandler.rb (make_partial_content): use File object for the single range case * test/webrick/test_filehandler.rb (get_res_body): use send_body to test result git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22webrick: add test for WEBrick::HTTPServlet::ERBHandlernormal
This previously had no coverage. * test/webrick/test_filehandler.rb (test_erbhandler): new test * test/webrick/webrick.rhtml: new file for test [Misc #14216] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-05leakchecker.rb: remove temporary measurenobu
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#watcher): make watcher thread restartable. * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#terminate): new method to terminate watcher thread. * test/lib/leakchecker.rb (LeakChecker#find_threads): revert r46941. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14test_filehandler.rb: fix UNC path failurenobu
* test/webrick/test_filehandler.rb (test_short_filename): pass document root path to cmd.exe instead of chdir there, as cmd.exe does not start on UNC path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-06* test/webrick/test_filehandler.rb: on vboxsf (on VirtualBoxko1
on Windows 7), file name and permissions are strange (can access by short file name and so on). Simply skip on such tests on such FS. To detect strange FS, this patch use a part of code `File.executable?(__FILE__)`. Please correct them if there are better ways. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09* test/open-uri: Test server log in server thread.akr
* test/webrick: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09* test/webrick: Fix the argument order of assert_equal.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-30Close FDs.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-18* test/socket/test_addrinfo.rb: remove unused variables.hsbt
* test/socket/test_nonblock.rb: ditto. * test/socket/test_socket.rb: ditto. * test/socket/test_unix.rb: ditto. * test/testunit/test_parallel.rb: ditto. * test/webrick/test_filehandler.rb: ditto. * test/xmlrpc/test_features.rb: ditto. * test/zlib/test_zlib.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21test_filehandler.rb: fix for non-NTFSnobu
* test/webrick/test_filehandler.rb (test_script_disclosure): Alternate Data Stream is available only on NTFS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21test_filehandler.rb: reap zombienobu
* test/webrick/test_filehandler.rb (test_short_filename): use backtick to reap zombie, instead of leaving opened stream after reading. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-16* test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there areusa
no guarantee of existance of RbConfig::CONFIG['LIBPATHENV']. it only exists in Unix-like environments. * test/webrick/test_filehandler.rb (WEBrick::TestFileHandler#test_script_disclosure): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-12* test/webrick/test_cgi.rb (class TestWEBrickCGI): respectkosaki
RbConfig::CONFIG["LIBPATHENV"]. [Bug #5135] [ruby-core:38653] * test/webrick/test_filehandler.rb (class WEBrick): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-29* test/webrick/test_filehandler.rbusa
(WEBrick::TestFileHandler#test_short_filename): the cgi doesn't exist on current directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-28* test/webrick/test_filehandler.rb (test_short_filename):arton
read real short filename by cmd because smb mounted files have different naming convention. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-14Reduced gem_prelude to just require rubygems. Reviewed by Evan Phoenixryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12Simple fix for emacs parsing. (emacs doesn't like _heredocs_)ryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02use require_relative.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-18* lib/webrick/httpservlet/filehandler.rb (make_partial_content):nobu
add bytes-unit. [ruby-dev:40030] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12* test/ruby/envutil.rb (EnvUtil#rubybin): fake also rbconfig.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29* test/webrick/utils.rb (start_server): provide a reference to log ofmame
webrick. * test/webrick/test_httpproxy.rb, test/webrick/test_httpauth.rb, test/webrick/test_cgi.rb, test/webrick/test_httpserver.rb, test/webrick/test_server.rb, test/webrick/test_filehandler.rb: use webrick log as an assertion message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-18* lib/webrick/httpservlet/filehandler.rb: should normalize pathgotoyuzo
name in path_info to prevent script disclosure vulnerability on DOSISH filesystems. (fix: CVE-2008-1891) Note: NTFS/FAT filesystem should not be published by the platforms other than Windows. Pathname interpretation (including short filename) is less than perfect. * lib/webrick/httpservlet/abstract.rb (WEBrick::HTTPServlet::AbstracServlet#redirect_to_directory_uri): should escape the value of Location: header. * lib/webrick/httpservlet/cgi_runner.rb: accept interpreter command line arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-03* lib/webrick/httpservlet/filehandler.rb: should normalize pathgotoyuzo
separators in path_info to prevent directory traversal attacks on DOSISH platforms. reported by Digital Security Research Group [DSECRG-08-026]. * lib/webrick/httpservlet/filehandler.rb: pathnames which have not to be published should be checked case-insensitively. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-03* eval.c: unify ruby_class (for method definition) and ruby_cbasematz
(for constant reference). * eval.c (rb_call0): use TMP_ALLOC() instead of allocating a temporary array object. * eval.c (eval): need not to protect $SAFE value. [ruby-core:07177] * error.c (Init_Exception): change NameError to direct subclass of Exception so that default rescue do not handle it silently. * struct.c (rb_struct_select): update RDoc description. [ruby-core:7254] * numeric.c (int_upto): return an enumerator if no block is attached to the method. * numeric.c (int_downto): ditto. * numeric.c (int_dotimes): ditto. * enum.c (enum_first): new method Enumerable#first to take first n element from an enumerable. * enum.c (enum_group_by): new method Enumerable#group_by that groups enumerable values according to their block values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-07* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_service):gotoyuzo
should delete trailing LF from the result of pack("m*"). * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_connect): - should delete trailing LF from the result of pack("m*"). - clear Request-Line not to send the sesponse by HTTPServer#run. * lib/webrick/httputils (WEBrick::HTTPUtils.parse_qvalues): refine regexp (and change the name of a local variable). * lib/webrick/server.rb (WEBrick::Daemon.start): prepared stdio don't allow changing its mode. * test/webrick/*, sample/webrick/httpproxy.rb: add new files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e