summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/cgi/core.rb15
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 40d9775c8f..52abb259b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Oct 4 00:59:52 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi/core.rb: fix command-line option of
+ non-interactive terminal. [ruby-core:23016]
+
Sun Oct 4 00:40:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rake/contrib: added. [ruby-core:25918]
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 02daf14e50..240d3bb714 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -555,12 +555,21 @@ class CGI
%|(offline mode: enter name=value pairs on standard input)\n|
)
end
- readlines.join(' ').gsub(/\n/, '')
- end.gsub(/\\=/, '%3D').gsub(/\\&/, '%26')
+ array = nil
+ begin
+ readlines
+ rescue
+ end
+ if not array.nil?
+ array.join(' ').gsub(/\n/n, '')
+ else
+ ""
+ end
+ end.gsub(/\\=/n, '%3D').gsub(/\\&/n, '%26')
words = Shellwords.shellwords(string)
- if words.find{|x| /=/.match(x) }
+ if words.find{|x| /=/n.match(x) }
words.join('&')
else
words.join('+')