diff -Naur nginx-0.6.24/src/http/ngx_http_variables.c nginx-0.6.24-cookies/src/http/ngx_http_variables.c
--- nginx-0.6.24/src/http/ngx_http_variables.c	2007-10-14 14:56:15.000000000 -0400
+++ nginx-0.6.24-cookies/src/http/ngx_http_variables.c	2008-01-03 13:47:24.000000000 -0500
@@ -22,6 +22,9 @@
 static ngx_int_t ngx_http_variable_headers(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
 
+static ngx_int_t ngx_http_variable_cookies_in(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data);
+
 static ngx_int_t ngx_http_variable_unknown_header_in(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
 static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r,
@@ -444,6 +447,12 @@
 
     if (ngx_strncmp(name->data, "http_", 5) == 0) {
 
+        if (ngx_strncmp(name->data + sizeof("http_") - 1, "cookie_", sizeof("cookie_") - 1) == 0
+                && ngx_http_variable_cookies_in(r, vv, (uintptr_t) name) == NGX_OK)
+        {
+            return vv;
+        }
+
         if (ngx_http_variable_unknown_header_in(r, vv, (uintptr_t) name)
             == NGX_OK)
         {
@@ -630,6 +639,33 @@
     return NGX_OK;
 }
 
+static ngx_int_t
+ngx_http_variable_cookies_in(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data)
+{
+    ngx_str_t cookie_name;
+    ngx_str_t cookie_val;
+
+    cookie_name.data = ((ngx_str_t *)data)->data + sizeof("http_cookie_") - 1;
+    cookie_name.len  = ((ngx_str_t *)data)->len - (sizeof("http_cookie_") - 1);
+
+    if (r->headers_in.cookies.elts
+            && ngx_http_parse_multi_header_lines(&r->headers_in.cookies,
+                &cookie_name, &cookie_val) != NGX_DECLINED
+            && cookie_val.len)
+    {
+        v->len = cookie_val.len;
+        v->valid = 1;
+        v->no_cacheable = 0;
+        v->not_found = 0;
+        v->data = cookie_val.data;
+    } else {
+        v->not_found = 1;
+    }
+
+    return NGX_OK;
+}
+
 
 static ngx_int_t
 ngx_http_variable_unknown_header_in(ngx_http_request_t *r,
