The previous config of HTTP client was confusing, some were used for building client, some were used for transporting, and some were generic functions.
The caller_name_mode is used only in ClientBuilder::build, so we do not save it, and only the callee_name_mode should be saved. Additionally, this config should have one per client.
TLS can be force disabled for each client, and TLS related configs can only be used during transport, so it should be saved in ClientTransport.
And the stat of Volo-HTTP only records the cost of transporting, so it should also be saved here.
Others
Additionally, this PR supports timeout for request in MetaService, it can be set by ClientBuilder::set_request_timeout (for the whole client) or RequestBuilder::set_request_timeout (only for the request).
Motivation
The previous config of HTTP client was confusing, some were used for building client, some were used for transporting, and some were generic functions.
Solution
Old implementation
The previous config in
ClientContext
:New implementation
Config for builder:
This config is used in
ClientBuilder
and it will split into four parts for four purposes.ClientContext
Config in
ClientContext
:This config is used for request, and it has one per request.
ClientInner
The
caller_name_mode
is used only inClientBuilder::build
, so we do not save it, and only thecallee_name_mode
should be saved. Additionally, this config should have one per client.MetaService
There should be a default timeout, it is better to save it in the
MetaService
, and thefail_on_error_status
should also be in here.This config should have one per client. Note that the default timeout can be overridden by the
timeout
inClientContext
.ClientTransport
TLS can be force disabled for each client, and TLS related configs can only be used during transport, so it should be saved in
ClientTransport
.And the stat of Volo-HTTP only records the cost of transporting, so it should also be saved here.
Others
Additionally, this PR supports timeout for request in
MetaService
, it can be set byClientBuilder::set_request_timeout
(for the whole client) orRequestBuilder::set_request_timeout
(only for the request).