[Nitro] Broken Net::HTTP in ruby 1.8.3+ [slightly OT]

Rob Pitt rob at motionpath.com
Thu Feb 2 13:07:48 EST 2006


I think I mentioned this a long time ago but was silly enough to install
1.8.4 somewhere critical again, this fix was sufficient to fix my
problems with this library under the new version so I provide it here in
case anyone else was being given headaches by it.

--- ../net2/http.rb     Tue Sep 13 17:27:02 2005
+++ http.rb     Thu Feb  2 17:57:08 2006
@@ -1158,7 +1158,7 @@
         @header.delete key.downcase
         return val
       end
-      @header[key.downcase] = Array(val).map {|s| s.to_str }
+      @header[key.downcase] = [val.to_str.dup]
     end

     # [Ruby 1.8.3]
@@ -1178,9 +1178,9 @@
     #
     def add_field(key, val)
       if @header.key?(key.downcase)
-        @header[key.downcase].concat Array(val)
+        @header[key.downcase].concat [val.dup]
       else
-        @header[key.downcase] = Array(val).dup
+        @header[key.downcase] = [val.dup]
       end
     end





More information about the Nitro-general mailing list