Module: HTTPX::Plugins::StreamBidi::HTTP2Methods
- Defined in:
- lib/httpx/plugins/stream_bidi.rb,
sig/plugins/stream_bidi.rbs
Overview
Extension of the Connection::HTTP2 class, which adds functionality to deal with a request that can't be drained and must be interleaved with the response streams.
The streams keeps send DATA frames while there's data; when they're ain't, the stream is kept open; it must be explicitly closed by the end user.
Instance Method Summary collapse
-
#end_stream?(request, next_chunk) ⇒ Boolean
sets end-stream flag when the request is closed.
- #handle_stream(stream, request) ⇒ void
- #initialize ⇒ Object
Instance Method Details
#end_stream?(request, next_chunk) ⇒ Boolean
sets end-stream flag when the request is closed.
87 88 89 90 91 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 87 def end_stream?(request, next_chunk) return super unless @options.stream request.closed? && next_chunk.nil? end |
#handle_stream(stream, request) ⇒ void
This method returns an undefined value.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 61 def handle_stream(stream, request) return super unless @options.stream request.flush_buffer_on_body do next unless request.headers_sent handle(request, stream) emit(:flush_buffer) end super end |
#initialize ⇒ Object
20 21 22 23 |
# File 'lib/httpx/plugins/stream_bidi.rb', line 20 def initialize(*) super @lock = Thread::Mutex.new end |