BUILD: http: rename error_message http_error_message to fix conflicts on RHEL
Duncan Hall reported a build issue on CentOS where error_message conflicts
with another system declaration when SSL is enabled. Rename the function.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 69d932c..e7ad8ff 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -108,7 +108,7 @@
struct http_req_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
void free_http_req_rules(struct list *r);
-struct chunk *error_message(struct session *s, int msgnum);
+struct chunk *http_error_message(struct session *s, int msgnum);
/* to be used when contents change in an HTTP message */
#define http_msg_move_end(msg, bytes) do { \
diff --git a/src/proto_http.c b/src/proto_http.c
index 4faff52..d7208d2 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -669,7 +669,7 @@
* and message.
*/
-struct chunk *error_message(struct session *s, int msgnum)
+struct chunk *http_error_message(struct session *s, int msgnum)
{
if (s->be->errmsg[msgnum].str)
return &s->be->errmsg[msgnum];
@@ -841,25 +841,25 @@
if (err_type & SI_ET_QUEUE_ABRT)
http_server_error(s, si, SN_ERR_CLICL, SN_FINST_Q,
- 503, error_message(s, HTTP_ERR_503));
+ 503, http_error_message(s, HTTP_ERR_503));
else if (err_type & SI_ET_CONN_ABRT)
http_server_error(s, si, SN_ERR_CLICL, SN_FINST_C,
- 503, error_message(s, HTTP_ERR_503));
+ 503, http_error_message(s, HTTP_ERR_503));
else if (err_type & SI_ET_QUEUE_TO)
http_server_error(s, si, SN_ERR_SRVTO, SN_FINST_Q,
- 503, error_message(s, HTTP_ERR_503));
+ 503, http_error_message(s, HTTP_ERR_503));
else if (err_type & SI_ET_QUEUE_ERR)
http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_Q,
- 503, error_message(s, HTTP_ERR_503));
+ 503, http_error_message(s, HTTP_ERR_503));
else if (err_type & SI_ET_CONN_TO)
http_server_error(s, si, SN_ERR_SRVTO, SN_FINST_C,
- 503, error_message(s, HTTP_ERR_503));
+ 503, http_error_message(s, HTTP_ERR_503));
else if (err_type & SI_ET_CONN_ERR)
http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_C,
- 503, error_message(s, HTTP_ERR_503));
+ 503, http_error_message(s, HTTP_ERR_503));
else /* SI_ET_CONN_OTHER and others */
http_server_error(s, si, SN_ERR_INTERNAL, SN_FINST_C,
- 500, error_message(s, HTTP_ERR_500));
+ 500, http_error_message(s, HTTP_ERR_500));
}
extern const char sess_term_cond[8];
@@ -2169,7 +2169,7 @@
session_inc_http_err_ctr(s);
}
txn->status = 408;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_408));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_408));
msg->msg_state = HTTP_MSG_ERROR;
req->analysers = 0;
@@ -2195,7 +2195,7 @@
if (msg->err_pos >= 0)
http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
txn->status = 400;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));
msg->msg_state = HTTP_MSG_ERROR;
req->analysers = 0;
@@ -2324,14 +2324,14 @@
if (ret) {
/* we fail this request, let's return 503 service unavail */
txn->status = 503;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_503));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_503));
goto return_prx_cond;
}
}
/* nothing to fail, let's reply normaly */
txn->status = 200;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_200));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_200));
goto return_prx_cond;
}
@@ -2498,7 +2498,7 @@
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 400;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));
s->fe->fe_counters.failed_req++;
if (s->listener->counters)
@@ -2812,7 +2812,7 @@
txn->status = 403;
/* let's log the request time */
s->logs.tv_request = now;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_403));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_403));
session_inc_http_err_ctr(s);
goto return_prx_cond;
}
@@ -2834,7 +2834,7 @@
if (http_req_last_rule && http_req_last_rule->action == HTTP_REQ_ACT_DENY) {
txn->status = 403;
s->logs.tv_request = now;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_403));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_403));
session_inc_http_err_ctr(s);
s->fe->fe_counters.denied_req++;
if (an_bit == AN_REQ_HTTP_PROCESS_BE)
@@ -2855,7 +2855,7 @@
txn->status = 403;
/* let's log the request time */
s->logs.tv_request = now;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_403));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_403));
session_inc_http_err_ctr(s);
goto return_prx_cond;
}
@@ -3215,7 +3215,7 @@
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 400;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));
s->fe->fe_counters.failed_req++;
if (s->listener->counters)
@@ -3500,7 +3500,7 @@
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 400;
req->analysers = 0;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));
s->fe->fe_counters.failed_req++;
if (s->listener->counters)
@@ -3541,7 +3541,7 @@
txn->status = 500;
if (!(req->flags & CF_READ_ERROR))
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_500));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_500));
req->analysers = 0;
req->analyse_exp = TICK_ETERNITY;
@@ -3643,7 +3643,7 @@
if ((req->flags & CF_READ_TIMEOUT) || tick_is_expired(req->analyse_exp, now_ms)) {
txn->status = 408;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_408));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_408));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_CLITO;
@@ -3676,7 +3676,7 @@
return_bad_req: /* let's centralize all bad requests */
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 400;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_PRXCOND;
@@ -4417,7 +4417,7 @@
stream_int_retnclose(req->prod, NULL);
} else {
txn->status = 400;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));
}
req->analysers = 0;
s->rep->analysers = 0; /* we're in data phase, we want to abort both directions */
@@ -4439,7 +4439,7 @@
stream_int_retnclose(req->prod, NULL);
} else {
txn->status = 502;
- stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_502));
+ stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_502));
}
req->analysers = 0;
s->rep->analysers = 0; /* we're in data phase, we want to abort both directions */
@@ -4581,7 +4581,7 @@
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
bi_erase(rep);
- stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_502));
+ stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_PRXCOND;
@@ -4614,7 +4614,7 @@
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
bi_erase(rep);
- stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_502));
+ stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_SRVCL;
@@ -4639,7 +4639,7 @@
txn->status = 504;
rep->prod->flags |= SI_FL_NOLINGER;
bi_erase(rep);
- stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_504));
+ stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_504));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_SRVTO;
@@ -4664,7 +4664,7 @@
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
bi_erase(rep);
- stream_int_retnclose(rep->cons, error_message(s, HTTP_ERR_502));
+ stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_SRVCL;
@@ -5013,7 +5013,7 @@
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
bi_erase(rep);
- stream_int_retnclose(rep->cons, error_message(t, HTTP_ERR_502));
+ stream_int_retnclose(rep->cons, http_error_message(t, HTTP_ERR_502));
if (!(t->flags & SN_ERR_MASK))
t->flags |= SN_ERR_PRXCOND;
if (!(t->flags & SN_FINST_MASK))
diff --git a/src/session.c b/src/session.c
index 3c47937..0f7a9ba 100644
--- a/src/session.c
+++ b/src/session.c
@@ -187,7 +187,7 @@
out_close:
if (ret < 0 && p->mode == PR_MODE_HTTP) {
/* critical error, no more memory, try to emit a 500 response */
- struct chunk *err_msg = error_message(s, HTTP_ERR_500);
+ struct chunk *err_msg = http_error_message(s, HTTP_ERR_500);
send(cfd, err_msg->str, err_msg->len, MSG_DONTWAIT|MSG_NOSIGNAL);
}