comparison src/http/ngx_http_parse.c @ 472:09f0ef15d544 NGINX_0_7_48

nginx 0.7.48 *) Feature: the "proxy_cache_key" directive. *) Bugfix: now nginx takes into account the "X-Accel-Expires", "Expires", and "Cache-Control" header lines in a backend response. *) Bugfix: now nginx caches responses for the GET requests only. *) Bugfix: the "fastcgi_cache_key" directive was not inherited. *) Bugfix: the $arg_... variables did not work with SSI subrequests. Thanks to Maxim Dounin. *) Bugfix: nginx could not be built with uclibc library. Thanks to Timothy Redaelli. *) Bugfix: nginx could not be built on OpenBSD; the bug had appeared in 0.7.46.
author Igor Sysoev <http://sysoev.ru>
date Mon, 06 Apr 2009 00:00:00 +0400
parents 6866b490272e
children 392c16f2d858
comparison
equal deleted inserted replaced
471:0cc33540f2e0 472:09f0ef15d544
1484 1484
1485 1485
1486 ngx_int_t 1486 ngx_int_t
1487 ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value) 1487 ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
1488 { 1488 {
1489 u_char *p; 1489 u_char *p, *last;
1490 1490
1491 if (r->args.len == 0) { 1491 if (r->args.len == 0) {
1492 return NGX_DECLINED; 1492 return NGX_DECLINED;
1493 } 1493 }
1494 1494
1495 for (p = r->args.data; *p && *p != ' '; p++) { 1495 p = r->args.data;
1496 1496 last = p + r->args.len;
1497 /* 1497
1498 * although r->args.data is not null-terminated by itself, 1498 for ( /* void */ ; p < last; p++) {
1499 * however, there is null in the end of request line 1499
1500 */ 1500 /* we need '=' after name, so drop one char from last */
1501 1501
1502 p = ngx_strcasestrn(p, (char *) name, len - 1); 1502 p = ngx_strlcasestrn(p, last - 1, name, len - 1);
1503 1503
1504 if (p == NULL) { 1504 if (p == NULL) {
1505 return NGX_DECLINED; 1505 return NGX_DECLINED;
1506 } 1506 }
1507 1507
1508 if ((p == r->args.data || *(p - 1) == '&') && *(p + len) == '=') { 1508 if ((p == r->args.data || *(p - 1) == '&') && *(p + len) == '=') {
1509 1509
1510 value->data = p + len + 1; 1510 value->data = p + len + 1;
1511 1511
1512 p = (u_char *) ngx_strchr(p, '&'); 1512 p = ngx_strlchr(p, last, '&');
1513 1513
1514 if (p == NULL) { 1514 if (p == NULL) {
1515 p = r->args.data + r->args.len; 1515 p = r->args.data + r->args.len;
1516 } 1516 }
1517 1517