summaryrefslogtreecommitdiff
path: root/ext/cgi/escape/escape.c
AgeCommit message (Collapse)Author
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-06-05Optimize CGI.escapeHTML by reducing buffer extensionTakashi Kokubun
and switch-case branches. Buffer allocation optimization using `ALLOCA_N` would be the main benefit of patch. It eliminates the O(N) buffer extensions. It also reduces the number of branches using escape table like https://mattn.kaoriya.net/software/lang/c/20160817011915.htm. Closes: https://github.com/ruby/ruby/pull/2226 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
2019-06-05* expand tabs.git
2019-06-05Revert "Optimize CGI.escapeHTML by reducing buffer extension"Takashi Kokubun
This reverts commit 8d81e59aa7a62652caf85f9c8db371703668c149. `ALLOCA_N` does not check stack overflow unlike ALLOCV. I'll fix it and re-commit it again.
2019-06-05Optimize CGI.escapeHTML by reducing buffer extensionTakashi Kokubun
and switch-case branches. Buffer allocation optimization using `ALLOCA_N` would be the main benefit of patch. It eliminates the O(N) buffer extensions. It also reduces the number of branches using escape table like https://mattn.kaoriya.net/software/lang/c/20160817011915.htm. Closes: https://github.com/ruby/ruby/pull/2226 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
2018-05-03Revert "ext/cgi/escape: preserve String subclass in result"normal
This reverts commit 6afea14043b0c0e603f26c89ae0d043f65852668 r63328 I misread the original bug report and got results flipped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02ext/cgi/escape: preserve String subclass in resultnormal
* ext/cgi/escape/escape.c (optimized_escape_html): use rb_str_new_with_class (optimized_unescape_html): ditto (optimized_escape): ditto (optimized_unescape): ditto * test/cgi/test_cgi_util.rb (test_escape_string_subclass): new test [ruby-core:86847] [Bug #14732] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17cgi/util.rb: Don't escape tilde in #escapek0kubun
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-02-02escape.c: check argumentnobu
* ext/cgi/escape/escape.c (optimized_unescape): check accept_charset encoding argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-30Magic numbersnobu
* ext/cgi/escape/escape.c (optimized_unescape_html): remove magic numbers for literal lengths. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-30Initialize IDnobu
* ext/cgi/escape/escape.c (accept_charset): initialize the static ID for theha class variable once at first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20cgi/util.rb: remove CGI::Util#_unescapenobu
* 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-02-21cgi/escape: Optimize CGI.unescapenobu
* 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-21cgi/escape: Optimize CGI.unescapeHTMLnobu
* cgi/escape/escape.c: Optimize CGI.unescapeHTML performance by C ext for ASCII-compatible encodings. [Fix GH-1242] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04mask upper nibblenobu
* ext/cgi/escape/escape.c (optimized_escape): move c and use it instead of cstr[i]. mask upper nibble for the platforms where CHAR_BIT > 8. [Fix GH-1238] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04initialize dest to 0nobu
* ext/cgi/escape/escape.c (optimized_escape_html): initialize dest to 0 and tell the result to be modified, instead of a separate flag. * ext/cgi/escape/escape.c (optimized_escape): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04cgi/escape: Optimize CGI.escapenobu
* cgi/escape/escape.c: Optimize CGI.escape performance by C ext for ASCII-compatible encodings. [Fix GH-1238] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22escape.c: should not freezenobu
* ext/cgi/escape/escape.c (optimized_escape_html): CGI.escapeHTML should return unfrozen new string. [ruby-core:72426] [Bug #11858] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21escape.c: Preserve original statenobu
* ext/cgi/escape/escape.c (preserve_original_state): Preserve original state for tainted and frozen. [Fix GH-1166] [ruby-dev:49451] [Bug #11855] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20cgi/escape: Optimize CGI.escapeHTMLnobu
* 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