Mercurial > hg > nginx-vendor-0-8
comparison src/http/modules/ngx_http_ssi_filter_module.c @ 108:cf3d6edb3ad6 NGINX_0_3_1
nginx 0.3.1
*) Bugfix: the segmentation fault occurred when the signal queue
overflowed if the "rtsig" method was used; bug appeared in 0.2.0.
*) Change: correct handling of the "\\", "\"", "\'", and "\$" pairs in
SSI.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 10 Oct 2005 00:00:00 +0400 |
parents | f63280c59dd5 |
children | 408f195b3482 |
comparison
equal
deleted
inserted
replaced
107:495d867e35e8 | 108:cf3d6edb3ad6 |
---|---|
1128 | 1128 |
1129 break; | 1129 break; |
1130 | 1130 |
1131 case ssi_double_quoted_value_state: | 1131 case ssi_double_quoted_value_state: |
1132 switch (ch) { | 1132 switch (ch) { |
1133 case '"': | |
1134 state = ssi_postparam_state; | |
1135 break; | |
1136 | |
1133 case '\\': | 1137 case '\\': |
1134 ctx->saved_state = ssi_double_quoted_value_state; | 1138 ctx->saved_state = ssi_double_quoted_value_state; |
1135 state = ssi_quoted_symbol_state; | 1139 state = ssi_quoted_symbol_state; |
1136 break; | 1140 |
1137 | 1141 /* fall through */ |
1138 case '"': | |
1139 state = ssi_postparam_state; | |
1140 break; | |
1141 | 1142 |
1142 default: | 1143 default: |
1143 ctx->param->value.data[ctx->param->value.len++] = ch; | 1144 ctx->param->value.data[ctx->param->value.len++] = ch; |
1144 | 1145 |
1145 if (ctx->param->value.len == ctx->value_len) { | 1146 if (ctx->param->value.len == ctx->value_len) { |
1155 | 1156 |
1156 break; | 1157 break; |
1157 | 1158 |
1158 case ssi_quoted_value_state: | 1159 case ssi_quoted_value_state: |
1159 switch (ch) { | 1160 switch (ch) { |
1161 case '\'': | |
1162 state = ssi_postparam_state; | |
1163 break; | |
1164 | |
1160 case '\\': | 1165 case '\\': |
1161 ctx->saved_state = ssi_quoted_value_state; | 1166 ctx->saved_state = ssi_quoted_value_state; |
1162 state = ssi_quoted_symbol_state; | 1167 state = ssi_quoted_symbol_state; |
1163 break; | 1168 |
1164 | 1169 /* fall through */ |
1165 case '\'': | |
1166 state = ssi_postparam_state; | |
1167 break; | |
1168 | 1170 |
1169 default: | 1171 default: |
1170 ctx->param->value.data[ctx->param->value.len++] = ch; | 1172 ctx->param->value.data[ctx->param->value.len++] = ch; |
1171 | 1173 |
1172 if (ctx->param->value.len == ctx->value_len) { | 1174 if (ctx->param->value.len == ctx->value_len) { |
1181 } | 1183 } |
1182 | 1184 |
1183 break; | 1185 break; |
1184 | 1186 |
1185 case ssi_quoted_symbol_state: | 1187 case ssi_quoted_symbol_state: |
1188 state = ctx->saved_state; | |
1189 | |
1190 if (ch == '\\') { | |
1191 break; | |
1192 } | |
1193 | |
1194 if (ch == '"' && state == ssi_double_quoted_value_state) { | |
1195 break; | |
1196 } | |
1197 | |
1198 if (ch == '\'' && state == ssi_quoted_value_state) { | |
1199 break; | |
1200 } | |
1201 | |
1186 ctx->param->value.data[ctx->param->value.len++] = ch; | 1202 ctx->param->value.data[ctx->param->value.len++] = ch; |
1187 | 1203 |
1188 if (ctx->param->value.len == ctx->value_len) { | 1204 if (ctx->param->value.len == ctx->value_len) { |
1189 if (ctx->param->value.len == ctx->value_len) { | 1205 if (ctx->param->value.len == ctx->value_len) { |
1190 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 1206 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1195 state = ssi_error_state; | 1211 state = ssi_error_state; |
1196 break; | 1212 break; |
1197 } | 1213 } |
1198 } | 1214 } |
1199 | 1215 |
1200 state = ctx->saved_state; | |
1201 break; | 1216 break; |
1202 | 1217 |
1203 case ssi_postparam_state: | 1218 case ssi_postparam_state: |
1204 switch (ch) { | 1219 switch (ch) { |
1205 case ' ': | 1220 case ' ': |
1484 } else { | 1499 } else { |
1485 part = *val; | 1500 part = *val; |
1486 } | 1501 } |
1487 | 1502 |
1488 } else { | 1503 } else { |
1489 part.len = 0; | |
1490 part.data = &text->data[i]; | 1504 part.data = &text->data[i]; |
1491 | 1505 |
1492 while (i < text->len && text->data[i] != '$') { | 1506 for (p = part.data; i < text->len; i++) { |
1493 i++; | 1507 ch = text->data[i]; |
1494 part.len++; | 1508 |
1495 } | 1509 if (ch == '$') { |
1510 if (text->data[i - 1] != '\\') { | |
1511 break; | |
1512 } | |
1513 | |
1514 *(p - 1) = ch; | |
1515 | |
1516 continue; | |
1517 } | |
1518 | |
1519 *p++ = ch; | |
1520 } | |
1521 | |
1522 part.len = p - part.data; | |
1496 } | 1523 } |
1497 | 1524 |
1498 len += part.len; | 1525 len += part.len; |
1499 | 1526 |
1500 size = ngx_array_push(&lengths); | 1527 size = ngx_array_push(&lengths); |