aboutsummaryrefslogtreecommitdiffstats
path: root/lib/webrick/utils.rb
Commit message (Collapse)AuthorAgeFilesLines
* webrick: use monotonic clock for timeoutsnormal2016-10-141-2/+3
| | | | | | | | | | The monotonic clock is immune to system time changes and a better option for implementing timing comparisons. * lib/webrick/utils.rb (TimeoutHandler): use monotonic clock (watch): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use qualified namesnobu2016-08-301-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* leakchecker.rb: remove temporary measurenobu2016-01-051-7/+31
| | | | | | | | | | | | | * 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
* webrick/utils.rb: get rid of thread leak checkernobu2015-12-191-2/+3
| | | | | | | | | | | | | * 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
* * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): To preventngoto2015-12-181-6/+8
| | | | | | | | 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
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | 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
* * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): Acquirengoto2015-12-151-21/+22
| | | | | | | | 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
* * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):ngoto2015-12-151-9/+14
| | | | | | | | | | 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
* webrick/utils.rb: wakeup immediatelynobu2015-07-141-3/+7
| | | | | | | * 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
* webrick/utils.rb: adaptive sleepnobu2015-07-141-4/+12
| | | | | | | * 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
* lib/webrick/utils.rb: simplify by avoiding fcntlnormal2015-05-171-9/+3
| | | | | | | | | | | | | | | | 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
* * lib/webrick/utils.rb: removed unused argument variable.hsbt2015-01-021-1/+1
| | | | | | | | | [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
* webrick/utils.rb: mark by class namenobu2014-07-021-3/+2
| | | | | | | * 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
* * lib/webrick/utils.rb (create_listeners): Close socket objects.akr2014-06-281-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb: Override the inspect method of the threadakr2014-05-251-0/+3
| | | | | | | | used in WEBrick::Utils::TimeoutHandler. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb: Don't rescue LoadError for 'etc' extension.akr2014-04-251-6/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/fileutils.rb (fu_get_uid, fu_get_gid): Etc.getpwnam/getgrnam mayusa2014-04-241-2/+1
| | | | | | | | | 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
* * lib/webrick/utils.rb: use Socket.tcp_server_sockets to create serverakr2013-03-021-19/+4
| | | | | | | | | sockets. fix [Bug #7100] https://bugs.ruby-lang.org/issues/7100 reported by sho-h (Sho Hashimoto). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/accesslog.rb: Improved WEBrick documentation.drbrain2013-01-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/webrick/cgi.rb: ditto. * lib/webrick/config.rb: ditto. * lib/webrick/cookie.rb: ditto. * lib/webrick/httpauth/authenticator.rb: ditto. * lib/webrick/httpauth/basicauth.rb: ditto. * lib/webrick/httpauth/digestauth.rb: ditto. * lib/webrick/httpproxy.rb: ditto. * lib/webrick/httprequest.rb: ditto. * lib/webrick/httpresponse.rb: ditto. * lib/webrick/https.rb: ditto. * lib/webrick/httpserver.rb: ditto. * lib/webrick/httpservlet/cgihandler.rb: ditto. * lib/webrick/httpservlet/filehandler.rb: ditto. * lib/webrick/httpservlet/prochandler.rb: ditto. * lib/webrick/httputils.rb: ditto. * lib/webrick/httpversion.rb: ditto. * lib/webrick/log.rb: ditto. * lib/webrick/server.rb: ditto. * lib/webrick/ssl.rb: ditto. * lib/webrick/utils.rb: ditto. * lib/webrick/version.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): get keysnaruse2012-04-071-1/+3
| | | | | | | and fetch values from it to prevent @timeout_info's error "can't add a new key into hash during iteration". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): dup to preventnaruse2012-03-311-1/+1
| | | | | | @timeout_info's "can't add a new key into hash during iteration". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb: fix fcntl call.akr2011-11-011-1/+1
| | | | | | | | * lib/drb/unix.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb: Document WEBrick::Utils. Patch by Olivierdrbrain2011-06-161-1/+67
| | | | | | | Brisse. [Ruby 1.9 - Bug #4819] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * {ext,lib,test}/**/*.rb: removed trailing spaces.nobu2009-03-061-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#do_CONNECT):matz2008-11-081-1/+1
| | | | | | | | | | | | use #bytesize instead of #size. a patch submitted from raspberry lemon in [ruby-core:18571]. * lib/webrick/httpauth/digestauth.rb, lib/webrick/httpproxy.rb, lib/webrick/httprequest.rb, lib/webrick/httpservlet/cgi_runner.rb, lib/webrick/httpservlet/abstract.rb, lib/webrick/httpresponse.rb, lib/webrick/httpservlet/cgihandler.rb, lib/webrick/utils.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):gotoyuzo2007-01-041-1/+1
| | | | | | | Arrays could not be modified in its each block. [ruby-dev:30063] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Merge YARVko12006-12-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/config.rb (WEBrick::Config::HTTP): add new parameters,gotoyuzo2006-05-181-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | :InputBufferSize and :OutputBufferSize. * lib/webrick/utils.rb (WEBrick::Utils.timeout): add new timeout method. this implementation is expected to be compatible with timeout.rb and faster than timeout.rb. * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#_read_data): Timeout.timeout is replaced by WEBrick::Utils.timeout. * lib/webrick/httprequest.rb: WEBrick::HTTPRequest::BUFSIZE is replaced by config[:InputBufferSize]. * lib/webrick/httpresposne.rb: WEBrick::HTTPResponse::BUFSIZE is replaced by config[:OutputBufferSize]. * lib/webrick/server.rb: get rid of unnecessary require. * test/webrick/test_utils.rb: test for WEBrick::Utils.timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/server.rb (WEBrick::GenericServer#accept_client):gotoyuzo2005-07-141-0/+8
| | | | | | | | | sockets should be non-blocking mode. [ruby-dev:26405] * lib/webrick/utils.rb (WEBrick::Utils.set_non_blocking): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* *** empty log message ***gotoyuzo2005-03-231-2/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/utils.rb (Utils::su): use setgid and setuid togotoyuzo2003-09-281-8/+8
| | | | | | | | set real and effective IDs. and setup group access list by initgroups. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick/ssl.rb: new file; SSL/TLS enhancement for GenericServer.gotoyuzo2003-08-191-0/+24
| | | | | | | | | | | | | | | | | | | | | | * lib/webrick/https.rb: SSLSocket handling is moved to webrick/ssl.rb. * lib/webrick/compat.rb (File::fnmatch): remove old migration code. * lib/webrick/httpserver.rb (HTTPServer#run): ditto. * lib/webrick/server.rb (GenericServer#listen): the body of this method is pull out as Utils::create_lisnteners. * lib/webrick/utils.rb (Utils::create_lisnteners): new method. * lib/webrick/server.rb (GenericServer#start): should not through unknown errors. and refine comments. * ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): should close socket if SSLSocket raises error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/webrick: imported.gotoyuzo2003-07-231-0/+64
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e