comparison src/http/modules/ngx_http_ssi_filter_module.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 bc21d9cd9c54
children 1172e6d6f40f
comparison
equal deleted inserted replaced
381:23d1555141d9 382:984bb0b1399b
1149 case '\t': 1149 case '\t':
1150 break; 1150 break;
1151 1151
1152 default: 1152 default:
1153 ctx->command.len = 1; 1153 ctx->command.len = 1;
1154 ctx->command.data = ngx_palloc(r->pool, 1154 ctx->command.data = ngx_pnalloc(r->pool,
1155 NGX_HTTP_SSI_COMMAND_LEN); 1155 NGX_HTTP_SSI_COMMAND_LEN);
1156 if (ctx->command.data == NULL) { 1156 if (ctx->command.data == NULL) {
1157 return NGX_ERROR; 1157 return NGX_ERROR;
1158 } 1158 }
1159 1159
1160 ctx->command.data[0] = ch; 1160 ctx->command.data[0] = ch;
1216 if (ctx->param == NULL) { 1216 if (ctx->param == NULL) {
1217 return NGX_ERROR; 1217 return NGX_ERROR;
1218 } 1218 }
1219 1219
1220 ctx->param->key.len = 1; 1220 ctx->param->key.len = 1;
1221 ctx->param->key.data = ngx_palloc(r->pool, 1221 ctx->param->key.data = ngx_pnalloc(r->pool,
1222 NGX_HTTP_SSI_PARAM_LEN); 1222 NGX_HTTP_SSI_PARAM_LEN);
1223 if (ctx->param->key.data == NULL) { 1223 if (ctx->param->key.data == NULL) {
1224 return NGX_ERROR; 1224 return NGX_ERROR;
1225 } 1225 }
1226 1226
1227 ctx->param->key.data[0] = ch; 1227 ctx->param->key.data[0] = ch;
1228 1228
1229 ctx->param->value.len = 0; 1229 ctx->param->value.len = 0;
1230 1230
1231 if (ctx->value_buf == NULL) { 1231 if (ctx->value_buf == NULL) {
1232 ctx->param->value.data = ngx_palloc(r->pool, 1232 ctx->param->value.data = ngx_pnalloc(r->pool,
1233 ctx->value_len); 1233 ctx->value_len);
1234 if (ctx->param->value.data == NULL) { 1234 if (ctx->param->value.data == NULL) {
1235 return NGX_ERROR; 1235 return NGX_ERROR;
1236 } 1236 }
1237 1237
1238 } else { 1238 } else {
1406 break; 1406 break;
1407 1407
1408 case ssi_postparam_state: 1408 case ssi_postparam_state:
1409 1409
1410 if (ctx->param->value.len + 1 < ctx->value_len / 2) { 1410 if (ctx->param->value.len + 1 < ctx->value_len / 2) {
1411 value = ngx_palloc(r->pool, ctx->param->value.len + 1); 1411 value = ngx_pnalloc(r->pool, ctx->param->value.len + 1);
1412 if (value == NULL) { 1412 if (value == NULL) {
1413 return NGX_ERROR; 1413 return NGX_ERROR;
1414 } 1414 }
1415 1415
1416 ngx_memcpy(value, ctx->param->value.data, 1416 ngx_memcpy(value, ctx->param->value.data,
1624 } 1624 }
1625 1625
1626 if (prefix) { 1626 if (prefix) {
1627 len = prefix + text->len; 1627 len = prefix + text->len;
1628 1628
1629 data = ngx_palloc(r->pool, len); 1629 data = ngx_pnalloc(r->pool, len);
1630 if (data == NULL) { 1630 if (data == NULL) {
1631 return NGX_ERROR; 1631 return NGX_ERROR;
1632 } 1632 }
1633 1633
1634 p = ngx_copy(data, r->uri.data, prefix); 1634 p = ngx_copy(data, r->uri.data, prefix);
1827 break; 1827 break;
1828 } 1828 }
1829 } 1829 }
1830 } 1830 }
1831 1831
1832 p = ngx_palloc(r->pool, len + ((flags & NGX_HTTP_SSI_ADD_ZERO) ? 1 : 0)); 1832 p = ngx_pnalloc(r->pool, len + ((flags & NGX_HTTP_SSI_ADD_ZERO) ? 1 : 0));
1833 if (p == NULL) { 1833 if (p == NULL) {
1834 return NGX_ERROR; 1834 return NGX_ERROR;
1835 } 1835 }
1836 1836
1837 text->len = len; 1837 text->len = len;
2220 case NGX_HTTP_SSI_URL_ENCODING: 2220 case NGX_HTTP_SSI_URL_ENCODING:
2221 len = 2 * ngx_escape_uri(NULL, value->data, value->len, 2221 len = 2 * ngx_escape_uri(NULL, value->data, value->len,
2222 NGX_ESCAPE_HTML); 2222 NGX_ESCAPE_HTML);
2223 2223
2224 if (len) { 2224 if (len) {
2225 p = ngx_palloc(r->pool, value->len + len); 2225 p = ngx_pnalloc(r->pool, value->len + len);
2226 if (p == NULL) { 2226 if (p == NULL) {
2227 return NGX_HTTP_SSI_ERROR; 2227 return NGX_HTTP_SSI_ERROR;
2228 } 2228 }
2229 2229
2230 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML); 2230 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
2237 2237
2238 case NGX_HTTP_SSI_ENTITY_ENCODING: 2238 case NGX_HTTP_SSI_ENTITY_ENCODING:
2239 len = ngx_escape_html(NULL, value->data, value->len); 2239 len = ngx_escape_html(NULL, value->data, value->len);
2240 2240
2241 if (len) { 2241 if (len) {
2242 p = ngx_palloc(r->pool, value->len + len); 2242 p = ngx_pnalloc(r->pool, value->len + len);
2243 if (p == NULL) { 2243 if (p == NULL) {
2244 return NGX_HTTP_SSI_ERROR; 2244 return NGX_HTTP_SSI_ERROR;
2245 } 2245 }
2246 2246
2247 (void) ngx_escape_html(p, value->data, value->len); 2247 (void) ngx_escape_html(p, value->data, value->len);
2284 2284
2285 value = params[NGX_HTTP_SSI_CONFIG_TIMEFMT]; 2285 value = params[NGX_HTTP_SSI_CONFIG_TIMEFMT];
2286 2286
2287 if (value) { 2287 if (value) {
2288 ctx->timefmt.len = value->len; 2288 ctx->timefmt.len = value->len;
2289 ctx->timefmt.data = ngx_palloc(r->pool, value->len + 1); 2289 ctx->timefmt.data = ngx_pnalloc(r->pool, value->len + 1);
2290 if (ctx->timefmt.data == NULL) { 2290 if (ctx->timefmt.data == NULL) {
2291 return NGX_HTTP_SSI_ERROR; 2291 return NGX_HTTP_SSI_ERROR;
2292 } 2292 }
2293 2293
2294 ngx_cpystrn(ctx->timefmt.data, value->data, value->len + 1); 2294 ngx_cpystrn(ctx->timefmt.data, value->data, value->len + 1);
2664 2664
2665 if (ctx == NULL 2665 if (ctx == NULL
2666 || (ctx->timefmt.len == sizeof("%s") - 1 2666 || (ctx->timefmt.len == sizeof("%s") - 1
2667 && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's')) 2667 && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's'))
2668 { 2668 {
2669 v->data = ngx_palloc(r->pool, NGX_TIME_T_LEN); 2669 v->data = ngx_pnalloc(r->pool, NGX_TIME_T_LEN);
2670 if (v->data == NULL) { 2670 if (v->data == NULL) {
2671 return NGX_ERROR; 2671 return NGX_ERROR;
2672 } 2672 }
2673 2673
2674 v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff)) 2674 v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff))
2687 (char *) ctx->timefmt.data, &tm); 2687 (char *) ctx->timefmt.data, &tm);
2688 if (v->len == 0) { 2688 if (v->len == 0) {
2689 return NGX_ERROR; 2689 return NGX_ERROR;
2690 } 2690 }
2691 2691
2692 v->data = ngx_palloc(r->pool, v->len); 2692 v->data = ngx_pnalloc(r->pool, v->len);
2693 if (v->data == NULL) { 2693 if (v->data == NULL) {
2694 return NGX_ERROR; 2694 return NGX_ERROR;
2695 } 2695 }
2696 2696
2697 ngx_memcpy(v->data, buf, v->len); 2697 ngx_memcpy(v->data, buf, v->len);
2736 return NGX_CONF_ERROR; 2736 return NGX_CONF_ERROR;
2737 } 2737 }
2738 2738
2739 type->len = value[i].len; 2739 type->len = value[i].len;
2740 2740
2741 type->data = ngx_palloc(cf->pool, type->len + 1); 2741 type->data = ngx_pnalloc(cf->pool, type->len + 1);
2742 if (type->data == NULL) { 2742 if (type->data == NULL) {
2743 return NGX_CONF_ERROR; 2743 return NGX_CONF_ERROR;
2744 } 2744 }
2745 2745
2746 ngx_cpystrn(type->data, value[i].data, type->len + 1); 2746 ngx_cpystrn(type->data, value[i].data, type->len + 1);