* lib/net/telnet.rb: Telnet#print not add "\n".
* lib/cgi.rb: cgi['key'] is equal cgi['key'][0] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
564b20a38e
commit
2c5e792dd2
@ -1,3 +1,9 @@
|
|||||||
|
Fri Dec 27 02:45:17 2002 Wakou Aoyama <wakou@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/telnet.rb: Telnet#print not add "\n".
|
||||||
|
|
||||||
|
* lib/cgi.rb: cgi['key'] is equal cgi['key'][0]
|
||||||
|
|
||||||
Thu Dec 26 22:33:18 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
Thu Dec 26 22:33:18 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* ext/extmk.rb (create_makefile): check only `-' option.
|
* ext/extmk.rb (create_makefile): check only `-' option.
|
||||||
|
35
lib/cgi.rb
35
lib/cgi.rb
@ -18,8 +18,8 @@ Wakou Aoyama <wakou@ruby-lang.org>
|
|||||||
|
|
||||||
require "cgi"
|
require "cgi"
|
||||||
cgi = CGI.new
|
cgi = CGI.new
|
||||||
values = cgi['field_name'] # <== array of 'field_name'
|
value = cgi['field_name'] # <== value string for 'field_name'
|
||||||
# if not 'field_name' included, then return [].
|
# if not 'field_name' included, then return "".
|
||||||
fields = cgi.keys # <== array of field names
|
fields = cgi.keys # <== array of field names
|
||||||
|
|
||||||
# returns true if form has 'field_name'
|
# returns true if form has 'field_name'
|
||||||
@ -27,6 +27,8 @@ Wakou Aoyama <wakou@ruby-lang.org>
|
|||||||
cgi.has_key?('field_name')
|
cgi.has_key?('field_name')
|
||||||
cgi.include?('field_name')
|
cgi.include?('field_name')
|
||||||
|
|
||||||
|
CAUTION! cgi['field_name'] retuen Array with old cgi.rb(included ruby 1.6)
|
||||||
|
|
||||||
|
|
||||||
=== GET FORM VALUES AS HASH
|
=== GET FORM VALUES AS HASH
|
||||||
|
|
||||||
@ -64,13 +66,13 @@ cgi.params is a hash.
|
|||||||
|
|
||||||
require "cgi"
|
require "cgi"
|
||||||
cgi = CGI.new
|
cgi = CGI.new
|
||||||
values = cgi['field_name'] # <== array of 'field_name'
|
value = cgi['field_name'] # <== value string for 'field_name'
|
||||||
values[0].read # <== body of values[0]
|
value.read # <== body of value
|
||||||
values[0].local_path # <== path to local file of values[0]
|
value.local_path # <== path to local file of value
|
||||||
values[0].original_filename # <== original filename of values[0]
|
value.original_filename # <== original filename of value
|
||||||
values[0].content_type # <== content_type of values[0]
|
value.content_type # <== content_type of value
|
||||||
|
|
||||||
and values[0] has StringIO or Tempfile class methods.
|
and value has StringIO or Tempfile class methods.
|
||||||
|
|
||||||
|
|
||||||
=== GET COOKIE VALUES
|
=== GET COOKIE VALUES
|
||||||
@ -939,8 +941,21 @@ convert string charset, and set language to "ja".
|
|||||||
end
|
end
|
||||||
private :initialize_query
|
private :initialize_query
|
||||||
|
|
||||||
def [](*args)
|
def [](key)
|
||||||
@params[*args]
|
value = @params[key][0]
|
||||||
|
def value.[](key)
|
||||||
|
$stderr.puts <<END
|
||||||
|
CAUTION! cgi['key'] == cgi.params['key'][0] If want Array, use cgi.params['key']
|
||||||
|
END
|
||||||
|
self
|
||||||
|
end
|
||||||
|
def value.first
|
||||||
|
$stderr.puts <<END
|
||||||
|
CAUTION! cgi['key'] == cgi.params['key'][0] If want Array, use cgi.params['key']
|
||||||
|
END
|
||||||
|
self
|
||||||
|
end
|
||||||
|
value
|
||||||
end
|
end
|
||||||
|
|
||||||
def keys(*args)
|
def keys(*args)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
net/telnet.rb - simple telnet client library
|
net/telnet.rb - simple telnet client library
|
||||||
|
|
||||||
Wakou Aoyama <wakou@fsinet.or.jp>
|
Wakou Aoyama <wakou@ruby-lang.org>
|
||||||
|
|
||||||
|
|
||||||
=== MAKE NEW TELNET OBJECT
|
=== MAKE NEW TELNET OBJECT
|
||||||
@ -90,7 +90,7 @@ of cource, set sync=true or flush is necessary.
|
|||||||
|
|
||||||
Telnet#puts() adds "\n" to the last of "string".
|
Telnet#puts() adds "\n" to the last of "string".
|
||||||
|
|
||||||
WARNING: Telnet#print() NOT adds "\n" to the last of "string", in the future.
|
CAUTION: Telnet#print() NOT adds "\n" to the last of "string".
|
||||||
|
|
||||||
If "Telnetmode" option is true, then escape IAC code ("\xFF"). If
|
If "Telnetmode" option is true, then escape IAC code ("\xFF"). If
|
||||||
"Binmode" option is false, then convert "\n" to EOL(end of line) code.
|
"Binmode" option is false, then convert "\n" to EOL(end of line) code.
|
||||||
@ -504,7 +504,7 @@ module Net
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def _print(string)
|
def print(string)
|
||||||
string = string.gsub(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"]
|
string = string.gsub(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"]
|
||||||
|
|
||||||
if @options["Binmode"]
|
if @options["Binmode"]
|
||||||
@ -524,15 +524,7 @@ module Net
|
|||||||
end
|
end
|
||||||
|
|
||||||
def puts(string)
|
def puts(string)
|
||||||
self._print(string + "\n")
|
self.print(string + "\n")
|
||||||
end
|
|
||||||
|
|
||||||
def print(string)
|
|
||||||
if $VERBOSE
|
|
||||||
$stderr.puts 'WARNING: Telnet#print("string") NOT adds "\n" to the last of "string", in the future.'
|
|
||||||
$stderr.puts ' cf. Telnet#puts().'
|
|
||||||
end
|
|
||||||
self.puts(string)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cmd(options)
|
def cmd(options)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user