summaryrefslogtreecommitdiff
path: root/lib/cgi/core.rb
AgeCommit message (Collapse)Author
2022-11-22[ruby/cgi] Prevent CRLF injectionYusuke Endoh
Throw a RuntimeError if the HTTP response header contains CR or LF to prevent HTTP response splitting. https://hackerone.com/reports/1204695 https://github.com/ruby/cgi/commit/64c5045c0a
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-08-19Prefer Regexp#=~ to Regexp#match when the RHS may be nilNobuyoshi Nakada
2019-08-04change call CGI methods from :: to .Semyon Pupkov
Closes: https://github.com/ruby/ruby/pull/1749
2018-12-04Use delete_prefix instead of `sub(/\Afixed-pattern/, '')`kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02lib/*: Prefer require_relative over require.marcandre
[#15206] [Fix GH-1976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Use printf instead of puts and sprintfkazu
[ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add uplevel keyword to Kernel#warn and use itshyouhei
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-08-02Fix cgi/core code example missing commakazu
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-05-06share `@@accept_charset`nobu
* 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-02-18{lib,test}/cgi: Specify frozen_string_literal: true.kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57652 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
2014-07-27* lib/cgi/core.rb: remove unused variables.hsbt
* 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-06-10* lib/cgi/core.rb: Provide a mechanism to specify thexibbar
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-05-27* test/lib/minitest/unit.rb: Use Tempfile#close! instead ofakr
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* lib/cgi/core.rb: Use Tempfile#close(true) instead of Tempfile#unlinkakr
to close file descriptors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13* ext/socket/lib/socket.rb: Don't test $! in "ensure" clause becauseakr
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-05-16* lib/cgi/core.rb: Constant parameter is faster and economy thanxibbar
string parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11* lib/cgi/{core,html}.rb : Update define tagmakerxibbar
because to delete eval. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-29code cleanup by @vipulnsward [GH fixes #267]hsbt
* lib/cgi/core.rb: change each to each_value * ext/bigdecimal/lib/bigdecimal/{jacobian,math}.rb: remove unused variables from bigdecimal lib git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22* lib/cgi/core.rb: Documentation for CGI#header aliaszzak
Based on a patch by Marcus Stollsteimer [ruby-core:49585] [Bug #7405] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-16* lib/cgi/core.rb: Use symbols instead of strings formarcandre
{const_,instance_variable_}{get,set}. [#7161] * lib/drb/drb.rb: ditto. * lib/ipaddr.rb: ditto. * lib/irb/workspace.rb: ditto. * lib/monitor.rb: ditto. * lib/rss/maker/base.rb: ditto. * lib/rss/rss.rb: ditto. * lib/xmlrpc/parser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07* lib/cgi/core.rb: alias CGI#http_header to CGI#header .xibbar
[Bug #7286] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05* lib/cgi/core.rb: check if Tempfile is defined before use it.naruse
* lib/cgi/core.rb: remove tempfiles only if tempfiles exist git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05Mon Nov 5 09:55:05 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>xibbar
* lib/cgi/core.rb: remove tempfile more early. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-04Sun Nov 4 20:41:28 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>xibbar
* lib/cgi.rb, lib/cgi/*/rb: rename CGI#header to CGI#http_header, add and update HTML5 tag generater. [Bug #7110] Patch provided by Marcus Stollsteimer, thank you ! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 * lib/cgi/html5.rb: Add html5 tag maker.xibbar
* lib/cgi/core.rb: ditto. [Feature #6637] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-14Suppress warnings.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04Wed Jul 4 08:45:41 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>xibbar
* lib/cgi/core.rb: fix bug: When query parameter is 'id=123&id', cgi['id'] => '123' is correct. First parameter is valid. [Feature #6621] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03Wed Jul 4 08:11:15 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>xibbar
* lib/cgi/core.rb,html.rb: fix typo.[Bug #6632] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-17Tue Oct 18 02:24:19 2011 Takeyuki FUJIOKA <xibbar@ruby-lang.org>xibbar
* lib/cgi/core.rb (QueryExtension#read_multiparat): replace 'stdinput' from '$stdin' because using fast cgi. [Bug #5451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09* lib/cgi/core.rb: fix multipart form parsing bug. [Bug #3866]xibbar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-01 * lib/cgi/util.rb: Improve documentation. Patch by Kuba Fietkiewicz.drbrain
[Ruby 1.9 - Bug #4775] * lib/cgi/core.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 * lib/cgi/util.rb: Improve documentation. Patch by Clinton Nixon.drbrain
[Ruby 1.9 - Bug #4733] * lib/cgi/core.rb: ditto * lib/cgi/cookie.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-16 * lib/cgi.rb: Add toplevel documentation to class CGIdrbrain
* lib/cgi/session.rb: Add overview documentation to CGI::Cookie * lib/cgi/html.rb: Don't add CGI::TagMaker documentation to CGI. Patch by David Copeland. [Ruby 1.9 - Bug #4704] * lib/cgi/core.rb: Clean up CGI documentation. Patch by David Copeland. [Ruby 1.9 - Bug #4704] * lib/cgi/cookie.rb: Clean up CGI::Cookie documentation. Patch by David Copeland. [Ruby 1.9 - Bug #4704] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-01* lib/cgi.rb (CGI::NEEDS_BINMODE): check if O_BINARY value insteadnobu
of fragile check by platform name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20* lib/cgi/{core, util}.rb (RFC822_DAYS, RFC822_MONTHS):xibbar
move the constant because used only util.rb. [Bug #2704] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-20* lib: fixed typo. a patch by Sho Hashimoto in [ruby-dev:40716].nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-16Rolled out last changeryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-16Minor cleanup to improve hash useryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-12* lib/cgi/core.rb (read_from_cmdline): this code is better.xibbar
[ruby-core:25991] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03* lib/cgi/core.rb: fix command-line option ofxibbar
non-interactive terminal. [ruby-core:23016] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24* lib/cgi/core.rb (CGI::HTTP_STATUS): typo fixed. a patch frommatz
Nobuhiro IMAI. [ruby-dev:38538] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-16* lib/cgi/core.rb (read_multipart): When path is not defined,mame
define local_path as a method always returning nil instead of aliasing. This is because StringIO#path no longer exists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06* {ext,lib,test}/**/*.rb: removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-22* lib/cgi/core.rb (CGI.parse): generate only key on params hashxibbar
if request have only key uri parameters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-18* lib/cgi/session.rb: fix bug for ignore session_id option.xibbar
report from [ruby-core:18635], [Bug #572] * lib/cgi/core.rb: use Encoding#find when encoding set. * test/cgi/test_cgi_session.rb: test for session_id specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24* lib/cgi/core.rb (read_multipart): change field value as Stringxibbar
from StringIO of Tempfile when multipart parse without file field. add files method that can uploaded files. [ruby-dev:36547] * test/cgi/test_cgi_multipart.rb: fix the test for core.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20* lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bitxibbar
from file field of multipart form. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-06* lib/cgi/core.rb (CGI::QueryExtension::initialize_query): fix thexibbar
condition. * test/cgi/test_cgi_core.rb: bug fix encoding. thaks to TAKANO Mitsuhiro <takano32 at jus.or.jp> . * test/cgi/test_cgi_multipart.rb: temporary comment in. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e