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

172 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 45454bdb8b
Prefer Regexp#=~ to Regexp#match when the RHS may be nil 2019-08-19 16:39:42 +09:00
ohbarye b1678338e5
Fix typo: duplicated the [skip-ci] 2019-08-09 16:23:49 -07:00
Semyon Pupkov 4173258fd0
change call CGI methods from :: to .
Closes: https://github.com/ruby/ruby/pull/1749
2019-08-04 09:19:30 +09:00
kazu c01a5ee85e Use delete_prefix instead of `sub(/\Afixed-pattern/, '')`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04 08:22:10 +00:00
nobu 6b1e425144 lib/cgi/util.rb: use require
* lib/cgi/util.rb: reverted r65505.  require_relative does not
  work for cgi/escape.so, as extension libraries are placed in
  other directories than ruby libraries.  [Bug #15206]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-03 05:29:02 +00:00
marcandre e859e668d2 lib/*: Prefer require_relative over require.
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:33 +00:00
kazu b4d935455f Use `&.` instead of modifier if
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-04 13:30:25 +00:00
kazu e03ea9c596 Use printf instead of puts and sprintf
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 15:01:04 +00:00
shyouhei f2a91397fd Add uplevel keyword to Kernel#warn and use it
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.

This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.

This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.

This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.

rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.

From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:56:25 +00:00
kazu 42fbe19fa8 Fix cgi/core code example missing comma
ref https://github.com/rurema/doctree/pull/448
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-02 15:10:38 +00:00
k0kubun e1b4327545 cgi/util.rb: Don't escape tilde in #escape
to make it compatible with ERB::Util.url_encode.

ext/cgi/escape/escape.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 12:34:59 +00:00
nobu 97849e1178 share `@@accept_charset`
* lib/cgi/{core,util}.rb: include CGI::Util not only extending, to
  share `@@accept_charset` class variable, so that it is always
  accessible.  [ruby-core:80986] [Bug #13539]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06 01:33:04 +00:00
kazu fbd5cda6aa {lib,test}/cgi: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-18 05:52:16 +00:00
normal f845a9ef76 lib/*: remove closed checks
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-11-21 23:05:41 +00:00
naruse 5f33c6b0f5 * lib/cgi/cookie.rb (parse): don't allow , as a separator. [Bug #12791]
* lib/webrick/cookie.rb (parse): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 03:17:47 +00:00
hsbt e303695ebd * lib/cgi/util.rb: added to missing quote.
[fix GH-1363][ci skip] Patch by @dwaller

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 01:26:21 +00:00
nobu 20cd25c86f cgi/util.rb: remove CGI::Util#_unescape
* ext/cgi/escape/escape.c (cgiesc_unescape): define unescape
  method instead of _unescape, and should pass the optional
  argument to the super method.
* lib/cgi/util.rb (CGI::Util#_unescape): remove intermediate
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20 08:33:33 +00:00
nobu d463c492bc cgi/escape: Optimize CGI.unescape
* cgi/escape/escape.c: Optimize CGI.unescape performance by C ext
  for ASCII-compatible encodings.  [Fix GH-1250]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-21 04:57:57 +00:00
nobu 8e46f401b2 ASCII-incompatible escape
* lib/cgi/util.rb (escapeHTML, unescapeHTML): consider
  ASCII-incompatible encodings.  [Fix GH-1239]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-06 13:31:07 +00:00
nobu ce7f7f5e3d cgi/escape: Optimize CGI.escapeHTML
* cgi/escape/escape.c: Optimize CGI.escapeHTML for
  ASCII-compatible encodings.  [Fix GH-1164]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20 11:54:54 +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
nobu 16dbb79e88 session.rb: SHA512
* lib/cgi/session.rb (create_new_id): use SHA512 instead of MD5.
  pointed out by SARWAR JAHAN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-03 12:12:14 +00:00
nobu 228cfd02d5 cookie.rb: revert part of r50496
* lib/cgi/cookie.rb (CGI::Cookie#secure): revert part of r50496,
  which is irrelevant to GH-887, as the document states that the
  argument must be a boolean.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15 08:59:33 +00:00
xibbar a4344cb5b4 * lib/cgi/cookie.rb: Implement HttpOnly flag for cookies.
[fix GH-887] Patch by @martinpovolny

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-14 23:27:01 +00:00
nobu 5d071fe381 cookie.rb: trailing comma
* lib/cgi/cookie.rb: add trailing comma for further lines.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-29 13:22:34 +00:00
hsbt ffc068c9bb * lib/cgi/session/pstore.rb: separated sample code.
* lib/open3.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-10 01:34:50 +00:00
hsbt 448c87008e * lib/cgi/core.rb: remove unused variables.
* lib/erb.rb: ditto.
* lib/mkmf.rb: ditto.
* lib/net/http/response.rb: ditto.
* lib/optparse/version.rb: ditto.
* lib/prime.rb: ditto.
* lib/racc/parser.rb: ditto.
* lib/rexml/document.rb: ditto.
* lib/rexml/dtd/dtd.rb: ditto.
* lib/rexml/element.rb: ditto.
* lib/rexml/functions.rb: ditto.
* lib/rexml/parsers/xpathparser.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27 11:04:28 +00:00
xibbar 5c99f241a0 * lib/cgi/core.rb: Provide a mechanism to specify the
max_multipart_length of multipart data.
  [Feature #8370] patch by Leif Eriksen <leif.eriksen.au@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-10 04:29:49 +00:00
akr 9b612d382d * test/lib/minitest/unit.rb: Use Tempfile#close! instead of
Tempfile#unlink to close file descriptors.

* test/openssl/test_config.rb: Ditto.

* test/ruby/test_io.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 15:49:13 +00:00
akr c968f908e1 * lib/cgi/core.rb: Use Tempfile#close(true) instead of Tempfile#unlink
to close file descriptors.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 14:51:08 +00:00
nobu 37ce765ba3 fix typo [Fix GH-603]
* bootstraptest/test_literal.rb: fix typo of "dynamic".  [ci skip]
* regexp.rdoc: fix typo of "organized".  [ci skip]
* lib/session.rb: fix typo of "recognized".  [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-28 15:20:28 +00:00
nobu af1da410ca cgi/util.rb: use alias
* lib/cgi/util.rb (escape_html, unescape_html): make synonyms
  aliases instead of wrapper methods.
* lib/cgi/util.rb (escape_element, unescape_element): ditto.
  [Fixes GH-573]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-21 21:46:17 +00:00
hsbt 690be750cb * lib/cgi/html.rb: fix typo by @windwiny [fix GH-506]
*  lib/net/http.rb: ditto
*  lib/rexml/attribute.rb: ditto
*  lib/rexml/element.rb: ditto
*  lib/rexml/source.rb: ditto
*  lib/rexml/streamlistener.rb: ditto
*  lib/rss/xmlparser.rb: ditto
*  lib/rubygems/commands/generate_index_command.rb: ditto
*  lib/shell.rb: ditto
*  lib/uri/common.rb:ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 05:43:26 +00:00
akr 4fd53e476e * ext/socket/lib/socket.rb: Don't test $! in "ensure" clause because
it may be set before the body.
  Reported by ko1 and mrkn.  [ruby-core:59088] [Bug #9247]

* lib/cgi/core.rb: Ditto.

* lib/drb/ssl.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 16:11:12 +00:00
zzak c366a99cc5 * lib/cgi.rb: [DOC] Capitalize "Ruby" in documentation [Fixes GH-341]
Patch by Dave Worth https://github.com/ruby/ruby/pull/341
* lib/webrick.rb: ditto
* lib/scanf.rb: ditto
* lib/xmlrpc/config.rb: ditto
* lib/resolv.rb: ditto
* lib/e2mmap.rb: ditto
* lib/fileutils.rb: ditto
* lib/mkmf.rb: ditto
* lib/cgi/session.rb: ditto
* lib/yaml.rb: ditto
* lib/erb.rb: ditto
* lib/irb.rb: ditto
* lib/tracer.rb: ditto
* lib/net/http.rb: ditto
* ext/syslog/lib/syslog/logger.rb: ditto
* sample/pty/expect_sample.rb: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-18 13:50:32 +00:00
xibbar fd2fc885b4 * lib/cgi/util.rb (CGI::Util#escape, unescape): Unuse regexp special
global variable. [Feature #8648] Thanks to fotos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16 23:52:47 +00:00
xibbar 69ea68cc21 * lib/cgi/util.rb (CGI.escapeHTML): performance improvement.
thank you nagachika-san.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19 21:11:52 +00:00
xibbar e26fe81b0b * lib/cgi/util.rb(CGI.escapeHTML): performance improvement.
thank you @bbxiao1 via
  https://github.com/ruby/ruby/pull/333

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19 12:42:05 +00:00
xibbar 7a8a7864b1 * lib/cgi/cookie.rb (inspect): add inspect for debug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-03 02:38:32 +00:00
zzak 012dc9d099 * lib/cgi/util.rb, lib/erb.rb: Use String#b [Feature #8394] by znz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 06:06:00 +00:00
xibbar 612143ddc1 * lib/cgi/util.rb: Constant parameter is faster and economy than
string parameter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-16 10:26:57 +00:00
xibbar 75cbab7fe1 * lib/cgi/core.rb: Constant parameter is faster and economy than
string parameter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-16 10:14:45 +00:00
xibbar 2829cbacc3 * lib/cgi/util.rb: Use String#b instead of dup.force_encoding("ASCII-8BIT")
[Feature #8394]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-16 10:01:07 +00:00
xibbar 3957501d13 * lib/cgi/session.rb: Fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-05 13:27:26 +00:00
xibbar b35529bb4e * lib/cgi/util.rb: class methods modulize for using like a function.
[Feature #8354]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-03 11:23:23 +00:00
xibbar 0e102a6658 * lib/cgi/session.rb: update use rescue nil all because
session delete shoud try all pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19 06:17:01 +00:00
nobu 683c5fdfec * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19 05:46:05 +00:00
xibbar 6c3a57a19b * lib/cgi/session.rb: update use rescue Errno::ENOENT because
session delete shoud try all pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19 05:43:46 +00:00
xibbar 4254686922 * lib/cgi/session.rb: update rescue in delete session file
only Errno::ENOENT.[Bug #7940]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19 05:25:51 +00:00
xibbar 1f12e40736 * lib/cgi/cookie.rb: refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-18 23:47:07 +00:00