cgi 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cgi might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +3 -5
- data/Rakefile +7 -0
- data/cgi.gemspec +1 -1
- data/ext/cgi/escape/escape.c +3 -2
- data/lib/cgi/cookie.rb +0 -1
- data/lib/cgi/util.rb +9 -13
- data/lib/cgi.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a6a863562fc49b43b4b3363838cfc00cd4080df4fa1a4939e505d651115ad2
|
4
|
+
data.tar.gz: 5eeb77d5c5e4a42c8683e6953174483d4c5d7c5c9a61dc78590df100a716985f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc300664978f5278e2e366c85acf2ec7929505369c7abaa0ef3d0658e5de556d3eb1c8e66d497c6f8b88efeabcfa57c2871bfbd325dd1e1b72fdcc4edf03defd
|
7
|
+
data.tar.gz: 7f82863adb49bd898c376d16a5d8ade52c0ada8d5994a22a858e7b47f467a69c755f22d8f691fcc891df222b176d472c167ac3e4b6896b104353fb04da867a56
|
data/.github/workflows/test.yml
CHANGED
@@ -7,18 +7,16 @@ jobs:
|
|
7
7
|
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby: [ 2.7, 2.6, 2.5, head ]
|
10
|
+
ruby: [ '3.0', 2.7, 2.6, 2.5, head ]
|
11
11
|
os: [ ubuntu-latest, macos-latest ]
|
12
12
|
runs-on: ${{ matrix.os }}
|
13
13
|
steps:
|
14
|
-
- uses: actions/checkout@
|
14
|
+
- uses: actions/checkout@v2
|
15
15
|
- name: Set up Ruby
|
16
16
|
uses: ruby/setup-ruby@v1
|
17
17
|
with:
|
18
18
|
ruby-version: ${{ matrix.ruby }}
|
19
19
|
- name: Install dependencies
|
20
|
-
run:
|
21
|
-
gem install bundler --no-document
|
22
|
-
bundle install
|
20
|
+
run: bundle install
|
23
21
|
- name: Run test
|
24
22
|
run: rake test
|
data/Rakefile
CHANGED
@@ -10,4 +10,11 @@ end
|
|
10
10
|
require 'rake/extensiontask'
|
11
11
|
Rake::ExtensionTask.new("cgi/escape")
|
12
12
|
|
13
|
+
task :sync_tool do
|
14
|
+
require 'fileutils'
|
15
|
+
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
|
16
|
+
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
17
|
+
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
18
|
+
end
|
19
|
+
|
13
20
|
task :default => :test
|
data/cgi.gemspec
CHANGED
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|
26
26
|
`git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
27
|
end
|
28
28
|
spec.bindir = "exe"
|
29
|
-
spec.executables =
|
29
|
+
spec.executables = []
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
end
|
data/ext/cgi/escape/escape.c
CHANGED
@@ -36,7 +36,8 @@ static VALUE
|
|
36
36
|
optimized_escape_html(VALUE str)
|
37
37
|
{
|
38
38
|
VALUE vbuf;
|
39
|
-
|
39
|
+
typedef char escape_buf[HTML_ESCAPE_MAX_LEN];
|
40
|
+
char *buf = *ALLOCV_N(escape_buf, vbuf, RSTRING_LEN(str));
|
40
41
|
const char *cstr = RSTRING_PTR(str);
|
41
42
|
const char *end = cstr + RSTRING_LEN(str);
|
42
43
|
|
@@ -388,7 +389,7 @@ cgiesc_unescape(int argc, VALUE *argv, VALUE self)
|
|
388
389
|
void
|
389
390
|
Init_escape(void)
|
390
391
|
{
|
391
|
-
#
|
392
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
392
393
|
rb_ext_ractor_safe(true);
|
393
394
|
#endif
|
394
395
|
|
data/lib/cgi/cookie.rb
CHANGED
@@ -159,7 +159,6 @@ class CGI
|
|
159
159
|
raw_cookie.split(/;\s?/).each do |pairs|
|
160
160
|
name, values = pairs.split('=',2)
|
161
161
|
next unless name and values
|
162
|
-
name = CGI.unescape(name)
|
163
162
|
values ||= ""
|
164
163
|
values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
|
165
164
|
if cookies.has_key?(name)
|
data/lib/cgi/util.rb
CHANGED
@@ -49,9 +49,12 @@ module CGI::Util
|
|
49
49
|
table = Hash[TABLE_FOR_ESCAPE_HTML__.map {|pair|pair.map {|s|s.encode(enc)}}]
|
50
50
|
string = string.gsub(/#{"['&\"<>]".encode(enc)}/, table)
|
51
51
|
string.encode!(origenc) if origenc
|
52
|
-
|
52
|
+
string
|
53
|
+
else
|
54
|
+
string = string.b
|
55
|
+
string.gsub!(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
|
56
|
+
string.force_encoding(enc)
|
53
57
|
end
|
54
|
-
string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
|
55
58
|
end
|
56
59
|
|
57
60
|
begin
|
@@ -90,7 +93,8 @@ module CGI::Util
|
|
90
93
|
when Encoding::ISO_8859_1; 256
|
91
94
|
else 128
|
92
95
|
end
|
93
|
-
string.
|
96
|
+
string = string.b
|
97
|
+
string.gsub!(/&(apos|amp|quot|gt|lt|\#[0-9]+|\#[xX][0-9A-Fa-f]+);/) do
|
94
98
|
match = $1.dup
|
95
99
|
case match
|
96
100
|
when 'apos' then "'"
|
@@ -116,6 +120,7 @@ module CGI::Util
|
|
116
120
|
"&#{match};"
|
117
121
|
end
|
118
122
|
end
|
123
|
+
string.force_encoding enc
|
119
124
|
end
|
120
125
|
|
121
126
|
# Synonym for CGI.escapeHTML(str)
|
@@ -174,21 +179,12 @@ module CGI::Util
|
|
174
179
|
# Synonym for CGI.unescapeElement(str)
|
175
180
|
alias unescape_element unescapeElement
|
176
181
|
|
177
|
-
# Abbreviated day-of-week names specified by RFC 822
|
178
|
-
RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
|
179
|
-
|
180
|
-
# Abbreviated month names specified by RFC 822
|
181
|
-
RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]
|
182
|
-
|
183
182
|
# Format a +Time+ object as a String using the format specified by RFC 1123.
|
184
183
|
#
|
185
184
|
# CGI.rfc1123_date(Time.now)
|
186
185
|
# # Sat, 01 Jan 2000 00:00:00 GMT
|
187
186
|
def rfc1123_date(time)
|
188
|
-
|
189
|
-
return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
|
190
|
-
RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
|
191
|
-
t.hour, t.min, t.sec)
|
187
|
+
time.getgm.strftime("%a, %d %b %Y %T GMT")
|
192
188
|
end
|
193
189
|
|
194
190
|
# Prettify (indent) an HTML string.
|
data/lib/cgi.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cgi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Support for the Common Gateway Interface protocol.
|
14
14
|
email:
|
@@ -43,7 +43,7 @@ licenses:
|
|
43
43
|
metadata:
|
44
44
|
homepage_uri: https://github.com/ruby/cgi
|
45
45
|
source_code_uri: https://github.com/ruby/cgi
|
46
|
-
post_install_message:
|
46
|
+
post_install_message:
|
47
47
|
rdoc_options: []
|
48
48
|
require_paths:
|
49
49
|
- lib
|
@@ -58,8 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
62
|
-
signing_key:
|
61
|
+
rubygems_version: 3.3.0.dev
|
62
|
+
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Support for the Common Gateway Interface protocol.
|
65
65
|
test_files: []
|