summaryrefslogtreecommitdiff
path: root/lib/webrick
AgeCommit message (Collapse)Author
2017-10-05webrick: avoid unnecessary IO#sync= callnormal
Sockets and pipes are always created with FMODE_SYNC flag already set (otherwise many things would be broken). * lib/webrick/server.rb (accept_client): remove unnecessary IO#sync= call git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-05Fixed invalid gemspec.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-05Followed up [ruby-core:83093]. Update gemspec attributes.hsbt
Added metadata for rubygems.org. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19webrick: handle EAGAIN/EWOULDBLOCK on proxy connectionsnormal
* lib/webrick/httpproxy.rb (do_CONNECT): high-level IO methods [ruby-core:82861] [Bug #12130] Patch by: Keisuke NISHI git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-19Define the MIME type for JSON in WEBrick::HTTPUtils::DefaultMimeTypes.hsbt
[Feature #10798][ruby-core:67879] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15To use github url for gemspec.hsbt
[Bug #13906][ruby-core:82817] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14lib/webrick/log.rb: sanitize any type of logsmame
It had failed to sanitize some type of exception messages. Reported and patched by Yusuke Endoh (mame) at https://hackerone.com/reports/223363 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-18webrick: fix SNI supportnormal
* lib/webrick/https.rb: check ssl context of virtual host. * lib/webrick/ssl.rb: ensure to return ssl context. * test/webrick/test_https.rb: test returned cert is correct. [Feature #13729][ruby-dev:50173] Author: Tietew <tietew@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-07webrick: add Server Name Indication (SNI)normal
* lib/webrick/https.rb: servername_cb implementation. * lib/webrick/ssl.rb: abstract servername_cb. * test/webrick/test_https.rb: test. [ruby-dev:50165] [Feature #13729] Author: Tietew <tietew@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-19Make string literal to frozen object on gemspec of defulte gems.hsbt
Added following gemspecs. * extensions: date, dbm, etc, fiddle, gdbm, sdbm, stringio, strscan, zlib * pure ruby libraries: cmath, csv, fileutils, scanf, webrick psych and rdoc is out of scope of this commit. I will merge after upstream was change to `frozen_string_literal: true`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-01Merge gemspec from ruby/webrick.hsbt
* Bump version to 1.4.0.beta1. Because https://rubygems.org/gems/webrick is already reserved old version of webrick. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-25Import gemspechsbt
Import gemspec and test file from ruby/webrick. * webrick.gemspec: Update files and dependency for standalone gem. * test/webrick/utils.rb: Added explicitly loading of EnvUtil for test suite without ruby core test suite. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-07Fix a required ruby version on gemspec of gemified libraries.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31Initial commit for gem release of webrick.hsbt
[Feature #13173] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07Delay Utils.getservername until needed.shugo
There is no need to call Utils.getservername when the :ServerName option is specified, so delay Utils.getservername until needed to avoid unnecessary DNS lookups. [ruby-core:78492] [Bug #13007] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-23webrick/server: use symbol procnormal
Symbol proc is less code and avoids confusion from variable naming. * lib/webrick/server.rb (shutdown): use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22Use `&.` and `||=` instead of if guardsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22IOError does not happenkazu
* IOError does not happen even if another thread closes io * Use symbol proc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22webrick/server: simplify Daemon.startnormal
Process.daemon exists since Ruby 1.9.1 and does most of what we need. * lib/webrick/server.rb (Daemon.start): simplify [Misc #12937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-21lib/*: remove closed checksnormal
Follow r56795. Since Ruby 2.2, calling #close on a closed socket no longer raises exceptions. * lib/cgi/session.rb (update): remove closed? check * lib/net/http.rb (finish, transport_request): ditto * lib/net/imap.rb (disconnect): ditto * lib/net/pop.rb (do_start, do_finish): ditto * lib/net/smtp.rb (do_start, do_finish): ditto * lib/open3.rb (popen_run, pipeline_run): ditto * lib/pstore.rb (transaction): ditto * lib/shell/process-controller.rb (sfork): * lib/tempfile (_close, call, Tempfile.create): ditto * lib/webrick/httpauth/htdigest.rb (flush): ditto * lib/webrick/httpauth/htpasswd.rb (flush): ditto * lib/webrick/server.rb (start_thread, cleanup_shutdown_pipe): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14webrick: use monotonic clock for timeoutsnormal
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
2016-09-27* lib/cgi/cookie.rb (parse): don't allow , as a separator. [Bug #12791]naruse
* lib/webrick/cookie.rb (parse): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30Use qualified namesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-12* lib/webrick/config.rb (WEBrick::Config::General):naruse
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-07-22webrick: filter out HTTP_PROXY for CGIHandlernormal
* 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-06-21Multiple values X-Forwarded-Proto in webricknobu
* 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-05-07* lib/webrick/ssl.rb: Accept string value for SSLCertName. It is usedhsbt
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-04-22* lib/webrick/ssl.rb: Support to add SSLCiphers option.hsbt
[fix GH-1321] Patch by @rhadoo git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-29* lib/webrick/httpresponse.rb: Move error_body to method. It allow tohsbt
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-01-25* lib/webrick/httpservlet/filehandler.rb: fix documentation for namespace.hsbt
[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-10stdlib: avoid extra calls to eliminate "\n" from Base64normal
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-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-30* lib/webrick/httpstatus.rb: Added HTTP 451 Status Code.hsbt
[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-19webrick/utils.rb: get rid of thread leak checkernobu
* 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-18* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): To preventngoto
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-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-12-15* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): Acquirengoto
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* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):ngoto
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-11-16* lib/webrick/httpauth/basicauth.rb: fix a typo.hsbt
[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-08-27* lib/webrick/server.rb: use IO::NULL instead of '/dev/null'hsbt
* test/ruby/test_string.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14webrick/utils.rb: wakeup immediatelynobu
* 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-14webrick/utils.rb: adaptive sleepnobu
* 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-14webrick/server.rb: stop immediatelynobu
* 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-13httpproxy.rb: fix typos [ci skip]nobu
* 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-05-17lib/webrick/utils.rb: simplify by avoiding fcntlnormal
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-17lib/webrick/server.rb: avoid redundant fcntl callnormal
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-06stdlib: use IO#wait_*able instead of IO.select when possiblenormal
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-03-16* lib/webrick/server.rb: Fix regression bug in WEBrick'shsbt
: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-10* lib/webrick/server.rb: Invoke setup_shutdown_pipe in start methodakr
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-01-02* lib/webrick/utils.rb: removed unused argument variable.hsbt
[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