cgi 0.5.0.beta2-java → 0.5.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cgi/cookie.rb +2 -0
- data/lib/cgi/core.rb +136 -56
- data/lib/cgi/escape.jar +0 -0
- data/lib/cgi/escape.rb +4 -0
- data/lib/cgi/html.rb +5 -0
- data/lib/cgi/session.rb +3 -3
- data/lib/cgi/util.rb +1 -0
- data/lib/cgi.rb +65 -53
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88aa84d17db9f6389d2cc05c60deae56639ed174358dac9b98489b593d9525b3
|
|
4
|
+
data.tar.gz: 82daf7f0949e1f3792473b0ba29483785d853faf09dfebfe1bb30312f27e3195
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e8aabd5a880301dc8cce4ff24bb23094f71319c412c9f92765b4108a066555898b1d753f9ab3defadb5cf6e14412e59f32eb7d0f54b1ee526fa4afb319fc69e
|
|
7
|
+
data.tar.gz: 485670f42a8ab67650e166847f7e08da3c95fb4e905325fe6113d7d9f4edee4a98bcbac52a0684f8c177eac414cafce2b8b6f87bd528fd62fe0a45669862a736
|
data/lib/cgi/cookie.rb
CHANGED
|
@@ -40,9 +40,11 @@ class CGI
|
|
|
40
40
|
class Cookie < Array
|
|
41
41
|
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
|
|
42
42
|
|
|
43
|
+
# :stopdoc:
|
|
43
44
|
TOKEN_RE = %r"\A[[!-~]&&[^()<>@,;:\\\"/?=\[\]{}]]+\z"
|
|
44
45
|
PATH_VALUE_RE = %r"\A[[ -~]&&[^;]]*\z"
|
|
45
46
|
DOMAIN_VALUE_RE = %r"\A\.?(?<label>(?!-)[-A-Za-z0-9]+(?<!-))(?:\.\g<label>)*\z"
|
|
47
|
+
# :startdoc:
|
|
46
48
|
|
|
47
49
|
# Create a new CGI::Cookie object.
|
|
48
50
|
#
|
data/lib/cgi/core.rb
CHANGED
|
@@ -384,11 +384,14 @@ class CGI
|
|
|
384
384
|
stdoutput.print(*options)
|
|
385
385
|
end
|
|
386
386
|
|
|
387
|
-
#
|
|
387
|
+
# :call-seq:
|
|
388
|
+
# CGI.parse(query_string) -> hash
|
|
389
|
+
#
|
|
390
|
+
# Returns a new hash built from name/value pairs in the given +query_string+:
|
|
388
391
|
#
|
|
389
|
-
#
|
|
390
|
-
#
|
|
391
|
-
#
|
|
392
|
+
# query = 'foo=0&bar=1&foo=2&bar=3'
|
|
393
|
+
# CGI.parse(query)
|
|
394
|
+
# # => {"foo" => ["0", "2"], "bar" => ["1", "3"]}
|
|
392
395
|
#
|
|
393
396
|
def self.parse(query)
|
|
394
397
|
params = {}
|
|
@@ -629,8 +632,8 @@ class CGI
|
|
|
629
632
|
string = unless ARGV.empty?
|
|
630
633
|
ARGV.join(' ')
|
|
631
634
|
else
|
|
632
|
-
if
|
|
633
|
-
|
|
635
|
+
if stdinput.tty?
|
|
636
|
+
$stderr.print(
|
|
634
637
|
%|(offline mode: enter name=value pairs on standard input)\n|
|
|
635
638
|
)
|
|
636
639
|
end
|
|
@@ -778,75 +781,152 @@ class CGI
|
|
|
778
781
|
#
|
|
779
782
|
@@max_multipart_length= 128 * 1024 * 1024
|
|
780
783
|
|
|
781
|
-
# Create a new CGI instance.
|
|
782
|
-
#
|
|
783
784
|
# :call-seq:
|
|
784
|
-
# CGI.new(
|
|
785
|
-
# CGI.new(
|
|
785
|
+
# CGI.new(options = {}) -> new_cgi
|
|
786
|
+
# CGI.new(tag_maker) -> new_cgi
|
|
787
|
+
# CGI.new(options = {}) {|name, value| ... } -> new_cgi
|
|
788
|
+
# CGI.new(tag_maker) {|name, value| ... } -> new_cgi
|
|
789
|
+
#
|
|
790
|
+
# Returns a new \CGI object.
|
|
791
|
+
#
|
|
792
|
+
# The behavior of this method depends _strongly_ on whether it is called
|
|
793
|
+
# within a standard \CGI call environment;
|
|
794
|
+
# that is, whether <tt>ENV['REQUEST_METHOD']</tt> is defined.
|
|
795
|
+
#
|
|
796
|
+
# <b>Within a Standard Call Environment</b>
|
|
797
|
+
#
|
|
798
|
+
# This section assumes that <tt>ENV['REQUEST_METHOD']</tt> is defined;
|
|
799
|
+
# for example:
|
|
800
|
+
#
|
|
801
|
+
# ENV['REQUEST_METHOD'] # => "GET"
|
|
802
|
+
#
|
|
803
|
+
# With no argument and no block given, returns a new \CGI object with default values:
|
|
804
|
+
#
|
|
805
|
+
# cgi = CGI.new
|
|
806
|
+
# puts cgi.pretty_inspect
|
|
807
|
+
# #<CGI:0x000002b0ea237bc8
|
|
808
|
+
# @accept_charset=#<Encoding:UTF-8>,
|
|
809
|
+
# @accept_charset_error_block=nil,
|
|
810
|
+
# @cookies={},
|
|
811
|
+
# @max_multipart_length=134217728,
|
|
812
|
+
# @multipart=false,
|
|
813
|
+
# @output_cookies=nil,
|
|
814
|
+
# @output_hidden=nil,
|
|
815
|
+
# @params={}>
|
|
816
|
+
#
|
|
817
|
+
# With hash argument +options+ given and no block given,
|
|
818
|
+
# returns a new \CGI object with the given options.
|
|
819
|
+
#
|
|
820
|
+
# The options may be:
|
|
821
|
+
#
|
|
822
|
+
# - <tt>accept_charset: _encoding_</tt>:
|
|
823
|
+
# specifies the encoding of the received query string.
|
|
824
|
+
#
|
|
825
|
+
# Value _encoding_ may be
|
|
826
|
+
# an {Encoding object}[https://docs.ruby-lang.org/en/master/encodings_rdoc.html#label-Encoding+Objects]
|
|
827
|
+
# or an {encoding name}[https://docs.ruby-lang.org/en/master/encodings_rdoc.html#label-Names+and+Aliases]:
|
|
828
|
+
#
|
|
829
|
+
# CGI.new(accept_charset: 'EUC-JP')
|
|
830
|
+
#
|
|
831
|
+
# If the option is not given,
|
|
832
|
+
# the default value is the class default encoding.
|
|
833
|
+
#
|
|
834
|
+
# <em>Note:</em> The <tt>accept_charset</tt> method returns the HTTP Accept-Charset
|
|
835
|
+
# header value, not the configured encoding. The configured encoding is used
|
|
836
|
+
# internally for query string parsing.
|
|
837
|
+
#
|
|
838
|
+
# - <tt>max_multipart_length: _size_</tt>:
|
|
839
|
+
# specifies maximum size (in bytes) of multipart data.
|
|
840
|
+
#
|
|
841
|
+
# The _size_ may be:
|
|
842
|
+
#
|
|
843
|
+
# - A positive integer.
|
|
844
|
+
#
|
|
845
|
+
# CGI.new(max_multipart_length: 1024 * 1024)
|
|
846
|
+
#
|
|
847
|
+
#
|
|
848
|
+
# - A lambda to be evaluated when the request is parsed.
|
|
849
|
+
# This is useful when determining whether to accept multipart data
|
|
850
|
+
# (e.g. by consulting a registered user's upload allowance).
|
|
851
|
+
#
|
|
852
|
+
# CGI.new(max_multipart_length: -> {check_filesystem})
|
|
853
|
+
#
|
|
854
|
+
# If the option is not given, the default is +134217728+, specifying a maximum size of 128 megabytes.
|
|
855
|
+
#
|
|
856
|
+
# <em>Note:</em> This option configures internal behavior only.
|
|
857
|
+
# There is no public method to retrieve this value after initialization.
|
|
858
|
+
#
|
|
859
|
+
# - <tt>tag_maker: _html_version_</tt>:
|
|
860
|
+
# specifies which version of HTML to use in generating tags.
|
|
861
|
+
#
|
|
862
|
+
# Value _html_version_ may be one of:
|
|
863
|
+
#
|
|
864
|
+
# - <tt>'html3'</tt>: {HTML version 3}[https://en.wikipedia.org/wiki/HTML#HTML_3].
|
|
865
|
+
# - <tt>'html4'</tt>: {HTML version 4}[https://en.wikipedia.org/wiki/HTML#HTML_4].
|
|
866
|
+
# - <tt>'html4Tr'</tt>: HTML 4.0 Transitional.
|
|
867
|
+
# - <tt>'html4Fr'</tt>: HTML 4.0 with Framesets.
|
|
868
|
+
# - <tt>'html5'</tt>: {HTML version 5}[https://en.wikipedia.org/wiki/HTML#HTML_5].
|
|
786
869
|
#
|
|
870
|
+
# Example:
|
|
787
871
|
#
|
|
788
|
-
#
|
|
789
|
-
# This is the same as using the +options_hash+ form with the value <tt>{
|
|
790
|
-
# :tag_maker => tag_maker }</tt> Note that it is recommended to use the
|
|
791
|
-
# +options_hash+ form, since it also allows you specify the charset you
|
|
792
|
-
# will accept.
|
|
793
|
-
# <tt>options_hash</tt>::
|
|
794
|
-
# A Hash that recognizes three options:
|
|
872
|
+
# CGI.new(tag_maker: 'html5')
|
|
795
873
|
#
|
|
796
|
-
#
|
|
797
|
-
#
|
|
798
|
-
# <tt>@@accept_charset</tt> is used. If the encoding is not valid, a
|
|
799
|
-
# CGI::InvalidEncoding will be raised.
|
|
874
|
+
# If the option is not given,
|
|
875
|
+
# no HTML generation methods are loaded.
|
|
800
876
|
#
|
|
801
|
-
#
|
|
877
|
+
# With string argument +tag_maker+ given as _tag_maker_ and no block given,
|
|
878
|
+
# equivalent to <tt>CGI.new(tag_maker: _tag_maker_)</tt>:
|
|
802
879
|
#
|
|
803
|
-
#
|
|
880
|
+
# CGI.new('html5')
|
|
804
881
|
#
|
|
805
|
-
#
|
|
882
|
+
# <b>Outside a Standard Call Environment</b>
|
|
806
883
|
#
|
|
807
|
-
#
|
|
884
|
+
# This section assumes that <tt>ENV['REQUEST_METHOD']</tt> is not defined;
|
|
885
|
+
# for example:
|
|
808
886
|
#
|
|
809
|
-
#
|
|
887
|
+
# ENV['REQUEST_METHOD'] # => nil
|
|
810
888
|
#
|
|
811
|
-
#
|
|
812
|
-
#
|
|
813
|
-
#
|
|
889
|
+
# In this mode, the method reads its parameters
|
|
890
|
+
# from the command line or (failing that) from standard input;
|
|
891
|
+
# returns a new \CGI object.
|
|
814
892
|
#
|
|
815
|
-
#
|
|
893
|
+
# Otherwise, cookies and other parameters are parsed automatically from the standard CGI locations,
|
|
894
|
+
# which vary according to the request method.
|
|
816
895
|
#
|
|
817
|
-
#
|
|
818
|
-
# "html4":: HTML 4.0
|
|
819
|
-
# "html4Tr":: HTML 4.0 Transitional
|
|
820
|
-
# "html4Fr":: HTML 4.0 with Framesets
|
|
821
|
-
# "html5":: HTML 5
|
|
896
|
+
# <b>Options vs Public Methods</b>
|
|
822
897
|
#
|
|
823
|
-
#
|
|
824
|
-
#
|
|
825
|
-
# a lambda, that will be evaluated when the request is parsed. This
|
|
826
|
-
# allows more complex logic to be set when determining whether to accept
|
|
827
|
-
# multipart data (e.g. consult a registered users upload allowance)
|
|
898
|
+
# Some initialization options configure internal behavior only and do not provide
|
|
899
|
+
# corresponding public getter methods:
|
|
828
900
|
#
|
|
829
|
-
#
|
|
901
|
+
# - <tt>accept_charset</tt>: Configures internal encoding for parsing.
|
|
902
|
+
# The <tt>accept_charset</tt> method returns the HTTP Accept-Charset header.
|
|
903
|
+
# - <tt>max_multipart_length</tt>: Configures internal multipart size limits.
|
|
904
|
+
# No public getter method is available.
|
|
905
|
+
# - <tt>tag_maker</tt>: Loads HTML generation methods (publicly accessible).
|
|
830
906
|
#
|
|
831
|
-
#
|
|
907
|
+
# <b>Block</b>
|
|
832
908
|
#
|
|
833
|
-
#
|
|
909
|
+
# If a block is given, its code is stored as a Proc;
|
|
910
|
+
# whenever CGI::InvalidEncoding would be raised, the proc is called instead.
|
|
834
911
|
#
|
|
835
|
-
#
|
|
836
|
-
# If provided, the block is called when an invalid encoding is
|
|
837
|
-
# encountered. For example:
|
|
912
|
+
# In this example, the proc simply saves the error:
|
|
838
913
|
#
|
|
839
|
-
#
|
|
840
|
-
#
|
|
841
|
-
#
|
|
842
|
-
#
|
|
914
|
+
# encoding_errors={}
|
|
915
|
+
# CGI.new(accept_charset: 'EUC-JP') do |name,value|
|
|
916
|
+
# encoding_errors[name] = value
|
|
917
|
+
# end
|
|
918
|
+
# # =>
|
|
919
|
+
# #<CGI:0x000002b0ec11bcd8
|
|
920
|
+
# @accept_charset="EUC-JP",
|
|
921
|
+
# @accept_charset_error_block=#<Proc:0x000002b0ed2ee190 (irb):146>,
|
|
922
|
+
# @cookies={},
|
|
923
|
+
# @max_multipart_length=134217728,
|
|
924
|
+
# @multipart=false,
|
|
925
|
+
# @options={accept_charset: "EUC-JP", max_multipart_length: 134217728},
|
|
926
|
+
# @output_cookies=nil,
|
|
927
|
+
# @output_hidden=nil,
|
|
928
|
+
# @params={}>
|
|
843
929
|
#
|
|
844
|
-
# Finally, if the CGI object is not created in a standard CGI call
|
|
845
|
-
# environment (that is, it can't locate REQUEST_METHOD in its environment),
|
|
846
|
-
# then it will run in "offline" mode. In this mode, it reads its parameters
|
|
847
|
-
# from the command line or (failing that) from standard input. Otherwise,
|
|
848
|
-
# cookies and other parameters are parsed automatically from the standard
|
|
849
|
-
# CGI locations, which varies according to the REQUEST_METHOD.
|
|
850
930
|
def initialize(options = {}, &block) # :yields: name, value
|
|
851
931
|
@accept_charset_error_block = block_given? ? block : nil
|
|
852
932
|
@options={
|
data/lib/cgi/escape.jar
CHANGED
|
Binary file
|
data/lib/cgi/escape.rb
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# :stopdoc
|
|
3
4
|
class CGI
|
|
4
5
|
module Escape; end
|
|
5
6
|
include Escape
|
|
6
7
|
extend Escape
|
|
8
|
+
module EscapeExt; end # :nodoc:
|
|
7
9
|
end
|
|
10
|
+
# :startdoc:
|
|
8
11
|
|
|
12
|
+
# Escape/unescape for CGI, HTML, URI.
|
|
9
13
|
module CGI::Escape
|
|
10
14
|
@@accept_charset = Encoding::UTF_8 unless defined?(@@accept_charset)
|
|
11
15
|
|
data/lib/cgi/html.rb
CHANGED
|
@@ -1006,27 +1006,32 @@ class CGI
|
|
|
1006
1006
|
|
|
1007
1007
|
end # Html5
|
|
1008
1008
|
|
|
1009
|
+
# HTML version 3 generation class.
|
|
1009
1010
|
class HTML3
|
|
1010
1011
|
include Html3
|
|
1011
1012
|
include HtmlExtension
|
|
1012
1013
|
end
|
|
1013
1014
|
|
|
1015
|
+
# HTML version 4 generation class.
|
|
1014
1016
|
class HTML4
|
|
1015
1017
|
include Html4
|
|
1016
1018
|
include HtmlExtension
|
|
1017
1019
|
end
|
|
1018
1020
|
|
|
1021
|
+
# HTML version 4 transitional generation class.
|
|
1019
1022
|
class HTML4Tr
|
|
1020
1023
|
include Html4Tr
|
|
1021
1024
|
include HtmlExtension
|
|
1022
1025
|
end
|
|
1023
1026
|
|
|
1027
|
+
# HTML version 4 with framesets generation class.
|
|
1024
1028
|
class HTML4Fr
|
|
1025
1029
|
include Html4Tr
|
|
1026
1030
|
include Html4Fr
|
|
1027
1031
|
include HtmlExtension
|
|
1028
1032
|
end
|
|
1029
1033
|
|
|
1034
|
+
# HTML version 5 generation class.
|
|
1030
1035
|
class HTML5
|
|
1031
1036
|
include Html5
|
|
1032
1037
|
include HtmlExtension
|
data/lib/cgi/session.rb
CHANGED
|
@@ -214,11 +214,11 @@ class CGI
|
|
|
214
214
|
dir = option['tmpdir'] || Dir::tmpdir
|
|
215
215
|
prefix = option['prefix']
|
|
216
216
|
suffix = option['suffix']
|
|
217
|
-
require 'digest
|
|
218
|
-
|
|
217
|
+
require 'digest'
|
|
218
|
+
sha256 = Digest::SHA256.hexdigest(session_id)[0,16]
|
|
219
219
|
path = dir+"/"
|
|
220
220
|
path << prefix if prefix
|
|
221
|
-
path <<
|
|
221
|
+
path << sha256
|
|
222
222
|
path << suffix if suffix
|
|
223
223
|
if File::exist? path
|
|
224
224
|
hash = nil
|
data/lib/cgi/util.rb
CHANGED
data/lib/cgi.rb
CHANGED
|
@@ -42,6 +42,17 @@
|
|
|
42
42
|
#
|
|
43
43
|
# Read on for more details. Examples are provided at the bottom.
|
|
44
44
|
#
|
|
45
|
+
# == About the Examples
|
|
46
|
+
#
|
|
47
|
+
# Examples on this page assume that \CGI has been required:
|
|
48
|
+
#
|
|
49
|
+
# require 'cgi'
|
|
50
|
+
#
|
|
51
|
+
# Unless otherwise stated, examples also assume that environment variable 'REQUEST_METHOD' exists
|
|
52
|
+
# (which prevents CGI.new from entering its online mode):
|
|
53
|
+
#
|
|
54
|
+
# ENV.include?('REQUEST_METHOD') # => true
|
|
55
|
+
#
|
|
45
56
|
# == Queries
|
|
46
57
|
#
|
|
47
58
|
# The CGI class dynamically mixes in parameter and cookie-parsing
|
|
@@ -144,62 +155,66 @@
|
|
|
144
155
|
#
|
|
145
156
|
# === Utility HTML escape and other methods like a function.
|
|
146
157
|
#
|
|
147
|
-
# There are some utility
|
|
158
|
+
# There are some utility tools defined in cgi/util.rb and cgi/escape.rb.
|
|
159
|
+
# Escape and unescape methods are defined in cgi/escape.rb.
|
|
148
160
|
# And when include, you can use utility methods like a function.
|
|
149
161
|
#
|
|
150
|
-
# == Examples of
|
|
162
|
+
# == Examples of Use
|
|
151
163
|
#
|
|
152
|
-
# ===
|
|
164
|
+
# === Form Values
|
|
153
165
|
#
|
|
154
|
-
#
|
|
155
|
-
# cgi = CGI.new
|
|
156
|
-
# value = cgi['field_name'] # <== value string for 'field_name'
|
|
157
|
-
# # if not 'field_name' included, then return "".
|
|
158
|
-
# fields = cgi.keys # <== array of field names
|
|
159
|
-
#
|
|
160
|
-
# # returns true if form has 'field_name'
|
|
161
|
-
# cgi.has_key?('field_name')
|
|
162
|
-
# cgi.has_key?('field_name')
|
|
163
|
-
# cgi.include?('field_name')
|
|
166
|
+
# ==== Get Form Values
|
|
164
167
|
#
|
|
165
|
-
#
|
|
166
|
-
#
|
|
168
|
+
# You can use method +cgi.params+ to retrieve form values
|
|
169
|
+
# in a {Hash}[https://docs.ruby-lang.org/en/3.4/Hash.html]:
|
|
167
170
|
#
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
+
# ENV.update(
|
|
172
|
+
# 'REQUEST_METHOD' => 'GET',
|
|
173
|
+
# 'QUERY_STRING' => 'a=111&&b=222&c&d='
|
|
174
|
+
# )
|
|
171
175
|
# cgi = CGI.new
|
|
172
|
-
# params
|
|
173
|
-
#
|
|
174
|
-
#
|
|
175
|
-
#
|
|
176
|
-
# cgi.params['
|
|
177
|
-
# cgi.params['
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
#
|
|
181
|
-
#
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
176
|
+
# cgi.params.class # => Hash
|
|
177
|
+
# cgi.params # => {"a" => ["111"], "b" => ["222"], "c" => [], "d" => [""]}
|
|
178
|
+
# cgi.params.keys # => ["a", "b", "c", "d"]
|
|
179
|
+
# cgi.params['a'] # => ["111"] # Returns an array.
|
|
180
|
+
# cgi.params['d'] # => [""] # Returns empty string in array if no value.
|
|
181
|
+
# cgi.params['x'] # => [] # Returns empty array if no key.
|
|
182
|
+
#
|
|
183
|
+
# A \CGI instance has these convenience methods:
|
|
184
|
+
#
|
|
185
|
+
# # Convenience method for cgi.params.keys.
|
|
186
|
+
# cgi.keys # => ["a", "b", "c", "d"]
|
|
187
|
+
# # Convenience method for cgi.params[key].first.
|
|
188
|
+
# cgi['a'] # => "111" # Returns string, not array.
|
|
189
|
+
# cgi['d'] # => "" # Returns empty string if no value.
|
|
190
|
+
# cgi['x'] # => "" # Returns empty string if no key.
|
|
191
|
+
# # Convenience method for cgi.params.include?.
|
|
192
|
+
# cgi.include?('a') # => true
|
|
193
|
+
# cgi.include?('x') # => false
|
|
194
|
+
#
|
|
195
|
+
# ==== Save and Restore Form Values
|
|
196
|
+
#
|
|
197
|
+
# This example uses {Pstore}[https://docs.ruby-lang.org/en/3.4/PStore.html]
|
|
198
|
+
# to store and retrieve form values:
|
|
199
|
+
#
|
|
200
|
+
# ENV.update(
|
|
201
|
+
# 'REQUEST_METHOD' => 'GET',
|
|
202
|
+
# 'QUERY_STRING' => 'a=111&&b=222&c&d='
|
|
203
|
+
# )
|
|
204
|
+
# cgi = CGI.new
|
|
205
|
+
# require 'pstore'
|
|
206
|
+
# store = PStore.new('params.store')
|
|
207
|
+
# store.transaction do
|
|
208
|
+
# store['params'] = cgi.params
|
|
188
209
|
# end
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
#
|
|
192
|
-
#
|
|
193
|
-
# require "pstore"
|
|
194
|
-
# db = PStore.new("query.db")
|
|
195
|
-
# db.transaction do
|
|
196
|
-
# cgi.params = db["params"]
|
|
210
|
+
# cgi.params.clear # Oops! Lost my params!
|
|
211
|
+
# store.transaction do
|
|
212
|
+
# cgi.params = store['params']
|
|
197
213
|
# end
|
|
214
|
+
# cgi.params # => {"a" => ["111"], "b" => ["222"], "c" => [], "d" => [""]}
|
|
198
215
|
#
|
|
216
|
+
# ==== Get multipart form values
|
|
199
217
|
#
|
|
200
|
-
# === Get multipart form values
|
|
201
|
-
#
|
|
202
|
-
# require "cgi"
|
|
203
218
|
# cgi = CGI.new
|
|
204
219
|
# value = cgi['field_name'] # <== value string for 'field_name'
|
|
205
220
|
# value.read # <== body of value
|
|
@@ -211,7 +226,6 @@
|
|
|
211
226
|
#
|
|
212
227
|
# === Get cookie values
|
|
213
228
|
#
|
|
214
|
-
# require "cgi"
|
|
215
229
|
# cgi = CGI.new
|
|
216
230
|
# values = cgi.cookies['name'] # <== array of 'name'
|
|
217
231
|
# # if not 'name' included, then return [].
|
|
@@ -221,7 +235,6 @@
|
|
|
221
235
|
#
|
|
222
236
|
# === Get cookie objects
|
|
223
237
|
#
|
|
224
|
-
# require "cgi"
|
|
225
238
|
# cgi = CGI.new
|
|
226
239
|
# for name, cookie in cgi.cookies
|
|
227
240
|
# cookie.expires = Time.now + 30
|
|
@@ -230,14 +243,12 @@
|
|
|
230
243
|
#
|
|
231
244
|
# cgi.cookies # { "name1" => cookie1, "name2" => cookie2, ... }
|
|
232
245
|
#
|
|
233
|
-
# require "cgi"
|
|
234
246
|
# cgi = CGI.new
|
|
235
247
|
# cgi.cookies['name'].expires = Time.now + 30
|
|
236
248
|
# cgi.out("cookie" => cgi.cookies['name']) {"string"}
|
|
237
249
|
#
|
|
238
250
|
# === Print http header and html string to $DEFAULT_OUTPUT ($>)
|
|
239
251
|
#
|
|
240
|
-
# require "cgi"
|
|
241
252
|
# cgi = CGI.new("html4") # add HTML generation methods
|
|
242
253
|
# cgi.out do
|
|
243
254
|
# cgi.html do
|
|
@@ -274,21 +285,22 @@
|
|
|
274
285
|
#
|
|
275
286
|
# === Some utility methods
|
|
276
287
|
#
|
|
277
|
-
# require 'cgi/
|
|
288
|
+
# require 'cgi/escape'
|
|
278
289
|
# CGI.escapeHTML('Usage: foo "bar" <baz>')
|
|
279
290
|
#
|
|
280
291
|
#
|
|
281
292
|
# === Some utility methods like a function
|
|
282
293
|
#
|
|
283
|
-
# require 'cgi/
|
|
284
|
-
# include CGI::
|
|
294
|
+
# require 'cgi/escape'
|
|
295
|
+
# include CGI::Escape
|
|
285
296
|
# escapeHTML('Usage: foo "bar" <baz>')
|
|
286
297
|
# h('Usage: foo "bar" <baz>') # alias
|
|
287
298
|
#
|
|
288
299
|
#
|
|
289
300
|
|
|
290
301
|
class CGI
|
|
291
|
-
|
|
302
|
+
# The version string
|
|
303
|
+
VERSION = "0.5.1"
|
|
292
304
|
end
|
|
293
305
|
|
|
294
306
|
require 'cgi/util'
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cgi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Yukihiro Matsumoto
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-
|
|
10
|
+
date: 2025-12-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Support for the Common Gateway Interface protocol.
|
|
13
13
|
email:
|
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
52
|
version: '0'
|
|
53
53
|
requirements: []
|
|
54
|
-
rubygems_version:
|
|
54
|
+
rubygems_version: 4.0.1
|
|
55
55
|
specification_version: 4
|
|
56
56
|
summary: Support for the Common Gateway Interface protocol.
|
|
57
57
|
test_files: []
|