mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-12 00:01:58 -04:00
http2: emiting parser as well, as it makes writing custom logic easier
This commit is contained in:
parent
761ecb800d
commit
9a3f816e46
@ -7,6 +7,8 @@ module HTTPX
|
||||
include Callbacks
|
||||
include Loggable
|
||||
|
||||
attr_reader :streams, :pending
|
||||
|
||||
def initialize(buffer, options)
|
||||
@options = Options.new(options)
|
||||
@max_concurrent_requests = @options.max_concurrent_requests
|
||||
@ -94,7 +96,7 @@ module HTTPX
|
||||
if request.expects?
|
||||
return handle(request, stream)
|
||||
end
|
||||
response = request.response || ErrorResponse.new(error, retries)
|
||||
response = request.response || ErrorResponse.new(error, @retries)
|
||||
emit(:response, request, response)
|
||||
log(2, "#{stream.id}: ") { "closing stream" }
|
||||
|
||||
@ -202,7 +204,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
def on_promise(stream)
|
||||
emit(:promise, stream)
|
||||
emit(:promise, self, stream)
|
||||
end
|
||||
|
||||
def method_missing(meth, *args, &blk)
|
||||
|
@ -39,7 +39,7 @@ module HTTPX
|
||||
@responses[request] = response
|
||||
end
|
||||
|
||||
def on_promise(stream)
|
||||
def on_promise(_, stream)
|
||||
log(2, "#{stream.id}: ") { "refusing stream!" }
|
||||
stream.refuse
|
||||
# TODO: policy for handling promises
|
||||
|
Loading…
x
Reference in New Issue
Block a user