commit f40e03c4616d7d2804dce584de6fab0f93f6ae1e
Author: thierry <thierry>
Date:   Sun Jul 24 12:14:04 2011 +0200

    NGINX: Add unique id module

diff --git a/extern/nginx/auto/modules b/extern/nginx/auto/modules
index cba3768..8eec8d4 100644
--- a/extern/nginx/auto/modules
+++ b/extern/nginx/auto/modules
@@ -191,6 +191,12 @@ if [ $HTTP_REALIP = YES ]; then
     HTTP_SRCS="$HTTP_SRCS $HTTP_REALIP_SRCS"
 fi
 
+if [ $HTTP_UNIQUEID = YES ]; then
+    have=NGX_HTTP_UNIQUEID . auto/have
+    HTTP_MODULES="$HTTP_MODULES $HTTP_UNIQUEID_MODULE"
+    HTTP_SRCS="$HTTP_SRCS $HTTP_UNIQUEID_SRCS"
+fi
+
 if [ $HTTP_STATUS = YES ]; then
     have=NGX_HTTP_STATUS . auto/have
     HTTP_MODULES="$HTTP_MODULES $HTTP_STATUS_MODULE"
diff --git a/extern/nginx/auto/options b/extern/nginx/auto/options
index 268ece9..6418bae 100644
--- a/extern/nginx/auto/options
+++ b/extern/nginx/auto/options
@@ -166,6 +166,7 @@ do
         --with-http_dav_module)          HTTP_DAV=YES               ;;
         --with-http_flv_module)          HTTP_FLV=YES               ;;
         --with-http_gzip_static_module)  HTTP_GZIP_STATIC=YES       ;;
+        --with-http_uniqueid_module)     HTTP_UNIQUEID=YES          ;;
 
         --without-http_charset_module)   HTTP_CHARSET=NO            ;;
         --without-http_gzip_module)      HTTP_GZIP=NO               ;;
@@ -282,6 +283,7 @@ cat << END
   --with-http_flv_module             enable ngx_http_flv_module
   --with-http_gzip_static_module     enable ngx_http_gzip_static_module
   --with-http_stub_status_module     enable ngx_http_stub_status_module
+  --with-http_uniqueid_module        enable ngx_http_uniqueid_module
 
   --without-http_charset_module      disable ngx_http_charset_module
   --without-http_gzip_module         disable ngx_http_gzip_module
diff --git a/extern/nginx/auto/sources b/extern/nginx/auto/sources
index ed78c71..f290e81 100644
--- a/extern/nginx/auto/sources
+++ b/extern/nginx/auto/sources
@@ -338,6 +338,10 @@ HTTP_REALIP_MODULE=ngx_http_realip_module
 HTTP_REALIP_SRCS=src/http/modules/ngx_http_realip_module.c
 
 
+HTTP_UNIQUEID_MODULE=ngx_http_uniqueid_module
+HTTP_UNIQUEID_SRCS=src/http/modules/ngx_http_uniqueid_module.c
+
+
 HTTP_ADDITION_FILTER_MODULE=ngx_http_addition_filter_module
 HTTP_ADDITION_SRCS=src/http/modules/ngx_http_addition_filter_module.c
 
diff --git a/extern/nginx/src/http/modules/ngx_http_uniqueid_module.c b/extern/nginx/src/http/modules/ngx_http_uniqueid_module.c
new file mode 100644
index 0000000..6d6095d
--- /dev/null
+++ b/extern/nginx/src/http/modules/ngx_http_uniqueid_module.c
@@ -0,0 +1,644 @@
+/* 
+ * Build x-proxy-uniqueid variable. 
+ *
+ *   Copyright (C) Thierry Fournier
+ *
+ * This variable permit to tag and follow one http request over
+ * the hosting infrastruture.
+ *
+ * This function build a unique identifier for each request. The
+ * format is:
+ * 
+ *   SIP:SPORT_DIP:DPORT_TSTAMP_PID:COUNT_HOSTNAME
+ *
+ *   SIP:      Source IP in hexadecimal format        [32 bits]
+ *   SPORT:    Source port in hexadecimal format      [16 bits]
+ *   DIP:      Destination IP in hexadecimal format   [32 bits]
+ *   DPORT:    Destination port in hexadecimal format [16 bits]
+ *   TSTAMP:   Unix timestamp in hexadecimal format   [32 bits]
+ *   PID:      Application PID in hexadecimal format  [32 bits]
+ *             OS like AIX or Tru64 have 32 bits pid.
+ *   COUNT:    Request counter for each second.       [32 bits]
+ *   HOSTNAME: Host name
+ *
+ * Exemple:
+ * 
+ *   X-Proxy-UniqueID: C0A80A01:3039_C0A80A02:0050_4DF77362_00004684:00000001_SRV01
+ */
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_http.h>
+#include <ngx_http_variables.h>
+#include <ngx_thread.h>
+#include <ngx_time.h>
+
+/* the max length for the hostname */
+#define HOSTNAME_MAX_LEN 128
+
+/* mutex for incresing counter without concurrent acces */
+#if (NGX_THREADS)
+ngx_mutex_t                *ngx_http_uniqueid_counter_lock;
+#endif
+
+/* the courrent counter value */
+static int                  ngx_http_uniqueid_counter = 0;
+
+/* the timestamp associated ti the counter */
+static int                  ngx_http_uniqueid_timestamp = 0;
+
+/* Default header name */
+static ngx_str_t            ngx_http_uniqueid_hdr_nam = ngx_string("X-Proxy-UniqueID");
+
+/* contain the hostname */
+static ngx_str_t            ngx_http_uniqueid_hostname;
+
+/* contain the hostname */
+static ngx_str_t            ngx_http_uniqueid_pid;
+
+/* contain the full len of the header content */
+static size_t               ngx_http_uniqueid_fulllen;
+
+/* contain the index of the header content generation variable */
+static ngx_int_t            ngx_http_uniqueid_varindex;
+
+/*
+ *
+ * The uniqueid header insertion mode
+ *
+ */
+
+enum ngx_http_uniqueid_mode {
+    NGX_HTTP_UNIQUEID_MODE_OFF = 0,
+    NGX_HTTP_UNIQUEID_MODE_ADD,
+    NGX_HTTP_UNIQUEID_MODE_REPLACE,
+    NGX_HTTP_UNIQUEID_MODE_FORCE
+};
+
+/*
+ *
+ * The uniqueid internal configuration struct
+ *
+ */
+typedef struct {
+    enum ngx_http_uniqueid_mode  mode;        /* insertion header mode */
+    char                         mode_def;    /* set if is default value */
+    ngx_str_t                   *hdr_nam;     /* insertion header name */
+    char                         hdr_nam_def; /* set if hdr_nam is default */
+} ngx_http_uniqueid_conf_t;
+
+/*
+ *
+ * The uniqueid configuration internal functions
+ *
+ */
+
+static ngx_int_t ngx_http_uniqueid_init(ngx_conf_t *cf);
+
+static void *ngx_http_uniqueid_create_conf(ngx_conf_t *cf);
+
+static char *ngx_http_uniqueid_merge_conf(ngx_conf_t *cf,
+    void *_parent, void *_child);
+
+static char *ngx_http_uniqueid_set_mode(ngx_conf_t *cf,
+    ngx_command_t *cmd, void *conf);
+
+static char *ngx_http_uniqueid_set_hdr_nam(ngx_conf_t *cf,
+    ngx_command_t *cmd, void *conf);
+
+/*
+ *
+ * The uniqueid running internal functions
+ *
+ */
+
+static ngx_int_t ngx_http_variable_uniqueid(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data);
+
+static ngx_int_t ngx_http_uniqueid_handler(ngx_http_request_t *r);
+
+/*
+ *
+ * The uniqueid array arguments and the associated callbacks
+ *
+ */
+static ngx_command_t ngx_http_uniqueid_commands[] = {
+
+    { ngx_string("uniqueid_mode"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF
+                        |NGX_CONF_TAKE1,
+      ngx_http_uniqueid_set_mode,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      0,
+      NULL},
+
+    { ngx_string("uniqueid_header_name"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF
+                        |NGX_CONF_TAKE1,
+      ngx_http_uniqueid_set_hdr_nam,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      0,
+      NULL},
+
+      ngx_null_command
+};
+
+/*
+ *
+ * The configuration handlers
+ *
+ */
+static ngx_http_module_t ngx_http_uniqueid_module_ctx = {
+
+    NULL,                                  /* preconfiguration */
+    ngx_http_uniqueid_init,                /* postconfiguration */
+
+    NULL,                                  /* create main configuration */
+    NULL,                                  /* init main configuration */
+
+    NULL,                                  /* create server configuration */
+    NULL,                                  /* merge server configuration */
+
+    ngx_http_uniqueid_create_conf,         /* create location configuration */
+    ngx_http_uniqueid_merge_conf           /* merge location configuration */
+};
+
+/*
+ *
+ * The module registration entry
+ *
+ */
+ngx_module_t ngx_http_uniqueid_module = {
+    NGX_MODULE_V1,
+    &ngx_http_uniqueid_module_ctx,         /* module context */
+    ngx_http_uniqueid_commands,            /* module directives */
+    NGX_HTTP_MODULE,                       /* module type */
+    NULL,                                  /* init master */
+    NULL,                                  /* init module */
+    NULL,                                  /* init process */
+    NULL,                                  /* init thread */
+    NULL,                                  /* exit thread */
+    NULL,                                  /* exit process */
+    NULL,                                  /* exit master */
+    NGX_MODULE_V1_PADDING
+};
+
+/*
+ *
+ * Initialization function
+ *
+ */
+#define NGX_UNIQUEID_PID_MAXLEN 9
+static ngx_int_t
+ngx_http_uniqueid_init(ngx_conf_t *cf)
+{
+    static ngx_str_t uniqueid_string = ngx_string("uniqueid");
+    static u_char hostname[HOSTNAME_MAX_LEN];
+    static u_char pid[NGX_UNIQUEID_PID_MAXLEN];
+    ngx_http_variable_t *ngx_http_uniqueid_variable;
+    ngx_http_core_main_conf_t *cmcf;
+    ngx_http_handler_pt *h;
+
+    /*
+     * Init variable $uniqueid
+     */
+
+    /* new variable */
+    ngx_http_uniqueid_variable = ngx_http_add_variable(cf, &uniqueid_string, NGX_HTTP_VAR_CHANGEABLE);
+    if (ngx_http_uniqueid_variable == NULL) {
+        return NGX_ERROR;
+    }
+
+    /* variable properties */
+    ngx_http_uniqueid_variable->set_handler = NULL;
+    ngx_http_uniqueid_variable->get_handler = ngx_http_variable_uniqueid;
+
+    /* get variable index */
+    ngx_http_uniqueid_varindex = ngx_http_get_variable_index(cf, &uniqueid_string);
+
+    /*
+     * Init thead safe lock
+     */
+#if (NGX_THREADS)
+    if (ngx_http_uniqueid_counter_lock = ngx_mutex_init(cf->log, 0) != NGX_OK)
+        return NGX_ERROR;
+#endif
+
+    /*
+     * Get hostname
+     */
+    if (gethostname((char *)hostname, HOSTNAME_MAX_LEN) != 0)
+        return NGX_ERROR;
+    hostname[HOSTNAME_MAX_LEN - 1] = '\0';
+    ngx_http_uniqueid_hostname.data = hostname;
+    ngx_http_uniqueid_hostname.len = ngx_strlen(hostname);
+
+    /*
+     * Init pid
+     */
+    snprintf((char *)pid, NGX_UNIQUEID_PID_MAXLEN, "%08X", ngx_pid);
+    pid[NGX_UNIQUEID_PID_MAXLEN - 1] = '\0';
+    ngx_http_uniqueid_pid.data = pid;
+    ngx_http_uniqueid_pid.len = NGX_UNIQUEID_PID_MAXLEN - 1;
+
+    /*
+     * Compute unique id full len
+     *
+     *   SIP:SPORT_DIP:DPORT_TSTAMP_PID:COUNT_HOSTNAME
+     *   %08X:%04X_%08X:%04X_%08X_%*s:%08X_%*s
+     *
+     */
+    ngx_http_uniqueid_fulllen = 
+        8 + /* SIP     32 bits */
+        1 + /* ':'      8 bits */
+        4 + /* SPORT   16 bits */
+        1 + /* '_'      8 bits */
+        8 + /* DIP     32 bits */
+        1 + /* ':'      8 bits */
+        4 + /* DPORT   16 bits */
+        1 + /* '_'      8 bits */
+        8 + /* TSTAMP  32 bits */
+        1 + /* '_'      8 bits */
+        8 + /* PID     32 bits */
+        1 + /* ':'      8 bits */
+        8 + /* COUNT   32 bits */
+        1 + /* '_'      8 bits */
+            /* HOSTNAME */
+        ngx_http_uniqueid_hostname.len +
+        1;  /* '\0' */
+
+    /*
+     *
+     * Register add header function
+     *
+     */
+    cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
+    h = ngx_array_push(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers);
+    if (h == NULL) {
+        return NGX_ERROR;
+    }
+    *h = ngx_http_uniqueid_handler;
+
+
+    return NGX_OK;
+}
+
+/*
+ *
+ * initilize new configuration section
+ *
+ *
+ */
+static void *
+ngx_http_uniqueid_create_conf(ngx_conf_t *cf)
+{
+    ngx_http_uniqueid_conf_t  *conf;
+
+    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_uniqueid_conf_t));
+    if (conf == NULL) {
+        return NGX_CONF_ERROR;
+    }
+
+    /* By default, the module is noactive */
+    conf->mode = NGX_HTTP_UNIQUEID_MODE_OFF;
+    conf->mode_def = 1;
+
+    /* By default, the header name is X-Proxy-UniqueID */
+    conf->hdr_nam = &ngx_http_uniqueid_hdr_nam;
+    conf->hdr_nam_def = 1;
+
+    return conf;
+}
+
+/*
+ *
+ * Merge two unique id configuration
+ *
+ */
+static char *
+ngx_http_uniqueid_merge_conf(ngx_conf_t *cf, void *_parent, void *_child)
+{
+    ngx_http_uniqueid_conf_t *parent = _parent;
+    ngx_http_uniqueid_conf_t *child  = _child;
+
+    /* If the configuration variable is flaggued "default"
+     * is always inherited from the parent
+     */
+
+    if (child->mode_def == 1) {
+        child->mode = parent->mode;
+    }
+   
+    if (child->hdr_nam_def == 1) {
+        child->hdr_nam = parent->hdr_nam;
+    }
+
+    return NGX_CONF_OK;
+}
+
+/*
+ *
+ * Set "uniqueid_mode" value
+ *
+ */
+static char *
+ngx_http_uniqueid_set_mode(ngx_conf_t *cf, ngx_command_t *cmd, void *_conf)
+{
+    ngx_http_uniqueid_conf_t *conf = _conf;
+    ngx_str_t                *value = cf->args->elts;
+    ngx_str_t                *key = &value[1];
+
+    /* mode off */
+    /**/ if (ngx_strcmp(key->data, "off") == 0) {
+        conf->mode = NGX_HTTP_UNIQUEID_MODE_OFF;
+        conf->mode_def = 0;
+    }
+
+    /* mode add */
+    else if (ngx_strcmp(key->data, "add") == 0) {
+        conf->mode = NGX_HTTP_UNIQUEID_MODE_ADD;
+        conf->mode_def = 0;
+    }
+
+    /* mode replace */
+    else if (ngx_strcmp(key->data, "replace") == 0) {
+        conf->mode = NGX_HTTP_UNIQUEID_MODE_REPLACE;
+        conf->mode_def = 0;
+    }
+
+    /* mode force */
+    else if (ngx_strcmp(key->data, "force") == 0) {
+        conf->mode = NGX_HTTP_UNIQUEID_MODE_FORCE;
+        conf->mode_def = 0;
+    }
+
+    /* unknown keyword */
+    else {
+        return "doesn't known the keyword";
+    }
+
+FILE *toto = fopen("/tmp/haha", "a");
+fprintf(toto, "   set %p mode (%d->%d)\n", conf, conf->mode_def, conf->mode);
+fclose(toto);
+
+    return NGX_CONF_OK;
+}
+
+/*
+ *
+ * Set "uniqueid_hdr_nam" value
+ *
+ */
+static char *
+ngx_http_uniqueid_set_hdr_nam(ngx_conf_t *cf, ngx_command_t *cmd, void *_conf)
+{
+    ngx_http_uniqueid_conf_t *conf = _conf;
+    ngx_str_t                *value = cf->args->elts;
+    ngx_str_t                *header = &value[1];
+    ngx_str_t                *hdr_nam;
+
+    /* allocate memory for the new string */
+
+    hdr_nam = ngx_pcalloc(cf->pool, sizeof(ngx_str_t));
+    if (hdr_nam == NULL) {
+        return NGX_CONF_ERROR;
+    }
+
+    hdr_nam->data = ngx_pcalloc(cf->pool, header->len + 1);
+    if (hdr_nam->data == NULL) {
+        return NGX_CONF_ERROR;
+    }
+
+    /* copy the header name and length */
+
+    ngx_memcpy(hdr_nam->data, header->data, header->len + 1);
+	 hdr_nam->len = header->len;
+
+    conf->hdr_nam = hdr_nam;
+    conf->hdr_nam_def = 0;
+
+    return NGX_CONF_OK;
+}
+
+/*
+ *
+ * Build unique id variable
+ *
+ */
+static ngx_int_t
+ngx_http_variable_uniqueid(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data)
+{
+    struct timeval tv;
+    u_char *uniqueid;
+    size_t len;
+    struct sockaddr_in *src;
+    struct sockaddr_in  dst;
+    uint32_t src_ip;
+    uint16_t src_port;
+    uint32_t dst_ip;
+    uint16_t dst_port;
+    uint32_t counter;
+
+    /*
+     * get memory
+     */
+    uniqueid = ngx_palloc(r->pool, ngx_http_uniqueid_fulllen);
+    if (uniqueid == NULL) {
+        return NGX_ERROR;
+    }
+
+    /*
+     * This is running only if socket is AF_INET
+     */
+    if (r->connection->sockaddr->sa_family == AF_INET) {
+
+        /* Get source sockaddr_in */
+        src = (struct sockaddr_in *)r->connection->sockaddr;
+
+        /* Remote address */
+        src_ip = ntohl(src->sin_addr.s_addr);
+   
+        /* Remote port */
+        src_port = ntohs(src->sin_port);
+
+        /* Get destination sockaddr_in */
+        len = sizeof(struct sockaddr_in);
+        if (getsockname(r->connection->fd, (struct sockaddr *)&dst, &len) == -1) {
+            return NGX_ERROR;
+        }
+
+        /* Local address */
+        dst_ip = ntohl(dst.sin_addr.s_addr);
+
+        /* Local port */
+        dst_port = ntohs(dst.sin_port);
+    }
+
+    /*
+     * Is not AF_INET
+     */
+    else {
+        src_ip = 0;
+        src_port = 0;
+        dst_ip = 0;
+        dst_port = 0;
+    }
+
+    /* 
+     * retrieve date 
+     */
+    ngx_gettimeofday(&tv);
+
+    /*
+     * update counter
+     */
+#if (NGX_THREADS)
+    ngx_mutex_lock(ngx_http_uniqueid_counter_lock);
+#endif
+
+    /* If the current second doesn't change, just increase the counter */
+    if (ngx_http_uniqueid_timestamp == tv.tv_sec) {
+        ngx_http_uniqueid_counter++;
+    }
+
+    /* else, reset the counter and update the current second */
+    else {
+        ngx_http_uniqueid_timestamp = tv.tv_sec;
+        ngx_http_uniqueid_counter = 0;
+    }
+
+    counter = ngx_http_uniqueid_counter;
+
+#if (NGX_THREADS)
+    ngx_mutex_unlock(ngx_http_uniqueid_counter_lock);
+#endif
+
+    /*
+     * Build uniqueid value
+     *
+     *   SIP:SPORT_DIP:DPORT_TSTAMP_PID:COUNT_HOSTNAME
+     *
+     *   SIP:      Source IP in hexadecimal format        [32 bits]
+     *   SPORT:    Source port in hexadecimal format      [16 bits]
+     *   DIP:      Destination IP in hexadecimal format   [32 bits]
+     *   DPORT:    Destination port in hexadecimal format [16 bits]
+     *   TSTAMP:   Unix timestamp in hexadecimal format   [32 bits]
+     *   PID:      Application PID in hexadecimal format  [32 bits]
+     *             OS like AIX or Tru64 have 32 bits pid.
+     *   COUNT:    Request counter for each second.       [32 bits]
+     *   HOSTNAME: Host name
+     *
+     */
+    len = snprintf((char *)uniqueid, ngx_http_uniqueid_fulllen,
+                   "%08X:%04X_%08X:%04X_%08X_%*s:%08X_%*s",
+                   src_ip,
+                   src_port,
+                   dst_ip,
+                   dst_port,
+                   (uint32_t)tv.tv_sec,
+                   ngx_http_uniqueid_pid.len, ngx_http_uniqueid_pid.data,
+                   counter,
+                   ngx_http_uniqueid_hostname.len, ngx_http_uniqueid_hostname.data
+                  );
+    if (len >= ngx_http_uniqueid_fulllen) {
+        uniqueid[ngx_http_uniqueid_fulllen-1] = 0;
+        len = ngx_http_uniqueid_fulllen - 1;
+    }
+
+    v->len = len;
+    v->data = uniqueid;
+    v->valid = 1;
+    v->no_cacheable = 0;
+    v->not_found = 0;
+
+    return NGX_OK;
+}
+
+static inline ngx_table_elt_t *
+ngx_http_uniqueid_search_header(ngx_list_t *header_list, ngx_str_t *header_name)
+{
+    ngx_list_part_t *part;
+    ngx_table_elt_t *data;
+    unsigned int i;
+
+    part = &header_list->part;
+    data = part->elts;
+
+    for (i = 0 ;; i++) {
+
+        if (i >= part->nelts) {
+            if (part->next == NULL) {
+                break;
+            }
+
+            part = part->next;
+            data = part->elts;
+            i = 0;
+        }
+
+        if (ngx_strcasecmp(data[i].key.data, header_name->data) == 0)
+            return &data[i];
+    }
+
+    return NULL;
+}
+
+static ngx_int_t ngx_http_uniqueid_handler(ngx_http_request_t *r)
+{
+    ngx_http_variable_value_t *uniqueid;
+    ngx_http_uniqueid_conf_t *conf;
+    ngx_table_elt_t *h = NULL;
+
+    /* retrieve configuration */
+    conf = ngx_http_get_module_loc_conf(r, ngx_http_uniqueid_module);
+
+    /* do nothing */
+    if (conf->mode == NGX_HTTP_UNIQUEID_MODE_OFF) {
+        return NGX_OK;
+    }
+
+    /* retrieve uniqueid value 
+     * use the variable system for taking advantage of the cache.
+     * With the variable cache, the unique id is computed once
+     */
+    uniqueid = ngx_http_get_indexed_variable(r, ngx_http_uniqueid_varindex);
+
+    /* With theses two mode, can search configured header in
+     * the request and replace it if found
+     */
+    if (conf->mode == NGX_HTTP_UNIQUEID_MODE_REPLACE ||
+        conf->mode == NGX_HTTP_UNIQUEID_MODE_FORCE) {
+
+        h = ngx_http_uniqueid_search_header(&r->headers_in.headers, conf->hdr_nam);
+
+        /* replace header */
+        if (h != NULL) {
+            h->value.len  = uniqueid->len;
+            h->value.data = uniqueid->data;
+            return NGX_OK;
+        }
+
+    }
+
+    /* in other case (NGX_HTTP_UNIQUEID_MODE_ADD or 
+     * NGX_HTTP_UNIQUEID_MODE_FORCE + header not found)
+     * build and insert new header in request
+     */
+
+    /* add header */
+    h = ngx_list_push(&r->headers_in.headers);
+    if (h == NULL) {
+        return NGX_ERROR;
+    }
+
+    /* set header name */
+    h->key.len  = conf->hdr_nam->len;
+    h->key.data = conf->hdr_nam->data;
+
+    /* add value */
+    h->value.len  = uniqueid->len;
+    h->value.data = uniqueid->data;
+
+    return NGX_OK;
+}

