mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-16 22:31:42 +01:00
MINOR: proxy: Store monitor_uri as a struct ist
The monitor_uri is already processed as an ist in `http_wait_for_request`, lets
also just store it as such.
see 0643b0e7e ("MINOR: proxy: Make `header_unique_id` a `struct ist`") for a
very similar past commit.
This commit is contained in:
parent
5ce1299c64
commit
4b1fcaaee3
@ -322,8 +322,7 @@ struct proxy {
|
||||
int srvtcpka_cnt; /* The maximum number of keepalive probes TCP should send before dropping the connection. (server side) */
|
||||
int srvtcpka_idle; /* The time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes. (server side) */
|
||||
int srvtcpka_intvl; /* The time (in seconds) between individual keepalive probes. (server side) */
|
||||
int monitor_uri_len; /* length of the string above. 0 if unused */
|
||||
char *monitor_uri; /* a special URI to which we respond with HTTP/200 OK */
|
||||
struct ist monitor_uri; /* a special URI to which we respond with HTTP/200 OK */
|
||||
struct list mon_fail_cond; /* list of conditions to fail monitoring requests (chained) */
|
||||
struct { /* WARNING! check proxy_reset_timeouts() in proxy.h !!! */
|
||||
int client; /* client I/O timeout (in ticks) */
|
||||
|
||||
@ -575,13 +575,10 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
|
||||
free(curproxy->monitor_uri);
|
||||
curproxy->monitor_uri_len = strlen(args[1]);
|
||||
curproxy->monitor_uri = calloc(1, curproxy->monitor_uri_len + 1);
|
||||
if (!curproxy->monitor_uri)
|
||||
istfree(&curproxy->monitor_uri);
|
||||
curproxy->monitor_uri = istdup(ist(args[1]));
|
||||
if (!isttest(curproxy->monitor_uri))
|
||||
goto alloc_error;
|
||||
memcpy(curproxy->monitor_uri, args[1], curproxy->monitor_uri_len);
|
||||
curproxy->monitor_uri[curproxy->monitor_uri_len] = '\0';
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -203,9 +203,8 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
* used. It is a workaround to let HTTP/2 health-checks work as
|
||||
* expected.
|
||||
*/
|
||||
if (unlikely(sess->fe->monitor_uri_len != 0)) {
|
||||
const struct ist monitor_uri = ist2(sess->fe->monitor_uri,
|
||||
sess->fe->monitor_uri_len);
|
||||
if (unlikely(isttest(sess->fe->monitor_uri))) {
|
||||
const struct ist monitor_uri = sess->fe->monitor_uri;
|
||||
struct http_uri_parser parser = http_uri_parser_init(htx_sl_req_uri(sl));
|
||||
|
||||
if ((istptr(monitor_uri)[0] == '/' &&
|
||||
|
||||
11
src/proxy.c
11
src/proxy.c
@ -156,7 +156,7 @@ void free_proxy(struct proxy *p)
|
||||
free(p->lbprm.arg_str);
|
||||
free(p->server_state_file_name);
|
||||
free(p->capture_name);
|
||||
free(p->monitor_uri);
|
||||
istfree(&p->monitor_uri);
|
||||
free(p->rdp_cookie_name);
|
||||
free(p->invalid_rep);
|
||||
free(p->invalid_req);
|
||||
@ -1274,7 +1274,7 @@ int proxy_cfg_ensure_no_http(struct proxy *curproxy)
|
||||
ha_warning("cookie will be ignored for %s '%s' (needs 'mode http').\n",
|
||||
proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
if (curproxy->monitor_uri != NULL) {
|
||||
if (isttest(curproxy->monitor_uri)) {
|
||||
ha_warning("monitor-uri will be ignored for %s '%s' (needs 'mode http').\n",
|
||||
proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
@ -1436,7 +1436,7 @@ void proxy_free_defaults(struct proxy *defproxy)
|
||||
ha_free(&defproxy->cookie_attrs);
|
||||
ha_free(&defproxy->lbprm.arg_str);
|
||||
ha_free(&defproxy->capture_name);
|
||||
ha_free(&defproxy->monitor_uri);
|
||||
istfree(&defproxy->monitor_uri);
|
||||
ha_free(&defproxy->defbe.name);
|
||||
ha_free(&defproxy->conn_src.iface_name);
|
||||
ha_free(&defproxy->fwdfor_hdr_name); defproxy->fwdfor_hdr_len = 0;
|
||||
@ -1711,9 +1711,8 @@ static int proxy_defproxy_cpy(struct proxy *curproxy, const struct proxy *defpro
|
||||
curproxy->timeout.tarpit = defproxy->timeout.tarpit;
|
||||
curproxy->timeout.httpreq = defproxy->timeout.httpreq;
|
||||
curproxy->timeout.httpka = defproxy->timeout.httpka;
|
||||
if (defproxy->monitor_uri)
|
||||
curproxy->monitor_uri = strdup(defproxy->monitor_uri);
|
||||
curproxy->monitor_uri_len = defproxy->monitor_uri_len;
|
||||
if (isttest(defproxy->monitor_uri))
|
||||
curproxy->monitor_uri = istdup(defproxy->monitor_uri);
|
||||
if (defproxy->defbe.name)
|
||||
curproxy->defbe.name = strdup(defproxy->defbe.name);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user