msg->som = msg->sov;
}
- if (msg->msg_state == HTTP_MSG_CHUNK_SIZE) {
+ if (msg->msg_state == HTTP_MSG_DATA) {
+ /* must still forward */
+ if (req->to_forward)
+ return 0;
+
+ /* nothing left to forward */
+ if (txn->flags & TX_REQ_TE_CHNK)
+ msg->msg_state = HTTP_MSG_DATA_CRLF;
+ else {
+ msg->msg_state = HTTP_MSG_DONE;
+ goto http_msg_done;
+ }
+ }
+ else if (msg->msg_state == HTTP_MSG_CHUNK_SIZE) {
/* read the chunk size and assign it to ->hdr_content_len, then
* set ->sov and ->lr to point to the body and switch to DATA or
* TRAILERS state.
goto return_bad_req;
/* otherwise we're in HTTP_MSG_DATA or HTTP_MSG_TRAILERS state */
}
- else if (msg->msg_state == HTTP_MSG_DATA) {
- /* must still forward */
- if (req->to_forward)
- return 0;
-
- /* nothing left to forward */
- if (txn->flags & TX_REQ_TE_CHNK)
- msg->msg_state = HTTP_MSG_DATA_CRLF;
- else {
- msg->msg_state = HTTP_MSG_DONE;
- }
- }
else if (msg->msg_state == HTTP_MSG_DATA_CRLF) {
/* we want the CRLF after the data */
int ret;
/* we're in HTTP_MSG_DONE now */
}
else if (msg->msg_state == HTTP_MSG_DONE) {
+ http_msg_done:
/* No need to read anymore, the request was completely parsed */
req->flags |= BF_DONT_READ;
}
if (req->flags & (BF_SHUTW|BF_SHUTW_NOW)) {
- if (req->flags & BF_OUT_EMPTY)
+ if (req->flags & BF_OUT_EMPTY) {
msg->msg_state = HTTP_MSG_CLOSED;
- else
+ goto http_msg_closed;
+ }
+ else {
msg->msg_state = HTTP_MSG_CLOSING;
+ goto http_msg_closing;
+ }
}
else {
/* for other modes, we let further requests pass for now */
}
}
else if (msg->msg_state == HTTP_MSG_CLOSING) {
+ http_msg_closing:
/* nothing else to forward, just waiting for the buffer to be empty */
if (!(req->flags & BF_OUT_EMPTY))
return 0;
msg->msg_state = HTTP_MSG_CLOSED;
}
else if (msg->msg_state == HTTP_MSG_CLOSED) {
+ http_msg_closed:
req->flags &= ~BF_DONT_READ;
if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL) {
msg->som = msg->sov;
}
- if (msg->msg_state == HTTP_MSG_CHUNK_SIZE) {
+ if (msg->msg_state == HTTP_MSG_DATA) {
+ /* must still forward */
+ if (res->to_forward)
+ return 0;
+
+ /* nothing left to forward */
+ if (txn->flags & TX_RES_TE_CHNK)
+ msg->msg_state = HTTP_MSG_DATA_CRLF;
+ else
+ msg->msg_state = HTTP_MSG_DONE;
+ }
+ else if (msg->msg_state == HTTP_MSG_CHUNK_SIZE) {
/* read the chunk size and assign it to ->hdr_content_len, then
* set ->sov to point to the body and switch to DATA or TRAILERS state.
*/
goto return_bad_res;
/* otherwise we're in HTTP_MSG_DATA or HTTP_MSG_TRAILERS state */
}
- else if (msg->msg_state == HTTP_MSG_DATA) {
- /* must still forward */
- if (res->to_forward)
- return 0;
-
- /* nothing left to forward */
- if (txn->flags & TX_RES_TE_CHNK)
- msg->msg_state = HTTP_MSG_DATA_CRLF;
- else {
- msg->msg_state = HTTP_MSG_DONE;
- }
- }
else if (msg->msg_state == HTTP_MSG_DATA_CRLF) {
/* we want the CRLF after the data */
int ret;
}
if (res->flags & (BF_SHUTW|BF_SHUTW_NOW)) {
- if (res->flags & BF_OUT_EMPTY)
+ if (res->flags & BF_OUT_EMPTY) {
msg->msg_state = HTTP_MSG_CLOSED;
- else
+ goto http_msg_closed;
+ }
+ else {
msg->msg_state = HTTP_MSG_CLOSING;
+ goto http_msg_closing;
+ }
}
else {
/* for other modes, we let further responses pass for now */
}
}
else if (msg->msg_state == HTTP_MSG_CLOSING) {
+ http_msg_closing:
/* nothing else to forward, just waiting for the buffer to be empty */
if (!(res->flags & BF_OUT_EMPTY))
return 0;
msg->msg_state = HTTP_MSG_CLOSED;
}
else if (msg->msg_state == HTTP_MSG_CLOSED) {
+ http_msg_closed:
res->flags &= ~BF_DONT_READ;
/* FIXME: we're still forced to do that here */
s->req->flags &= ~BF_DONT_READ;