From d69914f1bcda4d9f09c96167b378f7ccd842ccb7 Mon Sep 17 00:00:00 2001 From: Hans de Graaff Date: Fri, 22 Aug 2014 17:50:06 +0200 Subject: Fix compatibility with fcgi 0.9. --- lib/gorg/cgi.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/gorg/cgi.rb b/lib/gorg/cgi.rb index dfe8451..b6dca40 100644 --- a/lib/gorg/cgi.rb +++ b/lib/gorg/cgi.rb @@ -59,7 +59,17 @@ module Gorg path_info = cgi.env_table['SCRIPT_NAME'] end query = Hash.new - cgi.params.each{ |p, v| query[p] = v.to_s} + cgi.params.each do |p, v| + # fcgi 0.9 always provides an Array even with one + # argument. Gorg only handles one argument, as far as I can + # tell, so we take the first value in that case. + value = if v.class == Array + v.first + else + v + end + query[p] = value.to_s + end # Get DOCUMENT_ROOT from environment $Config["root"] = cgi.env_table['DOCUMENT_ROOT'] -- cgit v1.2.3-65-gdbad