CLEANUP: mux-fcgi: always take the endp from the fstrm not the cs
At a few places the endpoint pointer was retrieved from the conn_stream
while it's safer and more long-term proof to take it from the fstrm.
Let's just do that.
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index ce392c9..2afa2ff 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -917,7 +917,7 @@
TRACE_STATE("switching to ERROR", FCGI_EV_FSTRM_ERR, fstrm->fconn->conn, fstrm);
}
if (fstrm->cs)
- cs_ep_set_error(fstrm->cs->endp);
+ cs_ep_set_error(fstrm->endp);
}
}
@@ -3952,18 +3952,18 @@
TRACE_STATE("fstrm rxbuf not allocated", FCGI_EV_STRM_RECV|FCGI_EV_FSTRM_BLK, fconn->conn, fstrm);
if (b_data(&fstrm->rxbuf))
- cs->endp->flags |= (CS_EP_RCV_MORE | CS_EP_WANT_ROOM);
+ fstrm->endp->flags |= (CS_EP_RCV_MORE | CS_EP_WANT_ROOM);
else {
- cs->endp->flags &= ~(CS_EP_RCV_MORE | CS_EP_WANT_ROOM);
+ fstrm->endp->flags &= ~(CS_EP_RCV_MORE | CS_EP_WANT_ROOM);
if (fstrm->state == FCGI_SS_ERROR || (fstrm->h1m.state == H1_MSG_DONE)) {
- cs->endp->flags |= CS_EP_EOI;
+ fstrm->endp->flags |= CS_EP_EOI;
if (!(fstrm->h1m.flags & (H1_MF_VER_11|H1_MF_XFER_LEN)))
- cs->endp->flags |= CS_EP_EOS;
+ fstrm->endp->flags |= CS_EP_EOS;
}
if (fcgi_conn_read0_pending(fconn))
- cs->endp->flags |= CS_EP_EOS;
- if (cs->endp->flags & CS_EP_ERR_PENDING)
- cs->endp->flags |= CS_EP_ERROR;
+ fstrm->endp->flags |= CS_EP_EOS;
+ if (fstrm->endp->flags & CS_EP_ERR_PENDING)
+ fstrm->endp->flags |= CS_EP_ERROR;
fcgi_release_buf(fconn, &fstrm->rxbuf);
}
@@ -4016,7 +4016,7 @@
if (id < 0) {
fcgi_strm_close(fstrm);
- cs->endp->flags |= CS_EP_ERROR;
+ fstrm->endp->flags |= CS_EP_ERROR;
TRACE_DEVEL("couldn't get a stream ID, leaving in error", FCGI_EV_STRM_SEND|FCGI_EV_FSTRM_ERR|FCGI_EV_STRM_ERR, fconn->conn, fstrm);
return 0;
}
@@ -4113,7 +4113,7 @@
if (fstrm->state == FCGI_SS_ERROR) {
TRACE_DEVEL("reporting error to the app-layer stream", FCGI_EV_STRM_SEND|FCGI_EV_FSTRM_ERR|FCGI_EV_STRM_ERR, fconn->conn, fstrm);
- cs_ep_set_error(cs->endp);
+ cs_ep_set_error(fstrm->endp);
if (!(fstrm->flags & FCGI_SF_BEGIN_SENT) || fcgi_strm_send_abort(fconn, fstrm))
fcgi_strm_close(fstrm);
}