comparison src/http/ngx_http_variables.c @ 382:984bb0b1399b NGINX_0_7_3

nginx 0.7.3 *) Change: the "rss" extension MIME type has been changed to "application/rss+xml". *) Change: now the "gzip_vary" directive turned on issues a "Vary: Accept-Encoding" header line for uncompressed responses too. *) Feature: now the "rewrite" directive does a redirect automatically if the "https://" protocol is used. *) Bugfix: the "proxy_pass" directive did not work with the HTTPS protocol; the bug had appeared in 0.6.9.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Jun 2008 00:00:00 +0400
parents edf1cb6c328e
children 34fb3a573548
comparison
equal deleted inserted replaced
381:23d1555141d9 382:984bb0b1399b
270 if (v == NULL) { 270 if (v == NULL) {
271 return NULL; 271 return NULL;
272 } 272 }
273 273
274 v->name.len = name->len; 274 v->name.len = name->len;
275 v->name.data = ngx_palloc(cf->pool, name->len); 275 v->name.data = ngx_pnalloc(cf->pool, name->len);
276 if (v->name.data == NULL) { 276 if (v->name.data == NULL) {
277 return NULL; 277 return NULL;
278 } 278 }
279 279
280 for (i = 0; i < name->len; i++) { 280 for (i = 0; i < name->len; i++) {
337 if (v == NULL) { 337 if (v == NULL) {
338 return NGX_ERROR; 338 return NGX_ERROR;
339 } 339 }
340 340
341 v->name.len = name->len; 341 v->name.len = name->len;
342 v->name.data = ngx_palloc(cf->pool, name->len); 342 v->name.data = ngx_pnalloc(cf->pool, name->len);
343 if (v->name.data == NULL) { 343 if (v->name.data == NULL) {
344 return NGX_ERROR; 344 return NGX_ERROR;
345 } 345 }
346 346
347 for (i = 0; i < name->len; i++) { 347 for (i = 0; i < name->len; i++) {
613 613
614 for (i = 0; i < n; i++) { 614 for (i = 0; i < n; i++) {
615 len += h[i]->value.len + sizeof("; ") - 1; 615 len += h[i]->value.len + sizeof("; ") - 1;
616 } 616 }
617 617
618 p = ngx_palloc(r->pool, len); 618 p = ngx_pnalloc(r->pool, len);
619 if (p == NULL) { 619 if (p == NULL) {
620 return NGX_ERROR; 620 return NGX_ERROR;
621 } 621 }
622 622
623 v->len = len; 623 v->len = len;
780 v->len = 0; 780 v->len = 0;
781 v->valid = 1; 781 v->valid = 1;
782 v->no_cacheable = 0; 782 v->no_cacheable = 0;
783 v->not_found = 0; 783 v->not_found = 0;
784 784
785 v->data = ngx_palloc(r->pool, sizeof("65535") - 1); 785 v->data = ngx_pnalloc(r->pool, sizeof("65535") - 1);
786 if (v->data == NULL) { 786 if (v->data == NULL) {
787 return NGX_ERROR; 787 return NGX_ERROR;
788 } 788 }
789 789
790 /* AF_INET only */ 790 /* AF_INET only */
807 ngx_http_variable_server_addr(ngx_http_request_t *r, 807 ngx_http_variable_server_addr(ngx_http_request_t *r,
808 ngx_http_variable_value_t *v, uintptr_t data) 808 ngx_http_variable_value_t *v, uintptr_t data)
809 { 809 {
810 ngx_str_t s; 810 ngx_str_t s;
811 811
812 s.data = ngx_palloc(r->pool, INET_ADDRSTRLEN); 812 s.data = ngx_pnalloc(r->pool, INET_ADDRSTRLEN);
813 if (s.data == NULL) { 813 if (s.data == NULL) {
814 return NGX_ERROR; 814 return NGX_ERROR;
815 } 815 }
816 816
817 if (ngx_http_server_addr(r, &s) != NGX_OK) { 817 if (ngx_http_server_addr(r, &s) != NGX_OK) {
1030 1030
1031 if (sent < 0) { 1031 if (sent < 0) {
1032 sent = 0; 1032 sent = 0;
1033 } 1033 }
1034 1034
1035 p = ngx_palloc(r->pool, NGX_OFF_T_LEN); 1035 p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
1036 if (p == NULL) { 1036 if (p == NULL) {
1037 return NGX_ERROR; 1037 return NGX_ERROR;
1038 } 1038 }
1039 1039
1040 v->len = ngx_sprintf(p, "%O", sent) - p; 1040 v->len = ngx_sprintf(p, "%O", sent) - p;
1081 1081
1082 return NGX_OK; 1082 return NGX_OK;
1083 } 1083 }
1084 1084
1085 if (r->headers_out.content_length_n >= 0) { 1085 if (r->headers_out.content_length_n >= 0) {
1086 p = ngx_palloc(r->pool, NGX_OFF_T_LEN); 1086 p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
1087 if (p == NULL) { 1087 if (p == NULL) {
1088 return NGX_ERROR; 1088 return NGX_ERROR;
1089 } 1089 }
1090 1090
1091 v->len = ngx_sprintf(p, "%O", r->headers_out.content_length_n) - p; 1091 v->len = ngx_sprintf(p, "%O", r->headers_out.content_length_n) - p;
1118 1118
1119 return NGX_OK; 1119 return NGX_OK;
1120 } 1120 }
1121 1121
1122 if (r->headers_out.last_modified_time >= 0) { 1122 if (r->headers_out.last_modified_time >= 0) {
1123 p = ngx_palloc(r->pool, 1123 p = ngx_pnalloc(r->pool,
1124 sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT") - 1); 1124 sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT") - 1);
1125 if (p == NULL) { 1125 if (p == NULL) {
1126 return NGX_ERROR; 1126 return NGX_ERROR;
1127 } 1127 }
1128 1128
1177 if (r->keepalive) { 1177 if (r->keepalive) {
1178 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1178 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1179 1179
1180 if (clcf->keepalive_header) { 1180 if (clcf->keepalive_header) {
1181 1181
1182 p = ngx_palloc(r->pool, sizeof("timeout=") - 1 + NGX_TIME_T_LEN); 1182 p = ngx_pnalloc(r->pool, sizeof("timeout=") - 1 + NGX_TIME_T_LEN);
1183 if (p == NULL) { 1183 if (p == NULL) {
1184 return NGX_ERROR; 1184 return NGX_ERROR;
1185 } 1185 }
1186 1186
1187 v->len = ngx_sprintf(p, "timeout=%T", clcf->keepalive_header) - p; 1187 v->len = ngx_sprintf(p, "timeout=%T", clcf->keepalive_header) - p;