mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-14 00:02:16 -04:00
Compare commits
4 Commits
23fe515eac
...
b9ee892b20
Author | SHA1 | Date | |
---|---|---|---|
|
b9ee892b20 | ||
|
af457255ca | ||
|
0397d6d814 | ||
|
4d61ba1cc2 |
48
doc/release_notes/0_24_0.md
Normal file
48
doc/release_notes/0_24_0.md
Normal file
@ -0,0 +1,48 @@
|
||||
# 0.24.0
|
||||
|
||||
## Features
|
||||
|
||||
### `:oauth` plugin
|
||||
|
||||
The `:oauth` plugin manages the handling of a given OAuth session, in that it ships with convenience methods to generate a new access token, which it then injects in all requests.
|
||||
|
||||
More info under https://honeyryderchuck.gitlab.io/httpx/wiki/OAuth
|
||||
|
||||
### session callbacks
|
||||
|
||||
HTTP request/response lifecycle events have now the ability of being intercepted via public API callback methods:
|
||||
|
||||
```ruby
|
||||
HTTPX.on_request_completed do |request|
|
||||
puts "request to #{request.uri} sent"
|
||||
end.get(...)
|
||||
```
|
||||
|
||||
More info under https://honeyryderchuck.gitlab.io/httpx/wiki/Events to know which events and callback methods are supported.
|
||||
|
||||
### `:circuit_breaker` plugin `on_circuit_open` callback
|
||||
|
||||
A callback has been introduced for the `:circuit_breaker` plugin, which is triggered when a circuit is opened.
|
||||
|
||||
```ruby
|
||||
http = HTTPX.plugin(:circuit_breaker).on_circuit_open do |req|
|
||||
puts "circuit opened for #{req.uri}"
|
||||
end
|
||||
http.get(...)
|
||||
```
|
||||
|
||||
## Improvements
|
||||
|
||||
Several `:response_cache` features have been improved:
|
||||
|
||||
* `:response_cache` plugin: response cache store has been made thread-safe.
|
||||
* cached response sharing across threads is made safer, as stringio/tempfile instances are copied instead of shared (without copying the underling string/file).
|
||||
* stale cached responses are eliminate on cache store lookup/store operations.
|
||||
* already closed responses are evicted from the cache store.
|
||||
* fallback for lack of compatible response "date" header has been fixed to return a `Time` object.
|
||||
|
||||
## Bugfixes
|
||||
|
||||
* Ability to recover from errors happening during response chunk processing (required for overriding behaviour and response chunk callbacks); error bubbling up will result in the connection being closed.
|
||||
* Happy eyeballs support for multi-homed early-resolved domain names (such as `localhost` under `/etc/hosts`) was broken, as it would try the first given IP; so, if given `::1` and connection would fail, it wouldn't try `127.0.0.1`, which would have succeeded.
|
||||
* `:digest_authentication` plugin was removing the "algorithm" header on `-sess` declared algorithms, which is required for HTTP digest auth negotiation.
|
@ -203,6 +203,27 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
|
||||
o.lazy
|
||||
end
|
||||
|
||||
if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
|
||||
option :service_name do |o|
|
||||
o.default do
|
||||
TRACING_MODULE::Contrib::SpanAttributeSchema.fetch_service_name(
|
||||
"DD_TRACE_HTTPX_SERVICE_NAME",
|
||||
"httpx"
|
||||
)
|
||||
end
|
||||
o.lazy
|
||||
end
|
||||
else
|
||||
option :service_name do |o|
|
||||
o.default do
|
||||
ENV.fetch("DD_TRACE_HTTPX_SERVICE_NAME", "httpx")
|
||||
end
|
||||
o.lazy
|
||||
end
|
||||
end
|
||||
|
||||
option :distributed_tracing, default: true
|
||||
|
||||
option :error_handler, default: DEFAULT_ERROR_HANDLER
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module HTTPX
|
||||
VERSION = "0.23.4"
|
||||
VERSION = "0.24.0"
|
||||
end
|
||||
|
@ -56,27 +56,29 @@ module Requests
|
||||
|
||||
# NTLM
|
||||
|
||||
def test_plugin_ntlm_authentication
|
||||
return if origin.start_with?("https")
|
||||
if RUBY_VERSION < "3.1.0"
|
||||
def test_plugin_ntlm_authentication
|
||||
return if origin.start_with?("https")
|
||||
|
||||
start_test_servlet(NTLMServer) do |server|
|
||||
uri = "#{server.origin}/"
|
||||
HTTPX.plugin(SessionWithPool).plugin(:ntlm_authentication).wrap do |http|
|
||||
# skip unless NTLM
|
||||
no_auth_response = http.get(uri)
|
||||
verify_status(no_auth_response, 401)
|
||||
no_auth_response.close
|
||||
start_test_servlet(NTLMServer) do |server|
|
||||
uri = "#{server.origin}/"
|
||||
HTTPX.plugin(SessionWithPool).plugin(:ntlm_authentication).wrap do |http|
|
||||
# skip unless NTLM
|
||||
no_auth_response = http.get(uri)
|
||||
verify_status(no_auth_response, 401)
|
||||
no_auth_response.close
|
||||
|
||||
response = http.ntlm_auth("user", "password").get(uri)
|
||||
verify_status(response, 200)
|
||||
response = http.ntlm_auth("user", "password").get(uri)
|
||||
verify_status(response, 200)
|
||||
|
||||
# bypass
|
||||
response = http.get(build_uri("/get"))
|
||||
verify_status(response, 200)
|
||||
response = http.ntlm_auth("user", "password").get(build_uri("/get"))
|
||||
verify_status(response, 200)
|
||||
# invalid_response = http.ntlm_authentication("user", "fake").get(uri)
|
||||
# verify_status(invalid_response, 401)
|
||||
# bypass
|
||||
response = http.get(build_uri("/get"))
|
||||
verify_status(response, 200)
|
||||
response = http.ntlm_auth("user", "password").get(build_uri("/get"))
|
||||
verify_status(response, 200)
|
||||
# invalid_response = http.ntlm_authentication("user", "fake").get(uri)
|
||||
# verify_status(invalid_response, 401)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user