break;
case HTX_BLK_EOH:
+ if (fconn->proxy->server_id_hdr_name) {
+ struct server *srv = objt_server(fconn->conn->target);
+
+ if (!srv)
+ goto done;
+
+ memcpy(trash.area, "http_", 5);
+ memcpy(trash.area+5, fconn->proxy->server_id_hdr_name, fconn->proxy->server_id_hdr_len);
+ p.n = ist2(trash.area, fconn->proxy->server_id_hdr_len+5);
+ p.v = ist(srv->id);
+
+ if (!fcgi_encode_param(&outbuf, &p)) {
+ if (b_space_wraps(mbuf))
+ goto realign_again;
+ if (outbuf.data == 8)
+ goto full;
+ }
+ }
goto done;
default:
#define H1S_F_SPLICED_DATA 0x00000200 /* Set when the kernel splicing is in used */
#define H1S_F_HAVE_I_TLR 0x00000800 /* Set during input process to know the trailers were processed */
#define H1S_F_APPEND_EOM 0x00001000 /* Send EOM to the HTX buffer */
-/* 0x00002000 .. 0x00002000 unused */
+/* 0x00002000 .. 0x00001000 unused */
+#define H1S_F_HAVE_SRV_NAME 0x00002000 /* Set during output process if the server name header was added to the request */
#define H1S_F_HAVE_O_CONN 0x00004000 /* Set during output process to know connection mode was processed */
/* H1 connection descriptor */
h1m->flags |= H1_MF_CHNK;
}
+ /* Now add the server name to a header (if requested) */
+ if (!(h1s->flags & H1S_F_HAVE_SRV_NAME) &&
+ !(h1m->flags & H1_MF_RESP) && h1c->px->server_id_hdr_name) {
+ struct server *srv = objt_server(h1c->conn->target);
+
+ if (srv) {
+ n = ist2(h1c->px->server_id_hdr_name, h1c->px->server_id_hdr_len);
+ v = ist(srv->id);
+ if (!htx_hdr_to_h1(n, v, &tmp))
+ goto copy;
+ }
+ h1s->flags |= H1S_F_HAVE_SRV_NAME;
+ }
+
if (!chunk_memcat(&tmp, "\r\n", 2))
goto copy;
hdr++;
}
+ /* Now add the server name to a header (if requested) */
+ if ((h2c->flags & H2_CF_IS_BACK) && h2c->proxy->server_id_hdr_name) {
+ struct server *srv = objt_server(h2c->conn->target);
+
+ if (srv) {
+ list[hdr].n = ist2(h2c->proxy->server_id_hdr_name, h2c->proxy->server_id_hdr_len);
+ list[hdr].v = ist(srv->id);
+ hdr++;
+ }
+ }
+
/* marker for end of headers */
list[hdr].n = ist("");
if (unlikely(si_b->state == SI_ST_EST))
sess_establish(s);
- /* Now we can add the server name to a header (if requested) */
- /* check for HTTP mode and proxy server_name_hdr_name != NULL */
- if (si_state_in(si_b->state, SI_SB_CON|SI_SB_RDY|SI_SB_EST) &&
- (s->be->server_id_hdr_name != NULL) &&
- (s->be->mode == PR_MODE_HTTP) &&
- objt_server(s->target)) {
- http_send_name_header(s, s->be, objt_server(s->target)->id);
- }
-
srv = objt_server(s->target);
if (si_b->state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SF_REDIRECTABLE))
http_perform_server_redirect(s, si_b);