comparison src/http/modules/ngx_http_ssi_filter_module.c @ 206:3866d57d9cfd NGINX_0_3_50

nginx 0.3.50 *) Change: the "proxy_redirect_errors" and "fastcgi_redirect_errors" directives was renamed to the "proxy_intercept_errors" and "fastcgi_intercept_errors" directives. *) Feature: the ngx_http_charset_module supports the recoding from the single byte encodings to the UTF-8 encoding and back. *) Feature: the "X-Accel-Charset" response header line is supported in proxy and FastCGI mode. *) Bugfix: the "\" escape symbol in the "\"" and "\'" pairs in the SSI command was removed only if the command also has the "$" symbol. *) Bugfix: the "<!--" string might be added on some conditions in the SSI after inclusion. *) Bugfix: if the "Content-Length: 0" header line was in response, then in nonbuffered proxying mode the client connection was not closed.
author Igor Sysoev <http://sysoev.ru>
date Wed, 28 Jun 2006 00:00:00 +0400
parents d2ae1c9f1fd3
children b12b3b1a9426
comparison
equal deleted inserted replaced
205:e53bd15c244a 206:3866d57d9cfd
786 ctx->out = NULL; 786 ctx->out = NULL;
787 ctx->last_out = &ctx->out; 787 ctx->last_out = &ctx->out;
788 788
789 while (ctx->busy) { 789 while (ctx->busy) {
790 790
791 b = ctx->busy->buf; 791 cl = ctx->busy;
792 b = cl->buf;
792 793
793 if (ngx_buf_size(b) != 0) { 794 if (ngx_buf_size(b) != 0) {
794 break; 795 break;
795 } 796 }
796 797
802 803
803 if (b->shadow) { 804 if (b->shadow) {
804 b->shadow->pos = b->shadow->last; 805 b->shadow->pos = b->shadow->last;
805 } 806 }
806 807
807 cl = ctx->busy;
808 ctx->busy = cl->next; 808 ctx->busy = cl->next;
809 809
810 if (ngx_buf_in_memory(b) || b->in_file) { 810 if (ngx_buf_in_memory(b) || b->in_file) {
811 /* add data bufs only to the free buf chain */ 811 /* add data bufs only to the free buf chain */
812 812
940 break; 940 break;
941 941
942 case ssi_sharp_state: 942 case ssi_sharp_state:
943 switch (ch) { 943 switch (ch) {
944 case '#': 944 case '#':
945 if (ctx->copy_start) { 945 ctx->saved = 0;
946 ctx->saved = 0;
947 }
948 looked = 0; 946 looked = 0;
949 state = ssi_precommand_state; 947 state = ssi_precommand_state;
950 break; 948 break;
951 949
952 case '<': 950 case '<':
1415 1413
1416 n = ngx_http_script_variables_count(text); 1414 n = ngx_http_script_variables_count(text);
1417 1415
1418 if (n == 0) { 1416 if (n == 0) {
1419 1417
1420 if (!(flags & NGX_HTTP_SSI_ADD_PREFIX)) { 1418 data = text->data;
1421 return NGX_OK; 1419 p = data;
1422 } 1420
1423 1421 if ((flags & NGX_HTTP_SSI_ADD_PREFIX) && text->data[0] != '/') {
1424 if (text->data[0] != '/') { 1422
1425 for (prefix = r->uri.len; prefix; prefix--) { 1423 for (prefix = r->uri.len; prefix; prefix--) {
1426 if (r->uri.data[prefix - 1] == '/') { 1424 if (r->uri.data[prefix - 1] == '/') {
1427 break; 1425 break;
1428 } 1426 }
1429 } 1427 }
1435 if (data == NULL) { 1433 if (data == NULL) {
1436 return NGX_ERROR; 1434 return NGX_ERROR;
1437 } 1435 }
1438 1436
1439 p = ngx_copy(data, r->uri.data, prefix); 1437 p = ngx_copy(data, r->uri.data, prefix);
1440 ngx_memcpy(p, text->data, text->len); 1438 }
1441 1439 }
1442 text->len = len; 1440
1443 text->data = data; 1441 quoted = 0;
1444 } 1442
1445 } 1443 for (i = 0 ; i < text->len; i++) {
1444 ch = text->data[i];
1445
1446 if (!quoted) {
1447
1448 if (ch == '\\') {
1449 quoted = 1;
1450 continue;
1451 }
1452
1453 } else {
1454 quoted = 0;
1455
1456 if (ch != '\\' && ch != '\'' && ch != '"' && ch != '$') {
1457 *p++ = '\\';
1458 }
1459 }
1460
1461 *p++ = ch;
1462 }
1463
1464 text->len = p - data;
1465 text->data = data;
1446 1466
1447 return NGX_OK; 1467 return NGX_OK;
1448 } 1468 }
1449 1469
1450 if (ngx_array_init(&lengths, r->pool, 8, sizeof(size_t *)) != NGX_OK) { 1470 if (ngx_array_init(&lengths, r->pool, 8, sizeof(size_t *)) != NGX_OK) {
2138 return NGX_ERROR; 2158 return NGX_ERROR;
2139 } 2159 }
2140 2160
2141 v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff)) 2161 v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff))
2142 - v->data; 2162 - v->data;
2163
2143 return NGX_OK; 2164 return NGX_OK;
2144 } 2165 }
2145 2166
2146 if (gmt) { 2167 if (gmt) {
2147 ngx_libc_gmtime(tp->sec, &tm); 2168 ngx_libc_gmtime(tp->sec, &tm);