- support for matching $HTTP["scheme"] in configs, patch from:

http://trac.lighttpd.net/trac/wiki/HowToRedirectHttpToHttps
  apparently by swiergot/at/gmail.com, adjusted for current svn.


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2012 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.19
Elan Ruusamäe 2007-11-04 16:53:17 +00:00
parent cb0f21c745
commit d6b9709b54
5 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,8 @@ where <field> is one of one of the following:
$HTTP["cookie"]
match on cookie
$HTTP["scheme"]
match on scheme
$HTTP["host"]
match on host
$HTTP["useragent"]

View File

@ -90,6 +90,7 @@ typedef enum {
COMP_HTTP_COOKIE,
COMP_HTTP_REMOTEIP,
COMP_HTTP_QUERYSTRING,
COMP_HTTP_SCHEME,
COMP_LAST_ELEMENT
} comp_key_t;

View File

@ -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;

View File

@ -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;

View File

@ -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: */