diff --git a/include/haproxy/http_ana.h b/include/haproxy/http_ana.h index cb7efdd0a..7a1b94489 100644 --- a/include/haproxy/http_ana.h +++ b/include/haproxy/http_ana.h @@ -50,10 +50,10 @@ int http_res_set_status(unsigned int status, struct ist reason, struct stream *s void http_check_request_for_cacheability(struct stream *s, struct channel *req); void http_check_response_for_cacheability(struct stream *s, struct channel *res); enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn, unsigned int time, unsigned int bytes); -void http_perform_server_redirect(struct stream *s, struct stconn *cs); -void http_server_error(struct stream *s, struct stconn *cs, int err, int finst, struct http_reply *msg); +void http_perform_server_redirect(struct stream *s, struct stconn *sc); +void http_server_error(struct stream *s, struct stconn *sc, int err, int finst, struct http_reply *msg); void http_reply_and_close(struct stream *s, short status, struct http_reply *msg); -void http_return_srv_error(struct stream *s, struct stconn *cs); +void http_return_srv_error(struct stream *s, struct stconn *sc); struct http_reply *http_error_message(struct stream *s); int http_reply_to_htx(struct stream *s, struct htx *htx, struct http_reply *reply); int http_reply_message(struct stream *s, struct http_reply *reply); diff --git a/include/haproxy/stream-t.h b/include/haproxy/stream-t.h index 5e2261fb2..71d251c4f 100644 --- a/include/haproxy/stream-t.h +++ b/include/haproxy/stream-t.h @@ -194,7 +194,7 @@ struct stream { void (*do_log)(struct stream *s); /* the function to call in order to log (or NULL) */ void (*srv_error)(struct stream *s, /* the function to call upon unrecoverable server errors (or NULL) */ - struct stconn *cs); + struct stconn *sc); int pcli_next_pid; /* next target PID to use for the CLI proxy */ int pcli_flags; /* flags for CLI proxy */ diff --git a/include/haproxy/stream.h b/include/haproxy/stream.h index d5de4675e..94e89b40c 100644 --- a/include/haproxy/stream.h +++ b/include/haproxy/stream.h @@ -59,9 +59,9 @@ extern struct pool_head *pool_head_uniqueid; extern struct data_cb sess_conn_cb; -struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer *input); +struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer *input); void stream_free(struct stream *s); -int stream_upgrade_from_cs(struct stconn *cs, struct buffer *input); +int stream_upgrade_from_cs(struct stconn *sc, struct buffer *input); int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_proto); /* kill a stream and set the termination flags to (one of SF_ERR_*) */ @@ -74,7 +74,7 @@ struct ist stream_generate_unique_id(struct stream *strm, struct list *format); void stream_process_counters(struct stream *s); void sess_change_server(struct stream *strm, struct server *newsrv); struct task *process_stream(struct task *t, void *context, unsigned int state); -void default_srv_error(struct stream *s, struct stconn *cs); +void default_srv_error(struct stream *s, struct stconn *sc); /* Update the stream's backend and server time stats */ void stream_update_time_stats(struct stream *s); diff --git a/src/backend.c b/src/backend.c index 9b73ec7cb..de5da5420 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1970,12 +1970,12 @@ static int back_may_abort_req(struct channel *req, struct stream *s) void back_try_conn_req(struct stream *s) { struct server *srv = objt_server(s->target); - struct stconn *cs = s->scb; + struct stconn *sc = s->scb; struct channel *req = &s->req; DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); - if (cs->state == SC_ST_ASS) { + if (sc->state == SC_ST_ASS) { /* Server assigned to connection request, we have to try to connect now */ int conn_err; @@ -2023,8 +2023,8 @@ void back_try_conn_req(struct stream *s) process_srv_queue(srv); /* Failed and not retryable. */ - sc_shutr(cs); - sc_shutw(cs); + sc_shutr(sc); + sc_shutw(sc); req->flags |= CF_WRITE_ERROR; s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); @@ -2033,9 +2033,9 @@ void back_try_conn_req(struct stream *s) pendconn_cond_unlink(s->pend_pos); /* no stream was ever accounted for this server */ - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("internal error during connection", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; } @@ -2044,14 +2044,14 @@ void back_try_conn_req(struct stream *s) * turn-around now, as the problem is likely a source port * allocation problem, so we want to retry now. */ - cs->state = SC_ST_CER; - sc_ep_clr(cs, SE_FL_ERROR); + sc->state = SC_ST_CER; + sc_ep_clr(sc, SE_FL_ERROR); back_handle_st_cer(s); DBG_TRACE_STATE("connection error, retry", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); - /* now cs->state is one of SC_ST_CLO, SC_ST_TAR, SC_ST_ASS, SC_ST_REQ */ + /* now sc->state is one of SC_ST_CLO, SC_ST_TAR, SC_ST_ASS, SC_ST_REQ */ } - else if (cs->state == SC_ST_QUE) { + else if (sc->state == SC_ST_QUE) { /* connection request was queued, check for any update */ if (!pendconn_dequeue(s)) { /* The connection is not in the queue anymore. Either @@ -2061,10 +2061,10 @@ void back_try_conn_req(struct stream *s) */ s->conn_exp = TICK_ETERNITY; if (unlikely(!(s->flags & SF_ASSIGNED))) - cs->state = SC_ST_REQ; + sc->state = SC_ST_REQ; else { s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); - cs->state = SC_ST_ASS; + sc->state = SC_ST_ASS; } DBG_TRACE_STATE("dequeue connection request", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); goto end; @@ -2083,14 +2083,14 @@ void back_try_conn_req(struct stream *s) if (srv) _HA_ATOMIC_INC(&srv->counters.failed_conns); _HA_ATOMIC_INC(&s->be->be_counters.failed_conns); - sc_shutr(cs); - sc_shutw(cs); + sc_shutr(sc); + sc_shutw(sc); req->flags |= CF_WRITE_TIMEOUT; if (!s->conn_err_type) s->conn_err_type = STRM_ET_QUEUE_TO; - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("connection request still queued", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); goto end; } @@ -2109,7 +2109,7 @@ void back_try_conn_req(struct stream *s) /* Nothing changed */ } - else if (cs->state == SC_ST_TAR) { + else if (sc->state == SC_ST_TAR) { /* Connection request might be aborted */ if (back_may_abort_req(req, s)) { s->conn_err_type |= STRM_ET_CONN_ABRT; @@ -2128,9 +2128,9 @@ void back_try_conn_req(struct stream *s) * FIXME: Should we force a redispatch attempt when the server is down ? */ if (s->flags & SF_ASSIGNED) - cs->state = SC_ST_ASS; + sc->state = SC_ST_ASS; else - cs->state = SC_ST_REQ; + sc->state = SC_ST_REQ; DBG_TRACE_STATE("retry connection now", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); } @@ -2143,11 +2143,11 @@ abort_connection: /* give up */ s->conn_exp = TICK_ETERNITY; s->flags &= ~SF_CONN_EXP; - sc_shutr(cs); - sc_shutw(cs); - cs->state = SC_ST_CLO; + sc_shutr(sc); + sc_shutw(sc); + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_DEVEL("leaving on error", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); return; } @@ -2160,9 +2160,9 @@ abort_connection: */ void back_handle_st_req(struct stream *s) { - struct stconn *cs = s->scb; + struct stconn *sc = s->scb; - if (cs->state != SC_ST_REQ) + if (sc->state != SC_ST_REQ) return; DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); @@ -2174,8 +2174,8 @@ void back_handle_st_req(struct stream *s) * means no appctx are attached to the CS. Otherwise, it will be * in SC_ST_RDY state. So, try to create the appctx now. */ - BUG_ON(sc_appctx(cs)); - appctx = sc_applet_create(cs, objt_applet(s->target)); + BUG_ON(sc_appctx(sc)); + appctx = sc_applet_create(sc, objt_applet(s->target)); if (!appctx) { /* No more memory, let's immediately abort. Force the * error code to ignore the ERR_LOCAL which is not a @@ -2183,13 +2183,13 @@ void back_handle_st_req(struct stream *s) */ s->flags &= ~(SF_ERR_MASK | SF_FINST_MASK); - sc_shutr(cs); - sc_shutw(cs); + sc_shutr(sc); + sc_shutw(sc); s->req.flags |= CF_WRITE_ERROR; s->conn_err_type = STRM_ET_CONN_RES; - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("failed to register applet", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; } @@ -2203,27 +2203,27 @@ void back_handle_st_req(struct stream *s) /* We did not get a server. Either we queued the * connection request, or we encountered an error. */ - if (cs->state == SC_ST_QUE) { + if (sc->state == SC_ST_QUE) { DBG_TRACE_STATE("connection request queued", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); goto end; } /* we did not get any server, let's check the cause */ - sc_shutr(cs); - sc_shutw(cs); + sc_shutr(sc); + sc_shutw(sc); s->req.flags |= CF_WRITE_ERROR; if (!s->conn_err_type) s->conn_err_type = STRM_ET_CONN_OTHER; - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("connection request failed", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; } /* The server is assigned */ s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); - cs->state = SC_ST_ASS; + sc->state = SC_ST_ASS; be_set_sess_last(s->be); DBG_TRACE_STATE("connection request assigned to a server", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); @@ -2231,7 +2231,7 @@ void back_handle_st_req(struct stream *s) DBG_TRACE_LEAVE(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); } -/* This function is called with (cs->state == SC_ST_CON) meaning that a +/* This function is called with (sc->state == SC_ST_CON) meaning that a * connection was attempted and that the file descriptor is already allocated. * We must check for timeout, error and abort. Possible output states are * SC_ST_CER (error), SC_ST_DIS (abort), and SC_ST_CON (no change). This only @@ -2240,7 +2240,7 @@ void back_handle_st_req(struct stream *s) */ void back_handle_st_con(struct stream *s) { - struct stconn *cs = s->scb; + struct stconn *sc = s->scb; struct channel *req = &s->req; struct channel *rep = &s->res; @@ -2250,11 +2250,11 @@ void back_handle_st_con(struct stream *s) if ((rep->flags & CF_SHUTW) || ((req->flags & CF_SHUTW_NOW) && (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) { - cs->flags |= SC_FL_NOLINGER; - sc_shutw(cs); + sc->flags |= SC_FL_NOLINGER; + sc_shutw(sc); s->conn_err_type |= STRM_ET_CONN_ABRT; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); /* Note: state = SC_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; @@ -2262,15 +2262,15 @@ void back_handle_st_con(struct stream *s) done: /* retryable error ? */ - if ((s->flags & SF_CONN_EXP) || sc_ep_test(cs, SE_FL_ERROR)) { + if ((s->flags & SF_CONN_EXP) || sc_ep_test(sc, SE_FL_ERROR)) { if (!s->conn_err_type) { - if (sc_ep_test(cs, SE_FL_ERROR)) + if (sc_ep_test(sc, SE_FL_ERROR)) s->conn_err_type = STRM_ET_CONN_ERR; else s->conn_err_type = STRM_ET_CONN_TO; } - cs->state = SC_ST_CER; + sc->state = SC_ST_CER; DBG_TRACE_STATE("connection failed, retry", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); } @@ -2278,7 +2278,7 @@ void back_handle_st_con(struct stream *s) DBG_TRACE_LEAVE(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); } -/* This function is called with (cs->state == SC_ST_CER) meaning that a +/* This function is called with (sc->state == SC_ST_CER) meaning that a * previous connection attempt has failed and that the file descriptor * has already been released. Possible causes include asynchronous error * notification and time out. Possible output states are SC_ST_CLO when @@ -2289,8 +2289,8 @@ void back_handle_st_con(struct stream *s) */ void back_handle_st_cer(struct stream *s) { - struct stconn *cs = s->scb; - int must_tar = sc_ep_test(cs, SE_FL_ERROR); + struct stconn *sc = s->scb; + int must_tar = sc_ep_test(sc, SE_FL_ERROR); DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); @@ -2301,7 +2301,7 @@ void back_handle_st_cer(struct stream *s) /* we probably have to release last stream from the server */ if (objt_server(s->target)) { - struct connection *conn = sc_conn(cs); + struct connection *conn = sc_conn(sc); health_adjust(__objt_server(s->target), HANA_STATUS_L4_ERR); @@ -2310,7 +2310,7 @@ void back_handle_st_cer(struct stream *s) _HA_ATOMIC_DEC(&__objt_server(s->target)->cur_sess); } - if (sc_ep_test(cs, SE_FL_ERROR) && + if (sc_ep_test(sc, SE_FL_ERROR) && conn && conn->err_code == CO_ER_SSL_MISMATCH_SNI) { /* We tried to connect to a server which is configured * with "verify required" and which doesn't have the @@ -2347,13 +2347,13 @@ void back_handle_st_cer(struct stream *s) process_srv_queue(objt_server(s->target)); /* shutw is enough to stop a connecting socket */ - sc_shutw(cs); + sc_shutw(sc); s->req.flags |= CF_WRITE_ERROR; s->res.flags |= CF_READ_ERROR; - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("connection failed", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; @@ -2369,7 +2369,7 @@ void back_handle_st_cer(struct stream *s) * Note: the stream connector will be switched to ST_REQ, ST_ASS or * ST_TAR and SE_FL_ERROR and SF_CONN_EXP flags will be unset. */ - if (sc_reset_endp(cs) < 0) { + if (sc_reset_endp(sc) < 0) { if (!s->conn_err_type) s->conn_err_type = STRM_ET_CONN_OTHER; @@ -2381,13 +2381,13 @@ void back_handle_st_cer(struct stream *s) process_srv_queue(objt_server(s->target)); /* shutw is enough to stop a connecting socket */ - sc_shutw(cs); + sc_shutw(sc); s->req.flags |= CF_WRITE_ERROR; s->res.flags |= CF_READ_ERROR; - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("error resetting endpoint", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; @@ -2415,10 +2415,10 @@ void back_handle_st_cer(struct stream *s) s->conn_err_type = STRM_ET_CONN_ERR; /* only wait when we're retrying on the same server */ - if ((cs->state == SC_ST_ASS || + if ((sc->state == SC_ST_ASS || (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR || (s->be->srv_act <= 1)) && !reused) { - cs->state = SC_ST_TAR; + sc->state = SC_ST_TAR; s->conn_exp = tick_add(now_ms, MS_TO_TICKS(delay)); } DBG_TRACE_STATE("retry a new connection", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); @@ -2428,7 +2428,7 @@ void back_handle_st_cer(struct stream *s) DBG_TRACE_LEAVE(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); } -/* This function is called with (cs->state == SC_ST_RDY) meaning that a +/* This function is called with (sc->state == SC_ST_RDY) meaning that a * connection was attempted, that the file descriptor is already allocated, * and that it has succeeded. We must still check for errors and aborts. * Possible output states are SC_ST_EST (established), SC_ST_CER (error), @@ -2437,7 +2437,7 @@ void back_handle_st_cer(struct stream *s) */ void back_handle_st_rdy(struct stream *s) { - struct stconn *cs = s->scb; + struct stconn *sc = s->scb; struct channel *req = &s->req; struct channel *rep = &s->res; @@ -2479,20 +2479,20 @@ void back_handle_st_rdy(struct stream *s) ((req->flags & CF_SHUTW_NOW) && (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) { /* give up */ - cs->flags |= SC_FL_NOLINGER; - sc_shutw(cs); + sc->flags |= SC_FL_NOLINGER; + sc_shutw(sc); s->conn_err_type |= STRM_ET_CONN_ABRT; if (s->srv_error) - s->srv_error(s, cs); + s->srv_error(s, sc); DBG_TRACE_STATE("client abort during connection attempt", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; } /* retryable error ? */ - if (sc_ep_test(cs, SE_FL_ERROR)) { + if (sc_ep_test(sc, SE_FL_ERROR)) { if (!s->conn_err_type) s->conn_err_type = STRM_ET_CONN_ERR; - cs->state = SC_ST_CER; + sc->state = SC_ST_CER; DBG_TRACE_STATE("connection failed, retry", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); goto end; } @@ -2503,7 +2503,7 @@ void back_handle_st_rdy(struct stream *s) */ DBG_TRACE_STATE("connection established", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); s->conn_err_type = STRM_ET_NONE; - cs->state = SC_ST_EST; + sc->state = SC_ST_EST; end: DBG_TRACE_LEAVE(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); diff --git a/src/http_ana.c b/src/http_ana.c index 6950d8217..df88d3d97 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1230,7 +1230,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) /* Reset the stream and the backend stream connector to a situation suitable for attemption connection */ /* Returns 0 if we can attempt to retry, -1 otherwise */ -static __inline int do_l7_retry(struct stream *s, struct stconn *cs) +static __inline int do_l7_retry(struct stream *s, struct stconn *sc) { struct channel *req, *res; int co_data; @@ -4250,7 +4250,7 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn, goto end; } -void http_perform_server_redirect(struct stream *s, struct stconn *cs) +void http_perform_server_redirect(struct stream *s, struct stconn *sc) { struct channel *req = &s->req; struct channel *res = &s->res; @@ -4313,10 +4313,10 @@ void http_perform_server_redirect(struct stream *s, struct stconn *cs) goto fail; /* return without error. */ - sc_shutr(cs); - sc_shutw(cs); + sc_shutr(sc); + sc_shutw(sc); s->conn_err_type = STRM_ET_NONE; - cs->state = SC_ST_CLO; + sc->state = SC_ST_CLO; if (!(s->flags & SF_ERR_MASK)) s->flags |= SF_ERR_LOCAL; @@ -4639,7 +4639,7 @@ int http_forward_proxy_resp(struct stream *s, int final) return 1; } -void http_server_error(struct stream *s, struct stconn *cs, int err, +void http_server_error(struct stream *s, struct stconn *sc, int err, int finst, struct http_reply *msg) { http_reply_and_close(s, s->txn->status, msg); @@ -4861,50 +4861,50 @@ int http_reply_message(struct stream *s, struct http_reply *reply) * 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 stconn *cs) +void http_return_srv_error(struct stream *s, struct stconn *sc) { 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, cs, SF_ERR_CLICL, SF_FINST_Q, NULL); + http_server_error(s, sc, SF_ERR_CLICL, SF_FINST_Q, NULL); } else if (err_type & STRM_ET_CONN_ABRT) { s->txn->status = -1; - http_server_error(s, cs, SF_ERR_CLICL, SF_FINST_C, NULL); + http_server_error(s, sc, SF_ERR_CLICL, SF_FINST_C, NULL); } else if (err_type & STRM_ET_QUEUE_TO) { s->txn->status = 503; - http_server_error(s, cs, SF_ERR_SRVTO, SF_FINST_Q, + http_server_error(s, sc, 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, cs, SF_ERR_SRVCL, SF_FINST_Q, + http_server_error(s, sc, 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, cs, SF_ERR_SRVTO, SF_FINST_C, + http_server_error(s, sc, 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, cs, SF_ERR_SRVCL, SF_FINST_C, + http_server_error(s, sc, 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, cs, SF_ERR_RESOURCE, SF_FINST_C, + http_server_error(s, sc, 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, cs, SF_ERR_INTERNAL, SF_FINST_C, + http_server_error(s, sc, SF_ERR_INTERNAL, SF_FINST_C, http_error_message(s)); } } @@ -5164,14 +5164,14 @@ void http_txn_reset_res(struct http_txn *txn) struct http_txn *http_create_txn(struct stream *s) { struct http_txn *txn; - struct stconn *cs = s->scf; + struct stconn *sc = s->scf; txn = pool_alloc(pool_head_http_txn); if (!txn) return NULL; s->txn = txn; - txn->flags = ((cs && sc_ep_test(cs, SE_FL_NOT_FIRST)) ? TX_NOT_FIRST : 0); + txn->flags = ((sc && sc_ep_test(sc, SE_FL_NOT_FIRST)) ? TX_NOT_FIRST : 0); txn->status = -1; txn->http_reply = NULL; txn->l7_buffer = BUF_NULL; diff --git a/src/stream.c b/src/stream.c index 526d67862..8b513d4d1 100644 --- a/src/stream.c +++ b/src/stream.c @@ -79,7 +79,7 @@ static void strm_trace(enum trace_level level, uint64_t mask, /* The event representation is split like this : * strm - stream - * cs - stream connector + * sc - stream connector * http - http analyzis * tcp - tcp analyzis * @@ -268,17 +268,17 @@ static void strm_trace(enum trace_level level, uint64_t mask, const struct trace } } -/* Upgrade an existing stream for stream connector . Return < 0 on error. This +/* Upgrade an existing stream for stream connector . Return < 0 on error. This * is only valid right after a TCP to H1 upgrade. The stream should be * "reativated" by removing SF_IGNORE flag. And the right mode must be set. On * success, buffer is transferred to the stream and thus points to * BUF_NULL. On error, it is unchanged and it is the caller responsibility to * release it (this never happens for now). */ -int stream_upgrade_from_cs(struct stconn *cs, struct buffer *input) +int stream_upgrade_from_cs(struct stconn *sc, struct buffer *input) { - struct stream *s = __sc_strm(cs); - const struct mux_ops *mux = sc_mux_ops(cs); + struct stream *s = __sc_strm(sc); + const struct mux_ops *mux = sc_mux_ops(sc); if (mux) { if (mux->flags & MX_FL_HTX) @@ -339,7 +339,7 @@ int stream_buf_available(void *arg) * transfer to the stream and is set to BUF_NULL. On error, * buffer is unchanged and it is the caller responsibility to release it. */ -struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer *input) +struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer *input) { struct stream *s; struct task *t; @@ -445,7 +445,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer if (sess->fe->mode == PR_MODE_HTTP) s->flags |= SF_HTX; - s->scf = cs; + s->scf = sc; if (sc_attach_strm(s->scf, s) < 0) goto out_fail_attach_scf; @@ -463,10 +463,10 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer if (likely(sess->fe->options2 & PR_O2_INDEPSTR)) s->scb->flags |= SC_FL_INDEP_STR; - if (sc_ep_test(cs, SE_FL_WEBSOCKET)) + if (sc_ep_test(sc, SE_FL_WEBSOCKET)) s->flags |= SF_WEBSOCKET; - if (sc_conn(cs)) { - const struct mux_ops *mux = sc_mux_ops(cs); + if (sc_conn(sc)) { + const struct mux_ops *mux = sc_mux_ops(sc); if (mux && mux->flags & MX_FL_HTX) s->flags |= SF_HTX; @@ -536,7 +536,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer goto out_fail_accept; /* finish initialization of the accepted file descriptor */ - if (sc_appctx(cs)) + if (sc_appctx(sc)) se_will_consume(s->scf->sedesc); if (sess->fe->accept && sess->fe->accept(s) < 0) @@ -1462,7 +1462,7 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit */ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_proto) { - struct stconn *cs = s->scf; + struct stconn *sc = s->scf; struct connection *conn; /* Already an HTTP stream */ @@ -1474,7 +1474,7 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot if (unlikely(!s->txn && !http_create_txn(s))) return 0; - conn = sc_conn(cs); + conn = sc_conn(sc); if (conn) { se_have_more_data(s->scf->sedesc); /* Make sure we're unsubscribed, the the new @@ -1482,11 +1482,11 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot * the underlying XPRT */ if (s->scf->wait_event.events) - conn->mux->unsubscribe(cs, s->scf->wait_event.events, &(s->scf->wait_event)); + conn->mux->unsubscribe(sc, s->scf->wait_event.events, &(s->scf->wait_event)); if (conn->mux->flags & MX_FL_NO_UPG) return 0; - if (conn_upgrade_mux_fe(conn, cs, &s->req.buf, + if (conn_upgrade_mux_fe(conn, sc, &s->req.buf, (mux_proto ? mux_proto->token : ist("")), PROTO_MODE_HTTP) == -1) return 0; @@ -1520,7 +1520,7 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot * Note that this does not change the stream connector's current state, though * it updates the previous state to the current one. */ -static void stream_update_both_cs(struct stream *s) +static void stream_update_both_sc(struct stream *s) { struct stconn *scf = s->scf; struct stconn *scb = s->scb; @@ -2472,7 +2472,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) if ((sess->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED) && !(s->flags & SF_IGNORE)) stream_process_counters(s); - stream_update_both_cs(s); + stream_update_both_sc(s); /* Trick: if a request is being waiting for the server to respond, * and if we know the server can timeout, we don't want the timeout @@ -2664,7 +2664,7 @@ void sess_change_server(struct stream *strm, struct server *newsrv) * 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 connector. */ -void default_srv_error(struct stream *s, struct stconn *cs) +void default_srv_error(struct stream *s, struct stconn *sc) { int err_type = s->conn_err_type; int err = 0, fin = 0; @@ -3148,9 +3148,9 @@ struct show_sess_ctx { * buffer is full and it needs to be called again, otherwise non-zero. It is * designed to be called from stats_dump_strm_to_buffer() below. */ -static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm) +static int stats_dump_full_strm_to_buffer(struct stconn *sc, struct stream *strm) { - struct appctx *appctx = __sc_appctx(cs); + struct appctx *appctx = __sc_appctx(sc); struct show_sess_ctx *ctx = appctx->svcctx; struct stconn *scf, *scb; struct tm tm; @@ -3524,7 +3524,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx static int cli_io_handler_dump_sess(struct appctx *appctx) { struct show_sess_ctx *ctx = appctx->svcctx; - struct stconn *cs = appctx_cs(appctx); + struct stconn *sc = appctx_cs(appctx); struct connection *conn; thread_isolate(); @@ -3534,7 +3534,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) goto done; } - if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) { + if (unlikely(sc_ic(sc)->flags & (CF_WRITE_ERROR|CF_SHUTW))) { /* If we're forced to shut down, we might have to remove our * reference to the last stream being dumped. */ @@ -3585,7 +3585,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) LIST_APPEND(&curr_strm->back_refs, &ctx->bref.users); /* call the proper dump() function and return if we're missing space */ - if (!stats_dump_full_strm_to_buffer(cs, curr_strm)) + if (!stats_dump_full_strm_to_buffer(sc, curr_strm)) goto full; /* stream dump complete */