diff -ruN lighttpd-1.4.13.orig/doc/configuration.txt lighttpd-1.4.13/doc/configuration.txt
--- lighttpd-1.4.13.orig/doc/configuration.txt	2006-10-04 15:29:19.000000000 +0200
+++ lighttpd-1.4.13/doc/configuration.txt	2007-07-04 20:15:53.000000000 +0200
@@ -85,6 +85,8 @@
 
 $HTTP["cookie"]
   match on cookie
+$HTTP["scheme"]
+  match on scheme
 $HTTP["host"]
   match on host
 $HTTP["useragent"]
diff -ruN lighttpd-1.4.13.orig/src/array.h lighttpd-1.4.13/src/array.h
--- lighttpd-1.4.13.orig/src/array.h	2006-10-04 15:29:17.000000000 +0200
+++ lighttpd-1.4.13/src/array.h	2007-07-04 20:17:07.000000000 +0200
@@ -89,7 +89,8 @@
 	COMP_HTTP_USERAGENT,
 	COMP_HTTP_COOKIE,
 	COMP_HTTP_REMOTEIP,
-	COMP_HTTP_QUERYSTRING
+	COMP_HTTP_QUERYSTRING,
+	COMP_HTTP_SCHEME
 } comp_key_t;
 
 /* $HTTP["host"] ==    "incremental.home.kneschke.de" { ... }
diff -ruN lighttpd-1.4.13.orig/src/configfile-glue.c lighttpd-1.4.13/src/configfile-glue.c
--- lighttpd-1.4.13.orig/src/configfile-glue.c	2006-10-04 15:29:17.000000000 +0200
+++ lighttpd-1.4.13/src/configfile-glue.c	2007-07-04 20:16:52.000000000 +0200
@@ -304,6 +304,10 @@
 		}
 		break;
 	}
+	case COMP_HTTP_SCHEME:
+		l = con->uri.scheme;
+		break;
+
 	case COMP_HTTP_URL:
 		l = con->uri.path;
 		break;
diff -ruN lighttpd-1.4.13.orig/src/configparser.y lighttpd-1.4.13/src/configparser.y
--- lighttpd-1.4.13.orig/src/configparser.y	2006-10-04 15:29:17.000000000 +0200
+++ lighttpd-1.4.13/src/configparser.y	2007-07-04 20:17:52.000000000 +0200
@@ -421,6 +421,7 @@
       { 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 -ruN lighttpd-1.4.13.orig/src/response.c lighttpd-1.4.13/src/response.c
--- lighttpd-1.4.13.orig/src/response.c	2006-10-04 15:29:17.000000000 +0200
+++ lighttpd-1.4.13/src/response.c	2007-07-04 20:18:23.000000000 +0200
@@ -177,6 +177,7 @@
 		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:     */

