#define HTX_FL_PARSING_ERROR 0x00000001 /* Set when a parsing error occurred */
#define HTX_FL_PROCESSING_ERROR 0x00000002 /* Set when a processing error occurred */
#define HTX_FL_FRAGMENTED 0x00000004 /* Set when the HTX buffer is fragmented */
-#define HTX_FL_PROXY_RESP 0x00000008 /* Set when the response was generated by HAProxy */
+/* 0x00000008 unused */
#define HTX_FL_EOM 0x00000010 /* Set when end-of-message is reached from the HTTP point of view
* (at worst, on the EOM block is missing)
*/
_(0);
/* flags */
_(HTX_FL_PARSING_ERROR, _(HTX_FL_PROCESSING_ERROR,
- _(HTX_FL_FRAGMENTED, _(HTX_FL_PROXY_RESP, _(HTX_FL_EOM)))));
+ _(HTX_FL_FRAGMENTED, _(HTX_FL_EOM))));
/* epilogue */
_(~0U);
return buf;
struct buffer *chunk;
struct ist status, reason, location;
unsigned int flags;
- int ret = 1, close = 0; /* Try to keep the connection alive byt default */
+ int ret = 1;
chunk = alloc_trash_chunk();
if (!chunk) {
break;
}
- if (!(txn->req.flags & HTTP_MSGF_BODYLESS) && txn->req.msg_state != HTTP_MSG_DONE)
- close = 1;
-
htx = htx_from_buf(&res->buf);
/* Trim any possible response */
channel_htx_truncate(&s->res, htx);
sl->info.res.status = rule->code;
s->txn->status = rule->code;
- if (close && !htx_add_header(htx, ist("Connection"), ist("close")))
- goto fail;
-
if (!htx_add_header(htx, ist("Content-length"), ist("0")) ||
!htx_add_header(htx, ist("Location"), location))
goto fail;
s->txn->status = 302;
if (!htx_add_header(htx, ist("Cache-Control"), ist("no-cache")) ||
- !htx_add_header(htx, ist("Connection"), ist("close")) ||
!htx_add_header(htx, ist("Content-length"), ist("0")) ||
!htx_add_header(htx, ist("Location"), location))
goto fail;
size_t data;
if (final) {
- htx->flags |= HTX_FL_PROXY_RESP;
+ if (s->txn->server_status == -1)
+ s->txn->server_status = 0;
if (!htx_is_empty(htx) && !http_eval_after_res_rules(s))
return 0;
else {
if (txn->status == -1)
txn->status = sl->info.res.status;
- if (!(htx->flags & HTX_FL_PROXY_RESP) && txn->server_status == -1)
+ if (txn->server_status == -1)
txn->server_status = sl->info.res.status;
}
if (sl->flags & HTX_SL_F_VER_11)
/* Deal with "Connection" header */
if (!(h1s->flags & H1S_F_HAVE_O_CONN)) {
- if ((htx->flags & HTX_FL_PROXY_RESP) && h1s->req.state != H1_MSG_DONE) {
- /* If the reply comes from haproxy while the request is
- * not finished, we force the connection close. */
- h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
- TRACE_STATE("force close mode (resp)", H1_EV_TX_DATA|H1_EV_TX_HDRS, h1s->h1c->conn, h1s);
- }
- else if ((h1m->flags & (H1_MF_XFER_ENC|H1_MF_CLEN)) == (H1_MF_XFER_ENC|H1_MF_CLEN)) {
+ if ((h1m->flags & (H1_MF_XFER_ENC|H1_MF_CLEN)) == (H1_MF_XFER_ENC|H1_MF_CLEN)) {
/* T-E + C-L: force close */
h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
h1m->flags &= ~H1_MF_CLEN;