diff options
author | wakou <wakou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-24 07:10:25 +0000 |
---|---|---|
committer | wakou <wakou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-24 07:10:25 +0000 |
commit | 9cdfe3496f45c4f8e593d4d2b4fb657b93887e5a (patch) | |
tree | b5e89e07fdbb674793a36e9b48a07792cbb65b26 | |
parent | 8b1de0b1ad49733abeddd8be359ae816b29de59a (diff) | |
download | ruby-9cdfe3496f45c4f8e593d4d2b4fb657b93887e5a.tar.gz |
Wed May 24 16:03:06 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb bug fix: CGI::escape(), CGI::Cookie::new()
* lib/net/telnet.rb improve: binmode(), telnetmode() interface
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lex.c | 2 | ||||
-rw-r--r-- | lib/cgi.rb | 23 | ||||
-rw-r--r-- | lib/net/telnet.rb | 82 |
4 files changed, 87 insertions, 25 deletions
@@ -1,3 +1,8 @@ +Wed May 24 16:03:06 2000 Wakou Aoyama <wakou@fsinet.or.jp> + + * 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 <matz@netlab.co.jp> * misc/ruby-mode.el (ruby-parse-region): support `while .. do' etc. @@ -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 <ryu@jaist.ac.jp> + === 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 <wakou@fsinet.or.jp> @@ -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 <Dave@thomases.com> + === 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"] + end + end + + def telnetmode=(mode) + if (true == mode or false == mode) + @options["Telnetmode"] = mode + else + 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["Telnetmode"] = mode ? true : false + @options["Binmode"] end end - def binmode(mode = 'turn') - if 'turn' == mode - @options["Binmode"] = @options["Binmode"] ? false : true + def binmode=(mode) + if (true == mode or false == mode) + @options["Binmode"] = mode else - @options["Binmode"] = mode ? true : false + raise ArgumentError, "required true or false" end end |