X-Git-Url: http://git.euphorik.ch/?p=pompage.git;a=blobdiff_plain;f=src%2Ftest.rb;fp=src%2Ftest.rb;h=dcc633c5ca3e5db9590f927d9f9402566d084c38;hp=9a4edba97dfbc28a270852abb88348ddc8208bc6;hb=28e1ecf7c5b45d5deeb87d488f32d44e0ea2fd11;hpb=24c9009ce5a7607182eec2acd561cb81bfb2c8fa diff --git a/src/test.rb b/src/test.rb index 9a4edba..dcc633c 100644 --- a/src/test.rb +++ b/src/test.rb @@ -1,8 +1,18 @@ # coding: utf-8 -html = '
' -// =~ html -url = URI.parse($1) -p url.host -nbRetry = 0 -p "youpla" if (nbRetry += 1) < 5 \ No newline at end of file +# 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 + +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