MINOR: stream: Use conn-stream to report server error
the stream's srv_error callback function now manipulates a conn-stream
instead of a stream-interface.
diff --git a/src/backend.c b/src/backend.c
index 8983e1d..3232f0e 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1995,7 +1995,7 @@
/* no stream was ever accounted for this server */
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("internal error during connection", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
}
@@ -2050,7 +2050,7 @@
s->conn_err_type = STRM_ET_QUEUE_TO;
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("connection request still queued", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
goto end;
}
@@ -2107,7 +2107,7 @@
cs_shutw(cs);
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_DEVEL("leaving on error", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
return;
}
@@ -2147,7 +2147,7 @@
s->conn_err_type = STRM_ET_CONN_RES;
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("failed to register applet", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
}
@@ -2182,7 +2182,7 @@
s->conn_err_type = STRM_ET_CONN_OTHER;
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("connection request failed", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
}
@@ -2220,7 +2220,7 @@
cs_shutw(cs);
s->conn_err_type |= STRM_ET_CONN_ABRT;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
/* Note: state = CS_ST_DIS now */
DBG_TRACE_STATE("client abort during connection attempt", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
@@ -2319,7 +2319,7 @@
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("connection failed", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
@@ -2353,7 +2353,7 @@
cs->state = CS_ST_CLO;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("error resetting endpoint", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
@@ -2436,7 +2436,7 @@
cs_shutw(cs);
s->conn_err_type |= STRM_ET_CONN_ABRT;
if (s->srv_error)
- s->srv_error(s, cs->si);
+ s->srv_error(s, cs);
DBG_TRACE_STATE("client abort during connection attempt", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s);
goto end;
}
diff --git a/src/cli.c b/src/cli.c
index 77d8f0a..ff1610e 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2759,7 +2759,7 @@
if (!s->conn_err_type)
s->conn_err_type = STRM_ET_CONN_OTHER;
if (s->srv_error)
- s->srv_error(s, cs_si(s->csb));
+ s->srv_error(s, s->csb);
return 1;
}
}
diff --git a/src/http_ana.c b/src/http_ana.c
index 62befbd..bf44405 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -4197,7 +4197,7 @@
goto end;
}
-void http_perform_server_redirect(struct stream *s, struct stream_interface *si)
+void http_perform_server_redirect(struct stream *s, struct conn_stream *cs)
{
struct channel *req = &s->req;
struct channel *res = &s->res;
@@ -4260,10 +4260,10 @@
goto fail;
/* return without error. */
- cs_shutr(si->cs);
- cs_shutw(si->cs);
+ cs_shutr(cs);
+ cs_shutw(cs);
s->conn_err_type = STRM_ET_NONE;
- si->cs->state = CS_ST_CLO;
+ cs->state = CS_ST_CLO;
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_LOCAL;
@@ -4586,7 +4586,7 @@
return 1;
}
-void http_server_error(struct stream *s, struct stream_interface *si, int err,
+void http_server_error(struct stream *s, struct conn_stream *cs, int err,
int finst, struct http_reply *msg)
{
http_reply_and_close(s, s->txn->status, msg);
@@ -4808,50 +4808,50 @@
* Note that connection errors appearing on the second request of a keep-alive
* connection are not reported since this allows the client to retry.
*/
-void http_return_srv_error(struct stream *s, struct stream_interface *si)
+void http_return_srv_error(struct stream *s, struct conn_stream *cs)
{
int err_type = s->conn_err_type;
/* set s->txn->status for http_error_message(s) */
if (err_type & STRM_ET_QUEUE_ABRT) {
s->txn->status = -1;
- http_server_error(s, si, SF_ERR_CLICL, SF_FINST_Q, NULL);
+ http_server_error(s, cs, SF_ERR_CLICL, SF_FINST_Q, NULL);
}
else if (err_type & STRM_ET_CONN_ABRT) {
s->txn->status = -1;
- http_server_error(s, si, SF_ERR_CLICL, SF_FINST_C, NULL);
+ http_server_error(s, cs, SF_ERR_CLICL, SF_FINST_C, NULL);
}
else if (err_type & STRM_ET_QUEUE_TO) {
s->txn->status = 503;
- http_server_error(s, si, SF_ERR_SRVTO, SF_FINST_Q,
+ http_server_error(s, cs, SF_ERR_SRVTO, SF_FINST_Q,
http_error_message(s));
}
else if (err_type & STRM_ET_QUEUE_ERR) {
s->txn->status = 503;
- http_server_error(s, si, SF_ERR_SRVCL, SF_FINST_Q,
+ http_server_error(s, cs, SF_ERR_SRVCL, SF_FINST_Q,
http_error_message(s));
}
else if (err_type & STRM_ET_CONN_TO) {
s->txn->status = 503;
- http_server_error(s, si, SF_ERR_SRVTO, SF_FINST_C,
+ http_server_error(s, cs, SF_ERR_SRVTO, SF_FINST_C,
(s->txn->flags & TX_NOT_FIRST) ? NULL :
http_error_message(s));
}
else if (err_type & STRM_ET_CONN_ERR) {
s->txn->status = 503;
- http_server_error(s, si, SF_ERR_SRVCL, SF_FINST_C,
+ http_server_error(s, cs, SF_ERR_SRVCL, SF_FINST_C,
(s->flags & SF_SRV_REUSED) ? NULL :
http_error_message(s));
}
else if (err_type & STRM_ET_CONN_RES) {
s->txn->status = 503;
- http_server_error(s, si, SF_ERR_RESOURCE, SF_FINST_C,
+ http_server_error(s, cs, SF_ERR_RESOURCE, SF_FINST_C,
(s->txn->flags & TX_NOT_FIRST) ? NULL :
http_error_message(s));
}
else { /* STRM_ET_CONN_OTHER and others */
s->txn->status = 500;
- http_server_error(s, si, SF_ERR_INTERNAL, SF_FINST_C,
+ http_server_error(s, cs, SF_ERR_INTERNAL, SF_FINST_C,
http_error_message(s));
}
}
diff --git a/src/stream.c b/src/stream.c
index e74a4cf..40a79d0 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2306,7 +2306,7 @@
srv = objt_server(s->target);
if (s->csb->state == CS_ST_ASS && srv && srv->rdr_len && (s->flags & SF_REDIRECTABLE))
- http_perform_server_redirect(s, si_b);
+ http_perform_server_redirect(s, s->csb);
} while (s->csb->state == CS_ST_ASS);
}
@@ -2686,9 +2686,9 @@
/* Handle server-side errors for default protocols. It is called whenever a a
* connection setup is aborted or a request is aborted in queue. It sets the
* stream termination flags so that the caller does not have to worry about
- * them. It's installed as ->srv_error for the server-side stream_interface.
+ * them. It's installed as ->srv_error for the server-side conn_stream.
*/
-void default_srv_error(struct stream *s, struct stream_interface *si)
+void default_srv_error(struct stream *s, struct conn_stream *cs)
{
int err_type = s->conn_err_type;
int err = 0, fin = 0;