Advertisement
Guest User

Untitled

a guest
Nov 27th, 2011
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. # Monkey patch for timeout-free net/http io on JRuby
  2. if defined?(JRUBY_VERSION)
  3. require 'net/http'
  4. class Net::BufferedIO #:nodoc:
  5. alias :old_rbuf_fill :rbuf_fill
  6. def rbuf_fill
  7. if IO.select([@io], nil, nil, @read_timeout)
  8. @rbuf << @io.read(65536)
  9. else
  10. raise Timeout::TimeoutError
  11. end
  12. end
  13. end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement