should only be used between trusted WebSocket endpoints, and the risk is
moderate.
+ - "http-1.0-status-1xx" (response): this controls the acceptance of HTTP
+ status codes below 200 in responses from or to HTTP/1.0 messages. These
+ ranges were specified as reserved and are not uniformly implemented
+ across implementations, and present a risk of smuggling. This should only
+ be used with confirmed valid endpoints, and the risk is low because
+ HTTP/1.0-only agents became rare.
+
By default, for backward compatibility, all violations above are flagged as
acceptable, meaning that a proxy having "option accept-unsafe-http-*" will
accept them all. It may be a good practice to explicitly reset them to "none"
HTTP_VIO_AUTH_HOST_DIFF, // authority and host field mismatch
HTTP_VIO_VERSION_STRING, // unsupported version string
HTTP_VIO_WEBSOCKET_KEY, // invalid or missing websocket-key header
+ HTTP_VIO_1XX_HTTP_1_0, // 1xx in response from or to HTTP/1.0
/* insert new violations above this line */
HTTP_VIO_TOTAL_COUNT = 32, // end marker
HTTP_VIO_NONE, // special code for none
{ "mismatch-authority-host", HTTP_VIO_AUTH_HOST_DIFF, HTTP_DIR_REQ },
{ "invalid-version-string", HTTP_VIO_VERSION_STRING, HTTP_DIR_BOTH },
{ "invalid-websocket-key", HTTP_VIO_WEBSOCKET_KEY, HTTP_DIR_BOTH },
+ { "http-1.0-status-1xx", HTTP_VIO_1XX_HTTP_1_0, HTTP_DIR_RES },
/* insert new violations above this line */
{ "all", HTTP_VIO_ALL, HTTP_DIR_BOTH },
{ NULL, 0 }
* response, and we're waiting for the next one. Let's allow this response
* to go to the client and wait for the next one. There's an exception for
* 101 which is used later in the code to switch protocols.
+ *
+ * Anyway, for HTTP/1.0 (client or server), <200 is forbidden.
*/
- if (txn->status < 200 &&
- (txn->status == 100 || txn->status >= 102)) {
- FLT_STRM_CB(s, flt_http_reset(s, msg));
- htx->first = channel_htx_fwd_headers(rep, htx);
- msg->msg_state = HTTP_MSG_RPBEFORE;
- msg->flags = 0;
- txn->server_status = txn->status = 0;
- s->logs.t_data = -1; /* was not a response yet */
- s->scf->flags |= SC_FL_SND_ASAP; /* Send ASAP informational messages */
- goto next_one;
- }
-
- /* A 101-switching-protocols must contains a Connection header with the
- * "upgrade" option and the request too. It means both are agree to
- * upgrade. It is not so strict because there is no test on the Upgrade
- * header content. But it is probably stronger enough for now.
- */
- if (txn->status == 101 &&
- (!(txn->req.flags & HTTP_MSGF_CONN_UPG) || !(txn->rsp.flags & HTTP_MSGF_CONN_UPG))) {
- if (objt_server(s->target))
- health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
- goto return_bad_res;
+ if (unlikely(txn->status < 200)) {
+ if (!(txn->req.flags & txn->rsp.flags & HTTP_MSGF_VER_11) &&
+ !(s->be->options2 & PR_O2_RSPBUG_OK &&
+ global.acc_hres_vio & (1U << HTTP_VIO_1XX_HTTP_1_0))) {
+ /* at least one side is not 1.1 compatible, this is a violation */
+ if (objt_server(s->target))
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
+ goto return_bad_res;
+ }
+
+ if (txn->status == 100 || txn->status >= 102) {
+ FLT_STRM_CB(s, flt_http_reset(s, msg));
+ htx->first = channel_htx_fwd_headers(rep, htx);
+ msg->msg_state = HTTP_MSG_RPBEFORE;
+ msg->flags = 0;
+ txn->server_status = txn->status = 0;
+ s->logs.t_data = -1; /* was not a response yet */
+ s->scf->flags |= SC_FL_SND_ASAP; /* Send ASAP informational messages */
+ goto next_one;
+ }
+
+ /* A 101-switching-protocols must contains a Connection header with the
+ * "upgrade" option and the request too. It means both are agree to
+ * upgrade. It is not so strict because there is no test on the Upgrade
+ * header content. But it is probably stronger enough for now.
+ */
+ if (txn->status == 101 &&
+ (!(txn->req.flags & HTTP_MSGF_CONN_UPG) || !(txn->rsp.flags & HTTP_MSGF_CONN_UPG))) {
+ if (objt_server(s->target))
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
+ goto return_bad_res;
+ }
}
/*