* it is being processed in the internal HTTP representation (HTX).
*/
struct h2s {
- struct conn_stream *cs;
struct cs_endpoint *endp;
struct session *sess;
struct h2c *h2c;
/* a dmumy closed stream */
static const struct h2s *h2_closed_stream = &(const struct h2s){
- .cs = NULL,
.endp = (struct cs_endpoint *)&closed_ep,
.h2c = NULL,
.st = H2_SS_CLOSED,
/* a dmumy closed stream returning a PROTOCOL_ERROR error */
static const struct h2s *h2_error_stream = &(const struct h2s){
- .cs = NULL,
.endp = (struct cs_endpoint *)&closed_ep,
.h2c = NULL,
.st = H2_SS_CLOSED,
/* a dmumy closed stream returning a REFUSED_STREAM error */
static const struct h2s *h2_refused_stream = &(const struct h2s){
- .cs = NULL,
.endp = (struct cs_endpoint *)&closed_ep,
.h2c = NULL,
.st = H2_SS_CLOSED,
/* and a dummy idle stream for use with any unannounced stream */
static const struct h2s *h2_idle_stream = &(const struct h2s){
- .cs = NULL,
.endp = (struct cs_endpoint *)&closed_ep,
.h2c = NULL,
.st = H2_SS_IDLE,
}
if ((h2c->flags & H2_CF_DEM_SALLOC) &&
- (h2s = h2c_st_by_id(h2c, h2c->dsi)) && h2s->cs &&
+ (h2s = h2c_st_by_id(h2c, h2c->dsi)) && h2s->endp->cs &&
b_alloc(&h2s->rxbuf)) {
h2c->flags &= ~H2_CF_DEM_SALLOC;
h2c_restart_reading(h2c, 1);
h2s->errcode = err;
if (h2s->st < H2_SS_ERROR)
h2s->st = H2_SS_ERROR;
- if (h2s->cs)
- cs_ep_set_error(h2s->endp);
+ cs_ep_set_error(h2s->endp);
}
}
h2s_notify_recv(h2s);
h2s_notify_send(h2s);
}
- else if (h2s->cs && h2s->cs->data_cb->wake != NULL) {
+ else if (h2s->endp->cs && h2s->endp->cs->data_cb->wake != NULL) {
TRACE_POINT(H2_EV_STRM_WAKE, h2s->h2c->conn, h2s);
- h2s->cs->data_cb->wake(h2s->cs);
+ h2s->endp->cs->data_cb->wake(h2s->endp->cs);
}
TRACE_LEAVE(H2_EV_H2S_WAKE, h2s->h2c->conn, h2s);
h2s->h2c->nb_streams--;
if (!h2s->id)
h2s->h2c->nb_reserved--;
- if (h2s->cs) {
+ if (h2s->endp->cs) {
if (!(h2s->endp->flags & CS_EP_EOS) && !b_data(&h2s->rxbuf))
h2s_notify_recv(h2s);
}
h2s->shut_tl->context = h2s;
LIST_INIT(&h2s->list);
h2s->h2c = h2c;
- h2s->cs = NULL;
h2s->endp = NULL;
h2s->sws = 0;
h2s->flags = H2_SF_NONE;
*/
sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
- h2s->cs = cs_new_from_mux(h2s->endp, sess, input);
- if (!h2s->cs) {
+ if (!cs_new_from_mux(h2s->endp, sess, input))
goto out_close;
- }
+
h2c->nb_cs++;
/* We want the accept date presented to the next stream to be the one
h2s = NULL;
goto out;
}
- h2s->cs = cs;
h2s->endp = cs->endp;
h2s->sess = sess;
h2c->nb_cs++;
TRACE_ENTER(H2_EV_H2S_WAKE, h2c->conn, h2s);
- if (!h2s->cs) {
+ if (!h2s->endp->cs) {
/* this stream was already orphaned */
h2s_destroy(h2s);
TRACE_DEVEL("leaving with no h2s", H2_EV_H2S_WAKE, h2c->conn);
h2s->errcode = h2_get_n32(&h2c->dbuf, 0);
h2s_close(h2s);
- if (h2s->cs) {
+ if (h2s->endp->cs) {
cs_ep_set_error(h2s->endp);
h2s_alert(h2s);
}
if (h2c->dff & H2_F_HEADERS_END_STREAM)
h2s->flags |= H2_SF_ES_RCVD;
- if (h2s->cs && (h2s->endp->flags & CS_EP_ERROR) && h2s->st < H2_SS_ERROR)
+ if (h2s->endp->flags & CS_EP_ERROR && h2s->st < H2_SS_ERROR)
h2s->st = H2_SS_ERROR;
else if (h2s->flags & H2_SF_ES_RCVD) {
if (h2s->st == H2_SS_OPEN)
/* call the upper layers to process the frame, then let the upper layer
* notify the stream about any change.
*/
- if (!h2s->cs) {
+ if (!h2s->endp->cs) {
/* The upper layer has already closed, this may happen on
* 4xx/redirects during POST, or when receiving a response
* from an H2 server after the client has aborted.
*/
tmp_h2s = h2c_st_by_id(h2c, h2c->dsi);
- if (tmp_h2s != h2s && h2s && h2s->cs &&
+ if (tmp_h2s != h2s && h2s && h2s->endp->cs &&
(b_data(&h2s->rxbuf) ||
h2c_read0_pending(h2c) ||
h2s->st == H2_SS_CLOSED ||
h2c->flags |= H2_CF_END_REACHED;
}
- if (h2s && h2s->cs &&
+ if (h2s && h2s->endp->cs &&
(b_data(&h2s->rxbuf) ||
h2c_read0_pending(h2c) ||
h2s->st == H2_SS_CLOSED ||
while (node) {
h2s = container_of(node, struct h2s, by_id);
- if (h2s->cs && h2s->endp->flags & CS_EP_WAIT_FOR_HS)
+ if (h2s->endp->flags & CS_EP_WAIT_FOR_HS)
h2s_notify_recv(h2s);
node = eb32_next(node);
}
node = eb32_first(&h2c->streams_by_id);
while (node) {
h2s = container_of(node, struct h2s, by_id);
- if (h2s->cs)
- return h2s->cs;
+ if (h2s->endp->cs)
+ return h2s->endp->cs;
node = eb32_next(node);
}
return NULL;
sess = h2s->sess;
h2c = h2s->h2c;
- h2s->cs = NULL;
h2c->nb_cs--;
if (!h2c->nb_cs)
h2c->idle_start = now_ms;
/* We're done trying to send, remove ourself from the send_list */
LIST_DEL_INIT(&h2s->list);
- if (!h2s->cs) {
+ if (!h2s->endp->cs) {
h2s_destroy(h2s);
if (h2c_is_dead(h2c)) {
h2_release(h2c);
break;
}
- if (!h2s->cs || h2s->endp->flags & CS_EP_SHW) {
+ if (!h2s->endp->cs || h2s->endp->flags & CS_EP_SHW) {
/* Response already closed: add END_STREAM */
es_now = 1;
}
break;
}
- if (!h2s->cs || h2s->endp->flags & CS_EP_SHW) {
+ if (!h2s->endp->cs || h2s->endp->flags & CS_EP_SHW) {
/* Request already closed: add END_STREAM */
es_now = 1;
}
while (node) {
h2s = container_of(node, struct h2s, by_id);
tree_cnt++;
- if (!h2s->cs)
+ if (!h2s->endp->cs)
orph_cnt++;
node = eb32_next(node);
}
h2s, h2s->id, h2s_st_to_str(h2s->st), h2s->flags,
(unsigned int)b_data(&h2s->rxbuf), b_orig(&h2s->rxbuf),
(unsigned int)b_head_ofs(&h2s->rxbuf), (unsigned int)b_size(&h2s->rxbuf),
- h2s->cs);
- if (h2s->cs)
+ h2s->endp->cs);
+ if (h2s->endp->cs)
chunk_appendf(msg, "(.flg=0x%08x .app=%p)",
- h2s->cs->flags, h2s->cs->app);
+ h2s->endp->cs->flags, h2s->endp->cs->app);
chunk_appendf(msg, "endp=%p", h2s->endp);
if (h2s->endp)