}
}
+/* Detect a pending read0 for a FCGI connection. It happens if a read0 is
+ * pending on the connection AND if there is no more data in the demux
+ * buffer. The function returns 1 to report a read0 or 0 otherwise.
+ */
+static int fcgi_conn_read0_pending(struct fcgi_conn *fconn)
+{
+ if (conn_xprt_read0_pending(fconn->conn) && !b_data(&fconn->dbuf))
+ return 1;
+ return 0;
+}
+
/* Returns true if the FCGI connection must be release */
static inline int fcgi_conn_is_dead(struct fcgi_conn *fconn)
return;
}
- if (conn_xprt_read0_pending(fconn->conn)) {
+ if (fcgi_conn_read0_pending(fconn)) {
if (fstrm->state == FCGI_SS_OPEN) {
fstrm->state = FCGI_SS_HREM;
TRACE_STATE("swtiching to HREM", FCGI_EV_STRM_WAKE|FCGI_EV_FSTRM_END, fconn->conn, fstrm);
if (tmp_fstrm != fstrm && fstrm && fstrm->cs &&
(b_data(&fstrm->rxbuf) ||
- conn_xprt_read0_pending(fconn->conn) ||
+ fcgi_conn_read0_pending(fconn) ||
fstrm->state == FCGI_SS_CLOSED ||
(fstrm->flags & FCGI_SF_ES_RCVD) ||
(fstrm->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS)))) {
/* we can go here on missing data, blocked response or error */
if (fstrm && fstrm->cs &&
(b_data(&fstrm->rxbuf) ||
- conn_xprt_read0_pending(fconn->conn) ||
+ fcgi_conn_read0_pending(fconn) ||
fstrm->state == FCGI_SS_CLOSED ||
(fstrm->flags & FCGI_SF_ES_RCVD) ||
(fstrm->cs->flags & (CS_FL_ERROR|CS_FL_ERR_PENDING|CS_FL_EOS)))) {
}
}
- if ((conn->flags & CO_FL_ERROR) || conn_xprt_read0_pending(conn) ||
+ if ((conn->flags & CO_FL_ERROR) || fcgi_conn_read0_pending(fconn) ||
fconn->state == FCGI_CS_CLOSED || (fconn->flags & FCGI_CF_ABRTS_FAILED) ||
eb_is_empty(&fconn->streams_by_id)) {
fcgi_wake_some_streams(fconn, 0);
if (!(fstrm->h1m.flags & (H1_MF_VER_11|H1_MF_XFER_LEN)))
cs->flags |= CS_FL_EOS;
}
- if (conn_xprt_read0_pending(fconn->conn))
+ if (fcgi_conn_read0_pending(fconn))
cs->flags |= CS_FL_EOS;
if (cs->flags & CS_FL_ERR_PENDING)
cs->flags |= CS_FL_ERROR;