return ret;
}
-/* Cut the "tail" of the channel's buffer, which means strip it to the length
- * of unsent data only, and kill any remaining unsent data. Any scheduled
- * forwarding is stopped. This is mainly to be used to send error messages
- * after existing data.
+/* Truncate any unread data in the channel's buffer, and disable forwarding.
+ * Outgoing data are left intact. This is mainly to be used to send error
+ * messages after existing data.
*/
-static inline void bi_erase(struct channel *chn)
+static inline void channel_truncate(struct channel *chn)
{
if (!chn->buf->o)
return channel_erase(chn);
if (txn->rsp.msg_state == HTTP_MSG_CLOSED) {
http_msg_closed:
/* drop any pending data */
- bi_erase(chn);
+ channel_truncate(chn);
channel_auto_close(chn);
channel_auto_read(chn);
goto wait_other_side;
channel_abort(s->req);
channel_auto_close(s->req);
channel_auto_read(s->req);
- bi_erase(s->req);
+ channel_truncate(s->req);
}
else if ((txn->req.msg_state == HTTP_MSG_DONE ||
txn->req.msg_state == HTTP_MSG_CLOSED) &&
rep->analysers = 0;
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
rep->analysers = 0;
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
rep->analysers = 0;
txn->status = 504;
rep->prod->flags |= SI_FL_NOLINGER;
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_504));
if (!(s->flags & SN_ERR_MASK))
channel_auto_close(rep);
txn->status = 400;
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_400));
if (!(s->flags & SN_ERR_MASK))
rep->analysers = 0;
txn->status = 502;
rep->prod->flags |= SI_FL_NOLINGER;
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
s->logs.logwait = 0;
s->logs.level = 0;
s->rep->flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, NULL);
return 0;
}
txn->status = 502;
s->logs.t_data = -1; /* was not a valid response */
rep->prod->flags |= SI_FL_NOLINGER;
- bi_erase(rep);
+ channel_truncate(rep);
stream_int_retnclose(rep->cons, http_error_message(s, HTTP_ERR_502));
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_PRXCOND;