Skip to content

Commit 45e24c7

Browse files
joemillerneuronull
andauthored
fix(vector sink): cert verification with proxy enabled (vectordotdev#17651)
fixes vectordotdev#17629 <!-- **Your PR title must conform to the conventional commit spec!** <type>(<scope>)!: <description> * `type` = chore, enhancement, feat, fix, docs * `!` = OPTIONAL: signals a breaking change * `scope` = Optional when `type` is "chore" or "docs", available scopes https://github.com/vectordotdev/vector/blob/master/.github/semantic.yml#L20 * `description` = short description of the change Examples: * enhancement(file source): Add `sort` option to sort discovered files * feat(new source): Initial `statsd` source * fix(file source): Fix a bug discovering new files * chore(external docs): Clarify `batch_size` option --> --------- Co-authored-by: neuronull <[email protected]>
1 parent 9765809 commit 45e24c7

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

src/sinks/vector/config.rs

+3-18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::{
1616
AcknowledgementsConfig, GenerateConfig, Input, ProxyConfig, SinkConfig, SinkContext,
1717
SinkHealthcheckOptions,
1818
},
19+
http::build_proxy_connector,
1920
proto::vector as proto,
2021
sinks::{
2122
util::{
@@ -24,7 +25,7 @@ use crate::{
2425
},
2526
Healthcheck, VectorSink as VectorSinkType,
2627
},
27-
tls::{tls_connector_builder, MaybeTlsSettings, TlsEnableableConfig},
28+
tls::{MaybeTlsSettings, TlsEnableableConfig},
2829
};
2930

3031
/// Configuration for the `vector` sink.
@@ -209,23 +210,7 @@ fn new_client(
209210
tls_settings: &MaybeTlsSettings,
210211
proxy_config: &ProxyConfig,
211212
) -> crate::Result<hyper::Client<ProxyConnector<HttpsConnector<HttpConnector>>, BoxBody>> {
212-
let mut http = HttpConnector::new();
213-
http.enforce_http(false);
214-
215-
let tls = tls_connector_builder(tls_settings)?;
216-
let mut https = HttpsConnector::with_connector(http, tls)?;
217-
218-
let settings = tls_settings.tls().cloned();
219-
https.set_callback(move |c, _uri| {
220-
if let Some(settings) = &settings {
221-
settings.apply_connect_configuration(c);
222-
}
223-
224-
Ok(())
225-
});
226-
227-
let mut proxy = ProxyConnector::new(https).unwrap();
228-
proxy_config.configure(&mut proxy)?;
213+
let proxy = build_proxy_connector(tls_settings.clone(), proxy_config)?;
229214

230215
Ok(hyper::Client::builder().http2_only(true).build(proxy))
231216
}

0 commit comments

Comments
 (0)