X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=src%2Ftest.rb;h=dcc633c5ca3e5db9590f927d9f9402566d084c38;hb=a692544765d5ce1d15e5a74b79dfcef61a2d5e59;hp=e9930052d3837eb018c5b937f2eff50e1dbd44ac;hpb=c3b0deb3d8c9f439739c79806e915c29bc1d4b84;p=pompage.git diff --git a/src/test.rb b/src/test.rb index e993005..dcc633c 100644 --- a/src/test.rb +++ b/src/test.rb @@ -1,14 +1,18 @@ +# coding: utf-8 -def pomper(r) - Dir::foreach(r){|f| - next if f[0,1] == '.' - fichier = (r == '.' ? '' : r + "/") + f - if File::directory?(fichier) - pomper(fichier) - else - p fichier +# doc : http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html +Net::HTTP.version_1_2 + +# hack : http://arosien.blogspot.com/2007/06/increasing-rubys-netbufferedio-buffer.html +module Net + class BufferedIO + def rbuf_fill + timeout(@read_timeout) { @rbuf << @io.sysread(32768) } end - } + end end -pomper("F:\\films") \ No newline at end of file +connexion = Net::HTTP::new('www.allocine.fr').start +connexion.finish +html = connexion.get("/film/fichefilm_gen_cfilm=120576.html").body +p html \ No newline at end of file