Commit 57fe09e3 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Kill a dead branch when building a probe request

We have two fallbacks in the absence of a .host_header field in the
backend, one of which is systematic. We can build a non .request probe
request with a single printf statement.

Please note that when the .host field is in the form "$addr $port" we
use that as the probe's host header. This behavior is not introduced by
this change but ultimately we might want to do something about it and
for example capture the first token from hosthdr with a txt.
parent 79cf4bac
......@@ -586,12 +586,14 @@ vbp_build_req(struct vbp_target *vt, const struct vrt_backend_probe *vbp,
if (vbp->request != NULL) {
VSB_cat(vsb, vbp->request);
} else {
VSB_printf(vsb, "GET %s HTTP/1.1\r\n",
vbp->url != NULL ? vbp->url : "/");
if (be->hosthdr != NULL)
VSB_printf(vsb, "Host: %s\r\n", be->hosthdr);
VSB_cat(vsb, "Connection: close\r\n");
VSB_cat(vsb, "\r\n");
AN(be->hosthdr);
VSB_printf(vsb,
"GET %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Connection: close\r\n"
"\r\n",
vbp->url != NULL ? vbp->url : "/",
be->hosthdr);
}
AZ(VSB_finish(vsb));
vt->req = strdup(VSB_data(vsb));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment