Class: ThreadedProxy::HTTP
- Inherits:
-
Net::HTTP
- Object
- Net::HTTP
- ThreadedProxy::HTTP
- Defined in:
- lib/threaded_proxy/http.rb
Instance Method Summary collapse
- #copy_to(dest_socket) ⇒ Object
- #flush_existing_buffer_to(dest_socket) ⇒ Object
- #request(*args) ⇒ Object
Instance Method Details
#copy_to(dest_socket) ⇒ Object
17 18 19 |
# File 'lib/threaded_proxy/http.rb', line 17 def copy_to(dest_socket) IO.copy_stream(@socket.io, dest_socket) end |
#flush_existing_buffer_to(dest_socket) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/threaded_proxy/http.rb', line 7 def flush_existing_buffer_to(dest_socket) while (data = @socket.send(:rbuf_consume)) break if data.empty? dest_socket.write data end dest_socket.flush end |
#request(*args) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/threaded_proxy/http.rb', line 21 def request(*args) if block_given? super { |res| yield hijack_response(res) } else hijack_response(super) end end |