Граф коммитов

220 Коммитов

Автор SHA1 Сообщение Дата
nobu 4b298ad77a Use qualified names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 06:22:30 +00:00
naruse bfe6bd0f72 * lib/webrick/config.rb (WEBrick::Config::General):
disable reverse lookup by default. [ruby-core:45514] [Feature #6559]
  Socket.do_not_reverse_lookup is true by default but WEBrick
  overwrote it.
  patch by Eric Hodel [ruby-core:45527]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-12 12:08:13 +00:00
normal dafeebf12d webrick: filter out HTTP_PROXY for CGIHandler
* lib/webrick/httpservlet/cgihandler.rb (do_GET): delete HTTP_PROXY
* test/webrick/test_cgi.rb (test_cgi_env): new test
* test/webrick/webrick.cgi (do_GET): new endpoint to dump env
  [ruby-core:76511] [Bug #12610]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-22 16:43:12 +00:00
nobu 978ee6d1ef Multiple values X-Forwarded-Proto in webrick
* lib/webrick/httprequest.rb (setup_forwarded_info): Use the first
  value in X-Forwarded-Proto, if header contains multiple comma
  separated values.  Some middlewares may add these values to the
  list, not replacing.  [Fix GH-1386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 10:32:26 +00:00
hsbt a6e805f75e * lib/webrick/ssl.rb: Accept string value for SSLCertName. It is used
to invoke ssl server with command line.
  [fix GH-1329] Patch by @kerlin
* test/webrick/test_ssl_server.rb: Added test for GH-1329

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-07 13:37:18 +00:00
hsbt 8a77a41fc3 * lib/webrick/ssl.rb: Support to add SSLCiphers option.
[fix GH-1321] Patch by @rhadoo

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 01:51:18 +00:00
hsbt c2355aefc9 * lib/webrick/httpresponse.rb: Move error_body to method. It allow to
override the body more easily. [fix GH-1307]
* test/webrick/test_httpresponse.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-29 03:45:32 +00:00
hsbt 65793c9c17 * lib/webrick/httpservlet/filehandler.rb: fix documentation for namespace.
[fix GH-1219][ci skip] Patch by @leafac

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-25 00:33:17 +00:00
normal 778bbac8ac stdlib: avoid extra calls to eliminate "\n" from Base64
We may use the '0' (zero) to avoid adding the line feed.
Furthermore, the '*' (asterisk) modifier is not needed for
a single-element arrays.

* ext/psych/lib/psych/visitors/yaml_tree.rb (visit_String):
  eliminate chomp
* lib/net/http.rb (connect): eliminate delete
* lib/net/http/header.rb (basic_encode): ditto
* lib/net/imap.rb (authenticate): eliminate gsub
  (self.encode_utf7): shorten delete arg
* lib/net/smtp.rb (base64_encode): eliminate gsub
* lib/open-uri.rb (OpenURI.open_http): eliminate delete
* lib/rss/rss.rb: ditto
* lib/securerandom.rb (base64): ditto
  (urlsafe_base64): eliminate delete!
* lib/webrick/httpauth/digestauth.rb (split_param_value):
  eliminate chop
* lib/webrick/httpproxy.rb (do_CONNECT): eliminate delete
  (setup_upstream_proxy_authentication): ditto
  [ruby-core:72666] [Feature #11938]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10 00:35:43 +00:00
nobu 8d66627161 leakchecker.rb: remove temporary measure
* 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
2016-01-05 06:09:17 +00:00
hsbt 27f00a7a22 * lib/webrick/httpstatus.rb: Added HTTP 451 Status Code.
[fix GH-1167] Patch by @MuhammetDilmac
  https://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 11:45:52 +00:00
nobu a5a9d421e7 webrick/utils.rb: get rid of thread leak checker
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
  use WEBrick::Utils::TimeoutHandler::Thread, which is ignored by
  LeakChecker#find_threads, instead of ::Thread to get rid of
  thread leak checker.  since this TimeoutHandler is resident
  during tests because of Singleton, it waits for the next timeout
  if it has any schedules.  in the case of nested timeouts, inner
  timeout does not cancel outer timeouts and then those schedules
  still remain.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19 08:16:54 +00:00
ngoto 0967c1e3ad * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): To prevent
potential deadlocks, Queue is used to tell update of @timeout_info
  instead of sleep and wakeup. [Bug #11742] [ruby-dev:49387]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18 12:32:53 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
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-12-16 05:07:31 +00:00
ngoto e337dc6517 * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): Acquire
TimeoutMutex only when accessing @timeout_info for avoiding
  potential deadlock. [Bug #11742] [ruby-dev:49387]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15 16:03:00 +00:00
ngoto 804720d2eb * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
TimeoutMutex should be acquired when accessing @timeout_info.
  To avoid deadlock, interrupt() calls are delayed.
  Due to the mutex, it is safe to treat ary without ary.dup.
  [Bug #11742] [ruby-dev:49387]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15 15:26:47 +00:00
hsbt ab23398461 * lib/webrick/httpauth/basicauth.rb: fix a typo.
[ci skip][fix GH-1099] Patch by @jwworth
* lib/webrick/httpauth/digestauth.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-16 03:11:20 +00:00
hsbt 2ded8d0698 * lib/webrick/server.rb: use IO::NULL instead of '/dev/null'
* test/ruby/test_string.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-27 09:05:48 +00:00
nobu 7d909eb218 webrick/utils.rb: wakeup immediately
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#register):
  notify the handler thread of new timeout registration.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 02:22:51 +00:00
nobu 8f6fed850a webrick/utils.rb: adaptive sleep
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
  make sleep intervals adaptive than fixed period intervals.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 02:21:53 +00:00
nobu 77cde58d39 webrick/server.rb: stop immediately
* lib/webrick/server.rb (WEBrick::GenericServer#start): flush
  shutdown pipe.
* lib/webrick/server.rb (WEBrick::GenericServer#stop): request the
  server to stop immediately by sending data via shutdown pipe.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 02:20:16 +00:00
nobu f162f2073b httpproxy.rb: fix typos [ci skip]
* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#do_CONNECT):
  fix typos in debugger statements.  [Fix GH-967]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13 14:58:12 +00:00
normal 29a914ff2e lib/webrick/utils.rb: simplify by avoiding fcntl
IO#nonblock= and IO#close_on_exec= methods are simpler-to-use
and potentially more portable to for future OSes.
IO#nonblock= and IO#close_on_exec= are also smart enough to avoid
redundantly setting flags so a syscall may be avoided.

These methods could probably be removed entirely and inlined, but
it's unclear if there is 3rd-party code which relies on them.

* lib/webrick/utils.rb (set_non_blocking): use IO#nonblock=
* (set_close_on_exec): use IO#close_on_exec=
  [Feature #11136]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17 08:22:11 +00:00
normal ce34a90fb5 lib/webrick/server.rb: avoid redundant fcntl call
Sockets are close-on-exec by default since Ruby 2.0, so it
is redundant to set it again.

* lib/webrick/server.rb (accept_client): avoid redundant fcntl call
  [Feature #11137]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17 05:59:08 +00:00
normal 84b012e02a stdlib: use IO#wait_*able instead of IO.select when possible
In case a process encounters high-numbered FDs, this allows
consistent performance on systems with ppoll support.
[ruby-core:35572]

* ext/socket/lib/socket.rb (connect_nonblock): use IO#wait_writable
* lib/drb/drb.rb (DRB::DRbTCPSocket#alive?): use IO#wait_readable
* lib/webrick/httpserver.rb (run): ditto
* lib/resolv.rb (request): ditto for single socket case
  [ruby-core:68943] [Feature #11081]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-06 20:30:43 +00:00
hsbt 7d75a78604 * lib/webrick/server.rb: Fix regression bug in WEBrick's
:DoNotReverseLookup config option implementation.
  [fix GH-731] Patch by @vais
* test/webrick/test_do_not_reverse_lookup.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-16 08:43:28 +00:00
akr ab0a64e1c8 * lib/webrick/server.rb: Invoke setup_shutdown_pipe in start method
instead of listen method.
  [ruby-core:68476] [Bug #10956] Reported by Shintaro Kojima.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10 11:05:21 +00:00
hsbt 73fc0cc572 * lib/webrick/utils.rb: removed unused argument variable.
[fix GH-356] Patch by @vipulnsward
* lib/webrick/server.rb: ditto.
* lib/webrick/ssl.rb: ditto.
* test/webrick/test_utils.rb: added test for WEBrick::Utils#create_listeners.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-02 06:53:12 +00:00
akr 33bb38a644 * lib/webrick/server.rb: Setup shutdown pipe in listen method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-10 11:05:00 +00:00
akr 230fb3ceae * lib/webrick/server.rb: Less instance variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-10 03:46:22 +00:00
akr e62fe866e5 * lib/webrick/server.rb (shutdown): Use close() on @shutdown_pipe_w to
notify readability on the read side of the pipe.
  write_nonblock() is not usable for pipe on Windows.
  (cleanup_shutdown_pipe): Rescue IOError for @shutdown_pipe_w.close.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-10 03:20:06 +00:00
akr 2a9ea11355 * lib/webrick/server.rb (initialize): Initialize shutdown pipe here
to avoid race condition.
  (cleanup_shutdown_pipe): New private method.
  (cleanup_listener): Extracted from shutdown method.
  Call this method from start method to avoid race condition.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09 23:03:40 +00:00
akr 0d07bc203c * lib/webrick/httpstatus.rb: require webrick/accesslog for AccessLog.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09 13:29:08 +00:00
akr a0e4956dce * lib/webrick/server.rb: Stop lisntner loop properly.
[ruby-core:66085] [Bug #10478] Fixed by Charles Nutter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-05 10:24:53 +00:00
normal 9bb7dfa247 normalize reference to Timeout::Error
From: John Bachir <j@jjb.cc>

* bootstraptest/test_io.rb (assert_finish):
  normalize rescue for Timeout::Error
* lib/net/ftp.rb (Net#read_timeout): ditto for doc
* lib/resolv.rb (Resolv::ResolvTimeout): ditto for subclass
* lib/webrick/httprequest.rb (_read_data): ditto for rescue
* sample/timeout.rb (p timeout): ditto for call
* test/drb/drbtest.rb (test_06_timeout): ditto
* test/ruby/test_readpartial.rb (test_open_pipe): ditto
* test/thread/test_queue.rb (test_queue_thread_raise): ditto
* thread.c (rb_thread_s_handle_interrupt): ditto for doc
  [ruby-core:65481] [misc #10339]

TimeoutError is a legacy constant, Timeout::Error is the canonical constant.
This patch normalizes all code and comments to reference Timeout::Error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-07 20:00:09 +00:00
hsbt 67b5e1084b * lib/webrick/httpproxy.rb: remove needless condition
for old ruby version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-08 05:34:48 +00:00
nobu ed762c0be1 webrick/utils.rb: mark by class name
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler::Thread):
  use particular class to mark by the class name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-02 06:26:02 +00:00
akr 8b76d21f55 * lib/webrick/utils.rb (create_listeners): Close socket objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-28 06:33:44 +00:00
hsbt c9134128cb * lib/webrick/httpproxy.rb: remvoe useless assigned variables.
* lib/webrick/httpservlet/cgihandler.rb: ditto.
* lib/webrick/httpservlet/erbhandler.rb: ditto.
* lib/webrick/server.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-26 09:05:58 +00:00
hsbt 4f7449beba * lib/gserver.rb: remove redundant use of to_s in interpolation.
* lib/logger.rb: ditto.
* lib/optparse.rb: ditto.
* lib/rbconfig/obsolete.rb: ditto.
* lib/resolv.rb: ditto.
* lib/webrick/httpresponse.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-24 08:48:46 +00:00
akr 6f226d9d42 * lib/webrick/server.rb: Use a pipe to detect server shutdown.
shutdown() or close() for listening socket is not a reliable.
  Actually, both doesn't work (doesn't wake up select()) on
  DragonFly BSD 3.6.2.

* test/webrick/utils.rb: :ShutdownSocketWithoutClose is not required
  now to immediate server shutdown detection.
  This fixes fd leaks.

* test/net/http/utils.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-30 12:32:48 +00:00
akr 9e0b0731ed * lib/webrick/utils.rb: Override the inspect method of the thread
used in WEBrick::Utils::TimeoutHandler.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 06:27:14 +00:00
nobu 719804b5df webrick/httpserver.rb: Stop handling requests on shutdown
* lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): stop
  handling requests on shutdown, even if the socket is readable
  and IO.select() returns true.  [Fixes GH-607]
* lib/webrick/server.rb (WEBrick::GenericServer#start): IO.select()
  raises ENOTSOCK on shutdown on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-08 01:17:07 +00:00
akr 2f60d08519 * lib/webrick/utils.rb: Don't rescue LoadError for 'etc' extension.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-25 10:17:15 +00:00
usa 3c00fe9f41 * lib/fileutils.rb (fu_get_uid, fu_get_gid): Etc.getpwnam/getgrnam may
returns nil.

* lib/webrick/utils.rb (su): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 14:19:21 +00:00
nobu 14922c7033 httpservlet/filehandler.rb: pass queries
* lib/webrick/httpservlet/filehandler.rb (set_dir_list): pass the
  given queries to subdirectories.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-12 09:01:30 +00:00
a_matsuda 69dbf68bbb * lib/webrick/ssl.rb: [DOC] Fix typo
s/willbe/will be/
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25 05:10:12 +00:00
a_matsuda e1db3605fd * ext/win32ole/sample/olegen.rb: Fix typo
* ext/openssl/ossl_asn1.c:  [DOC] Fix typo
* lib/webrick/accesslog.rb:  ditto
* template/yarvarch.ja:  ditto

s/recieve/receive/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-11 03:58:07 +00:00
a_matsuda c52eadeb77 * lib/webrick/httpstatus.rb: [DOC] Fix typo
s/sucess/success/
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 04:34:35 +00:00
hsbt 86d6d4d57c * lib/webrick/compat.rb, lib/xmlrpc/datetime.rb: [DOC] fix typo by @vipulnsward [fix GH-464]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-06 02:10:11 +00:00