mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
CLEANUP: http-htx: Remove unused storage of error messages in buffers
Now, error messages are all stored in http replies. So the storage as a buffer can safely be removed.
This commit is contained in:
parent
8dfeccf6d3
commit
f1fedc3cce
@ -175,7 +175,6 @@ struct http_txn {
|
|||||||
enum http_meth_t meth; /* HTTP method */
|
enum http_meth_t meth; /* HTTP method */
|
||||||
/* 1 unused byte here */
|
/* 1 unused byte here */
|
||||||
short status; /* HTTP status from the server, negative if from proxy */
|
short status; /* HTTP status from the server, negative if from proxy */
|
||||||
struct buffer *errmsg; /* custom HTTP error message to use as reply */
|
|
||||||
struct http_reply *http_reply; /* The HTTP reply to use as reply */
|
struct http_reply *http_reply; /* The HTTP reply to use as reply */
|
||||||
|
|
||||||
char cache_hash[20]; /* Store the cache hash */
|
char cache_hash[20]; /* Store the cache hash */
|
||||||
|
@ -88,7 +88,6 @@ struct http_errors {
|
|||||||
int line; /* line where the section appears */
|
int line; /* line where the section appears */
|
||||||
} conf; /* config information */
|
} conf; /* config information */
|
||||||
|
|
||||||
struct buffer *errmsg[HTTP_ERR_SIZE]; /* customized error messages for known errors */
|
|
||||||
struct http_reply *replies[HTTP_ERR_SIZE]; /* HTTP replies for known errors */
|
struct http_reply *replies[HTTP_ERR_SIZE]; /* HTTP replies for known errors */
|
||||||
struct list list; /* http-errors list */
|
struct list list; /* http-errors list */
|
||||||
};
|
};
|
||||||
|
@ -408,7 +408,6 @@ struct proxy {
|
|||||||
int grace; /* grace time after stop request */
|
int grace; /* grace time after stop request */
|
||||||
char *check_command; /* Command to use for external agent checks */
|
char *check_command; /* Command to use for external agent checks */
|
||||||
char *check_path; /* PATH environment to use for external agent checks */
|
char *check_path; /* PATH environment to use for external agent checks */
|
||||||
struct buffer *errmsg[HTTP_ERR_SIZE]; /* default or customized error messages for known errors */
|
|
||||||
struct http_reply *replies[HTTP_ERR_SIZE]; /* HTTP replies for known errors */
|
struct http_reply *replies[HTTP_ERR_SIZE]; /* HTTP replies for known errors */
|
||||||
int uuid; /* universally unique proxy ID, used for SNMP */
|
int uuid; /* universally unique proxy ID, used for SNMP */
|
||||||
unsigned int backlog; /* force the frontend's listen backlog */
|
unsigned int backlog; /* force the frontend's listen backlog */
|
||||||
|
@ -5188,7 +5188,6 @@ void http_init_txn(struct stream *s)
|
|||||||
? (TX_NOT_FIRST|TX_WAIT_NEXT_RQ)
|
? (TX_NOT_FIRST|TX_WAIT_NEXT_RQ)
|
||||||
: 0);
|
: 0);
|
||||||
txn->status = -1;
|
txn->status = -1;
|
||||||
txn->errmsg = NULL;
|
|
||||||
txn->http_reply = NULL;
|
txn->http_reply = NULL;
|
||||||
write_u32(txn->cache_hash, 0);
|
write_u32(txn->cache_hash, 0);
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ struct conf_errors {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
int status; /* the status code associated to this error */
|
int status; /* the status code associated to this error */
|
||||||
struct buffer *msg; /* the HTX error message */
|
|
||||||
struct http_reply *reply; /* the http reply for the errorfile */
|
struct http_reply *reply; /* the http reply for the errorfile */
|
||||||
} errorfile; /* describe an "errorfile" directive */
|
} errorfile; /* describe an "errorfile" directive */
|
||||||
struct {
|
struct {
|
||||||
@ -1702,7 +1701,6 @@ static int proxy_parse_errorloc(char **args, int section, struct proxy *curpx,
|
|||||||
}
|
}
|
||||||
conf_err->type = 1;
|
conf_err->type = 1;
|
||||||
conf_err->info.errorfile.status = status;
|
conf_err->info.errorfile.status = status;
|
||||||
conf_err->info.errorfile.msg = msg;
|
|
||||||
conf_err->info.errorfile.reply = reply;
|
conf_err->info.errorfile.reply = reply;
|
||||||
|
|
||||||
conf_err->file = strdup(file);
|
conf_err->file = strdup(file);
|
||||||
@ -1766,7 +1764,6 @@ static int proxy_parse_errorfile(char **args, int section, struct proxy *curpx,
|
|||||||
}
|
}
|
||||||
conf_err->type = 1;
|
conf_err->type = 1;
|
||||||
conf_err->info.errorfile.status = status;
|
conf_err->info.errorfile.status = status;
|
||||||
conf_err->info.errorfile.msg = msg;
|
|
||||||
conf_err->info.errorfile.reply = reply;
|
conf_err->info.errorfile.reply = reply;
|
||||||
conf_err->file = strdup(file);
|
conf_err->file = strdup(file);
|
||||||
conf_err->line = line;
|
conf_err->line = line;
|
||||||
@ -1851,7 +1848,6 @@ static int proxy_check_errors(struct proxy *px)
|
|||||||
if (conf_err->type == 1) {
|
if (conf_err->type == 1) {
|
||||||
/* errorfile */
|
/* errorfile */
|
||||||
rc = http_get_status_idx(conf_err->info.errorfile.status);
|
rc = http_get_status_idx(conf_err->info.errorfile.status);
|
||||||
px->errmsg[rc] = conf_err->info.errorfile.msg;
|
|
||||||
px->replies[rc] = conf_err->info.errorfile.reply;
|
px->replies[rc] = conf_err->info.errorfile.reply;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1873,10 +1869,8 @@ static int proxy_check_errors(struct proxy *px)
|
|||||||
free(conf_err->info.errorfiles.name);
|
free(conf_err->info.errorfiles.name);
|
||||||
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
||||||
if (conf_err->info.errorfiles.status[rc] > 0) {
|
if (conf_err->info.errorfiles.status[rc] > 0) {
|
||||||
if (http_errs->errmsg[rc]) {
|
if (http_errs->replies[rc])
|
||||||
px->errmsg[rc] = http_errs->errmsg[rc];
|
|
||||||
px->replies[rc] = http_errs->replies[rc];
|
px->replies[rc] = http_errs->replies[rc];
|
||||||
}
|
|
||||||
else if (conf_err->info.errorfiles.status[rc] == 2)
|
else if (conf_err->info.errorfiles.status[rc] == 2)
|
||||||
ha_warning("config: proxy '%s' : status '%d' not declared in"
|
ha_warning("config: proxy '%s' : status '%d' not declared in"
|
||||||
" http-errors section '%s' (at %s:%d).\n",
|
" http-errors section '%s' (at %s:%d).\n",
|
||||||
@ -1936,7 +1930,6 @@ int proxy_dup_default_conf_errors(struct proxy *curpx, struct proxy *defpx, char
|
|||||||
new_conf_err->type = conf_err->type;
|
new_conf_err->type = conf_err->type;
|
||||||
if (conf_err->type == 1) {
|
if (conf_err->type == 1) {
|
||||||
new_conf_err->info.errorfile.status = conf_err->info.errorfile.status;
|
new_conf_err->info.errorfile.status = conf_err->info.errorfile.status;
|
||||||
new_conf_err->info.errorfile.msg = conf_err->info.errorfile.msg;
|
|
||||||
new_conf_err->info.errorfile.reply = conf_err->info.errorfile.reply;
|
new_conf_err->info.errorfile.reply = conf_err->info.errorfile.reply;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2057,7 +2050,6 @@ static int cfg_parse_http_errors(const char *file, int linenum, char **args, int
|
|||||||
reply->body.errmsg = msg;
|
reply->body.errmsg = msg;
|
||||||
|
|
||||||
rc = http_get_status_idx(status);
|
rc = http_get_status_idx(status);
|
||||||
curr_errs->errmsg[rc] = msg;
|
|
||||||
curr_errs->replies[rc] = reply;
|
curr_errs->replies[rc] = reply;
|
||||||
}
|
}
|
||||||
else if (*args[0] != 0) {
|
else if (*args[0] != 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user