diff --git a/doc/configuration.txt b/doc/configuration.txt index 9ed458f2..29480cb3 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -85,6 +85,8 @@ where is one of one of the following: $HTTP["cookie"] match on cookie +$HTTP["scheme"] + match on scheme $HTTP["host"] match on host $HTTP["useragent"] diff --git a/src/array.h b/src/array.h index b8a83455..3a5b05f0 100644 --- a/src/array.h +++ b/src/array.h @@ -90,6 +90,7 @@ typedef enum { COMP_HTTP_COOKIE, COMP_HTTP_REMOTEIP, COMP_HTTP_QUERYSTRING, + COMP_HTTP_SCHEME, COMP_LAST_ELEMENT } comp_key_t; diff --git a/src/configfile-glue.c b/src/configfile-glue.c index f6ead924..df8d1b11 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -341,6 +341,10 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat } break; } + case COMP_HTTP_SCHEME: + l = con->uri.scheme; + break; + case COMP_HTTP_URL: l = con->uri.path; break; diff --git a/src/configparser.y b/src/configparser.y index 30f5fd91..18aa22bf 100644 --- a/src/configparser.y +++ b/src/configparser.y @@ -422,6 +422,7 @@ context ::= DOLLAR SRVVARNAME(B) LBRACKET stringop(C) RBRACKET cond(E) expressio { COMP_HTTP_COOKIE, CONST_STR_LEN("HTTP[\"cookie\"]" ) }, { COMP_HTTP_REMOTEIP, CONST_STR_LEN("HTTP[\"remoteip\"]" ) }, { COMP_HTTP_QUERYSTRING, CONST_STR_LEN("HTTP[\"querystring\"]") }, + { COMP_HTTP_SCHEME, CONST_STR_LEN("HTTP[\"scheme\"]" ) }, { COMP_UNSET, NULL, 0 }, }; size_t i; diff --git a/src/response.c b/src/response.c index b8775f06..93c3839d 100644 --- a/src/response.c +++ b/src/response.c @@ -180,6 +180,7 @@ handler_t http_response_prepare(server *srv, connection *con) { buffer_copy_string_buffer(con->uri.authority, con->request.http_host); buffer_to_lower(con->uri.authority); + config_patch_connection(srv, con, COMP_HTTP_SCHEME); /* Scheme: */ config_patch_connection(srv, con, COMP_HTTP_HOST); /* Host: */ config_patch_connection(srv, con, COMP_HTTP_REMOTEIP); /* Client-IP */ config_patch_connection(srv, con, COMP_HTTP_REFERER); /* Referer: */