[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: nuby: can't get an image via http
From:       Emmanuel Touzery <emmanuel.touzery () wanadoo ! fr>
Date:       2004-02-02 7:19:48
Message-ID: 401DFAA3.5030101 () wanadoo ! fr
[Download RAW message or body]

Tanaka Akira wrote:

>>I confirm that the code i posted in the previous message (and that I repost 
>>here) works under linux. the fact it doesn't work under windows is definitely 
>>related to the binary flag of the files. maybe it's a bug in open-uri that 
>>the file is not in binary mode?
>>    
>>
>
>How about following patch?
>
>Index: lib/open-uri.rb
>===================================================================
>RCS file: /src/ruby/lib/open-uri.rb,v
>retrieving revision 1.19
>diff -p -u -r1.19 open-uri.rb
>--- lib/open-uri.rb	31 Jan 2004 18:11:54 -0000	1.19
>+++ lib/open-uri.rb	31 Jan 2004 20:12:57 -0000
>@@ -221,6 +221,7 @@ module OpenURI
>       if StringIO === @io && StringMax < @size
>         require 'tempfile'
>         io = Tempfile.new('open-uri')
>+        io.binmode
>         Meta.init io, @io if Meta === @io
>         io << @io.string
>         @io = io
>  
>
That's it! The patch *looked* right, but now it's tested right. it's now 
working. It should be commited to ruby-cvs!

emmanuel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic