Permalink
Browse files

checked in the variable_header_ignore_no_hash patch.

  • Loading branch information...
1 parent 5136657 commit ee9cf6c407f9e0aebc75c6b08d781dc6fa2f6657 @agentzh agentzh committed Sep 30, 2011
@@ -0,0 +1,69 @@
+--- nginx-1.0.6/src/http/ngx_http_variables.c 2011-05-30 05:36:17.000000000 -0700
++++ nginx-1.0.6-patched/src/http/ngx_http_variables.c 2011-09-30 10:59:05.000000000 -0700
+@@ -648,7 +648,17 @@
+
+ a = (ngx_array_t *) ((char *) r + data);
+
+- n = a->nelts;
++ h = a->elts;
++ n = 0;
++
++ for (i = 0; i < a->nelts; i++) {
++
++ if (h[i]->hash == 0) {
++ continue;
++ }
++
++ n++;
++ }
+
+ if (n == 0) {
+ v->not_found = 1;
+@@ -659,9 +669,7 @@
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+- h = a->elts;
+-
+- if (n == 1) {
++ if (n == 1 && a->nelts == 1) {
+ v->len = (*h)->value.len;
+ v->data = (*h)->value.data;
+
+@@ -670,7 +678,12 @@
+
+ len = - (ssize_t) (sizeof("; ") - 1);
+
+- for (i = 0; i < n; i++) {
++ for (i = 0; i < a->nelts; i++) {
++
++ if (h[i]->hash == 0) {
++ continue;
++ }
++
+ len += h[i]->value.len + sizeof("; ") - 1;
+ }
+
+@@ -683,6 +696,11 @@
+ v->data = p;
+
+ for (i = 0; /* void */ ; i++) {
++
++ if (h[i]->hash == 0) {
++ continue;
++ }
++
+ p = ngx_copy(p, h[i]->value.data, h[i]->value.len);
+
+ if (i == n - 1) {
+@@ -738,6 +756,10 @@
+ i = 0;
+ }
+
++ if (header[i].hash == 0) {
++ continue;
++ }
++
+ for (n = 0; n + prefix < var->len && n < header[i].key.len; n++) {
+ ch = header[i].key.data[n];
+
@@ -0,0 +1,69 @@
+--- nginx-1.1.4/src/http/ngx_http_variables.c 2011-05-30 05:36:17.000000000 -0700
++++ nginx-1.1.4-patched/src/http/ngx_http_variables.c 2011-09-30 10:59:05.000000000 -0700
+@@ -648,7 +648,17 @@
+
+ a = (ngx_array_t *) ((char *) r + data);
+
+- n = a->nelts;
++ h = a->elts;
++ n = 0;
++
++ for (i = 0; i < a->nelts; i++) {
++
++ if (h[i]->hash == 0) {
++ continue;
++ }
++
++ n++;
++ }
+
+ if (n == 0) {
+ v->not_found = 1;
+@@ -659,9 +669,7 @@
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+- h = a->elts;
+-
+- if (n == 1) {
++ if (n == 1 && a->nelts == 1) {
+ v->len = (*h)->value.len;
+ v->data = (*h)->value.data;
+
+@@ -670,7 +678,12 @@
+
+ len = - (ssize_t) (sizeof("; ") - 1);
+
+- for (i = 0; i < n; i++) {
++ for (i = 0; i < a->nelts; i++) {
++
++ if (h[i]->hash == 0) {
++ continue;
++ }
++
+ len += h[i]->value.len + sizeof("; ") - 1;
+ }
+
+@@ -683,6 +696,11 @@
+ v->data = p;
+
+ for (i = 0; /* void */ ; i++) {
++
++ if (h[i]->hash == 0) {
++ continue;
++ }
++
+ p = ngx_copy(p, h[i]->value.data, h[i]->value.len);
+
+ if (i == n - 1) {
+@@ -738,6 +756,10 @@
+ i = 0;
+ }
+
++ if (header[i].hash == 0) {
++ continue;
++ }
++
+ for (n = 0; n + prefix < var->len && n < header[i].key.len; n++) {
+ ch = header[i].key.data[n];
+

0 comments on commit ee9cf6c

Please sign in to comment.