diff --git a/ChangeLog b/ChangeLog index 560f8388b5..5d12dc93d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed May 24 16:03:06 2000 Wakou Aoyama + + * lib/cgi.rb bug fix: CGI::escape(), CGI::Cookie::new() + * lib/net/telnet.rb improve: binmode(), telnetmode() interface + Wed May 24 13:12:31 2000 Yukihiro Matsumoto * misc/ruby-mode.el (ruby-parse-region): support `while .. do' etc. diff --git a/lex.c b/lex.c index 292760c359..61b3c4e14b 100644 --- a/lex.c +++ b/lex.c @@ -1,4 +1,4 @@ -/* C code produced by gperf version 2.7.1 (19981006 egcs) */ +/* C code produced by gperf version 2.7 */ /* Command-line: gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$ ./keywords */ struct kwtable {char *name; int id[2]; enum lex_state state;}; diff --git a/lib/cgi.rb b/lib/cgi.rb index 7317670154..66336e606e 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -5,7 +5,7 @@ $Date$ cgi.rb -Version 1.31 +Version 1.40 Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan @@ -185,7 +185,7 @@ class CGI EOL = CR + LF v = $-v $-v = false - VERSION = "1.31" + VERSION = "1.40" RELEASE_DATE = "$Date$" $-v = v @@ -239,8 +239,12 @@ $-v = v url_encoded_string = CGI::escape("string") =end def CGI::escape(string) - string.gsub(/ /n, '+').gsub(/([^a-zA-Z0-9_.-])/n) do - sprintf("%%%02X", $1.unpack("C")[0]) + string.gsub(/([^a-zA-Z0-9_.-])/n) do + if " " == $1 + "+" + else + sprintf("%%%02X", $1.unpack("C")[0]) + end end end @@ -603,7 +607,7 @@ convert string charset, and set language to "ja". @path = @path[0...@path.rindex(ENV["PATH_INFO"])] end else - @path = ENV["SCRIPT_NAME"] or "" + @path = (ENV["SCRIPT_NAME"] or "") end @domain = options["domain"] @expires = options["expires"] @@ -1901,6 +1905,15 @@ end == HISTORY +=== Version 1.40 - wakou + +2000/05/24 06:58:51 + +- typo: CGI::Cookie::new() +- bug fix: CGI::escape() + bad: " " --> "%2B" true: " " --> "+" + thanks to Ryunosuke Ohshima + === Version 1.31 - wakou 2000/05/08 21:51:30 diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb index 30e2e4c5d1..6476a645d7 100644 --- a/lib/net/telnet.rb +++ b/lib/net/telnet.rb @@ -5,7 +5,7 @@ $Date$ net/telnet.rb -Version 1.32 +Version 1.40 Wakou Aoyama @@ -91,18 +91,18 @@ of cource, set sync=true or flush is necessary. # == host.write("string\n") -=== TURN TELNET COMMAND INTERPRETATION +=== TOGGLE TELNET COMMAND INTERPRETATION - host.telnetmode # turn on/off - host.telnetmode(true) # on - host.telnetmode(false) # off + host.telnetmode # return the current status (true or false) + host.telnetmode = true # do telnet command interpretation (default) + host.telnetmode = false # don't telnet command interpretation === TOGGLE NEWLINE TRANSLATION - host.binmode # turn true/false - host.binmode(true) # no translate newline - host.binmode(false) # translate newline + host.binmode # return the current status (true or false) + host.binmode = true # no translate newline + host.binmode = false # translate newline (default) === LOGIN @@ -157,6 +157,13 @@ of cource, set sync=true or flush is necessary. == HISTORY +=== Version 1.40 + +2000/05/24 06:57:38 + +- improve: binmode(), telnetmode() interface + thanks to Dave Thomas + === Version 1.32 2000/05/09 22:02:56 @@ -450,19 +457,32 @@ module Net EOL = CR + LF v = $-v $-v = false - VERSION = "1.32" + VERSION = "1.40" RELEASE_DATE = "$Date$" $-v = v def initialize(options) @options = options - @options["Binmode"] = false unless @options.has_key?("Binmode") @options["Host"] = "localhost" unless @options.has_key?("Host") @options["Port"] = 23 unless @options.has_key?("Port") @options["Prompt"] = /[$%#>] \z/n unless @options.has_key?("Prompt") - @options["Telnetmode"] = true unless @options.has_key?("Telnetmode") @options["Timeout"] = 10 unless @options.has_key?("Timeout") @options["Waittime"] = 0 unless @options.has_key?("Waittime") + unless @options.has_key?("Binmode") + @options["Binmode"] = false + else + unless (true == @options["Binmode"] or false == @options["Binmode"]) + raise ArgumentError, "Binmode option required true or false" + end + end + + unless @options.has_key?("Telnetmode") + @options["Telnetmode"] = true + else + unless (true == @options["Telnetmode"] or false == @options["Telnetmode"]) + raise ArgumentError, "Telnetmode option required true or false" + end + end @telnet_option = { "SGA" => false, "BINARY" => false } @@ -542,19 +562,43 @@ module Net attr :sock - def telnetmode(mode = 'turn') - if 'turn' == mode - @options["Telnetmode"] = @options["Telnetmode"] ? false : true + def telnetmode(mode = nil) + if mode + if (true == mode or false == mode) + @options["Telnetmode"] = mode + else + raise ArgumentError, "required true or false" + end else - @options["Telnetmode"] = mode ? true : false + @options["Telnetmode"] end end - def binmode(mode = 'turn') - if 'turn' == mode - @options["Binmode"] = @options["Binmode"] ? false : true + def telnetmode=(mode) + if (true == mode or false == mode) + @options["Telnetmode"] = mode else - @options["Binmode"] = mode ? true : false + raise ArgumentError, "required true or false" + end + end + + def binmode(mode = nil) + if mode + if (true == mode or false == mode) + @options["Binmode"] = mode + else + raise ArgumentError, "required true or false" + end + else + @options["Binmode"] + end + end + + def binmode=(mode) + if (true == mode or false == mode) + @options["Binmode"] = mode + else + raise ArgumentError, "required true or false" end end