Tanaka wrote: > For example: > > % ruby -rlib/open-uri -e 'open("http://www.ruby-lang.org/en/",:progress_proc => lambda {|pos, total| p [pos, total]})' > [720, 15324] > [1144, 15324] > ... > [15200, 15324] > [15324, 15324] > > If Content-Length is not given: > > % ruby -rlib/open-uri -e 'open("http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/",:progress_proc => lambda {|pos, total| p [pos, total]})' > [837, nil] > ... > [5534, nil] nice! that works for me. i was not thinking that the the total was provided (duh!) > But http://www.ruby-lang.org/ reminds me redirection. > > % ruby -rlib/open-uri -e 'open("http://www.ruby-lang.org/",:progress_proc => lambda {|pos, total| p [pos, total]})' > [242, nil] > [232, nil] > [720, 15324] > [1144, 15324] > First two lines which total is nil are about redirection response. > Hm. It shouldn't be called with this interface. > > But it may mean this interface is not so nice... > > Anyone have idea? i don't see it being too much of a problem. why is it not so nice? perhaps just convert nil to 0 instead and it will be a little better? > > but maybe that's too odd? > > I don't like that. > > * It's too generic without use cases. > * It may conflict with other options in future. yes, i think you are right. but i thought i should at least toss it out there. it is neat that ruby allows you to even think of doing something like that though! :) thanks Tanaka. i look foward to using the new version of open_uri. -t0