mirror of
https://github.com/sadoyan/aralez.git
synced 2026-05-30 03:44:06 +08:00
Merge pull request #33 from Taqman-probe/fix/skip-tls-detection-when-hc-disabled
Skip TLS detection when healthcheck: false
This commit is contained in:
@@ -53,15 +53,14 @@ async fn build_upstreams(fullist: &UpstreamsDashMap, method: &str, client: &Clie
|
|||||||
let mut innervec = Vec::new();
|
let mut innervec = Vec::new();
|
||||||
|
|
||||||
for upstream in path_entry.value().0.iter() {
|
for upstream in path_entry.value().0.iter() {
|
||||||
let tls = detect_tls(upstream.address.as_ref(), &upstream.port, client).await;
|
let tls = if upstream.healthcheck.unwrap_or(true) {
|
||||||
let is_h2 = matches!(tls.1, Some(Version::HTTP_2));
|
detect_tls(upstream.address.as_ref(), &upstream.port, client).await
|
||||||
|
|
||||||
let link = if tls.0 {
|
|
||||||
format!("https://{}:{}{}", upstream.address, upstream.port, path)
|
|
||||||
} else {
|
} else {
|
||||||
format!("http://{}:{}{}", upstream.address, upstream.port, path)
|
(false, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let is_h2 = matches!(tls.1, Some(Version::HTTP_2));
|
||||||
|
|
||||||
let mut scheme = InnerMap {
|
let mut scheme = InnerMap {
|
||||||
address: upstream.address.clone(),
|
address: upstream.address.clone(),
|
||||||
port: upstream.port,
|
port: upstream.port,
|
||||||
@@ -76,6 +75,12 @@ async fn build_upstreams(fullist: &UpstreamsDashMap, method: &str, client: &Clie
|
|||||||
};
|
};
|
||||||
|
|
||||||
if scheme.healthcheck.unwrap_or(true) {
|
if scheme.healthcheck.unwrap_or(true) {
|
||||||
|
let link = if tls.0 {
|
||||||
|
format!("https://{}:{}{}", upstream.address, upstream.port, path)
|
||||||
|
} else {
|
||||||
|
format!("http://{}:{}{}", upstream.address, upstream.port, path)
|
||||||
|
};
|
||||||
|
|
||||||
let resp = http_request(&link, method, "", client).await;
|
let resp = http_request(&link, method, "", client).await;
|
||||||
if resp.0 {
|
if resp.0 {
|
||||||
if resp.1 {
|
if resp.1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user