Mercurial > hg > nginx-vendor-0-5
comparison src/http/ngx_http_request.c @ 326:f70f2f565fe0 NGINX_0_5_33
nginx 0.5.33
*) Change: now by default the "echo" SSI command uses entity encoding.
*) Feature: the "encoding" parameter in the "echo" SSI command.
*) Change: mail proxy was split on three modules: pop3, imap and smtp.
*) Feature: the --without-mail_pop3_module, --without-mail_imap_module,
and --without-mail_smtp_module configuration parameters.
*) Feature: the "smtp_greeting_delay" and "smtp_client_buffer"
directives of the ngx_mail_smtp_module.
*) Feature: the "server_name" and "valid_referers" directives support
regular expressions.
*) Feature: the "server_name", "map", and "valid_referers" directives
support the "www.example.*" wildcards.
*) Bugfix: sub_filter did not work with empty substitution.
*) Bugfix: in sub_filter parsing.
*) Bugfix: a worker process may got caught in an endless loop, if the
memcached was used.
*) Bugfix: nginx supported low case only "close" and "keep-alive"
values in the "Connection" request header line; bug appeared in
0.5.32.
*) Bugfix: nginx could not start on Solaris if the shared PCRE library
located in non-standard place was used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 07 Nov 2007 00:00:00 +0300 |
parents | 7cf404023f50 |
children | 26ff8d6b618d |
comparison
equal
deleted
inserted
replaced
325:5bb1b28ddeaa | 326:f70f2f565fe0 |
---|---|
1203 | 1203 |
1204 static ngx_int_t | 1204 static ngx_int_t |
1205 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h, | 1205 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h, |
1206 ngx_uint_t offset) | 1206 ngx_uint_t offset) |
1207 { | 1207 { |
1208 if (ngx_strstr(h->value.data, "close")) { | 1208 if (ngx_strcasestrn(h->value.data, "close", 5 - 1)) { |
1209 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; | 1209 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; |
1210 | 1210 |
1211 } else if (ngx_strstr(h->value.data, "keep-alive")) { | 1211 } else if (ngx_strcasestrn(h->value.data, "keep-alive", 10 - 1)) { |
1212 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; | 1212 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; |
1213 } | 1213 } |
1214 | 1214 |
1215 return NGX_OK; | 1215 return NGX_OK; |
1216 } | 1216 } |
1318 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); | 1318 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); |
1319 return NGX_ERROR; | 1319 return NGX_ERROR; |
1320 } | 1320 } |
1321 | 1321 |
1322 if (r->headers_in.transfer_encoding | 1322 if (r->headers_in.transfer_encoding |
1323 && ngx_strstr(r->headers_in.transfer_encoding->value.data, "chunked")) | 1323 && ngx_strcasestrn(r->headers_in.transfer_encoding->value.data, |
1324 "chunked", 7 - 1)) | |
1324 { | 1325 { |
1325 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 1326 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
1326 "client sent \"Transfer-Encoding: chunked\" header"); | 1327 "client sent \"Transfer-Encoding: chunked\" header"); |
1327 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); | 1328 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); |
1328 return NGX_ERROR; | 1329 return NGX_ERROR; |
1350 * in CPU cache | 1351 * in CPU cache |
1351 */ | 1352 */ |
1352 | 1353 |
1353 user_agent = r->headers_in.user_agent->value.data; | 1354 user_agent = r->headers_in.user_agent->value.data; |
1354 | 1355 |
1355 ua = (u_char *) ngx_strstr(user_agent, "MSIE"); | 1356 ua = ngx_strstrn(user_agent, "MSIE", 4 - 1); |
1356 | 1357 |
1357 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) { | 1358 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) { |
1358 | 1359 |
1359 r->headers_in.msie = 1; | 1360 r->headers_in.msie = 1; |
1360 | 1361 |
1368 c->ssl->no_send_shutdown = 1; | 1369 c->ssl->no_send_shutdown = 1; |
1369 } | 1370 } |
1370 #endif | 1371 #endif |
1371 } | 1372 } |
1372 | 1373 |
1373 if (ngx_strstr(user_agent, "Opera")) { | 1374 if (ngx_strstrn(user_agent, "Opera", 5 - 1)) { |
1374 r->headers_in.opera = 1; | 1375 r->headers_in.opera = 1; |
1375 r->headers_in.msie = 0; | 1376 r->headers_in.msie = 0; |
1376 r->headers_in.msie4 = 0; | 1377 r->headers_in.msie4 = 0; |
1377 } | 1378 } |
1378 | 1379 |
1379 if (!r->headers_in.msie && !r->headers_in.opera) { | 1380 if (!r->headers_in.msie && !r->headers_in.opera) { |
1380 | 1381 |
1381 if (ngx_strstr(user_agent, "Gecko/")) { | 1382 if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) { |
1382 r->headers_in.gecko = 1; | 1383 r->headers_in.gecko = 1; |
1383 | 1384 |
1384 } else if (ngx_strstr(user_agent, "Konqueror")) { | 1385 } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) { |
1385 r->headers_in.konqueror = 1; | 1386 r->headers_in.konqueror = 1; |
1386 } | 1387 } |
1387 } | 1388 } |
1388 } | 1389 } |
1389 | 1390 |
1454 | 1455 |
1455 static void | 1456 static void |
1456 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len, | 1457 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len, |
1457 ngx_uint_t hash) | 1458 ngx_uint_t hash) |
1458 { | 1459 { |
1459 ngx_http_virtual_names_t *vn; | |
1460 ngx_http_core_loc_conf_t *clcf; | 1460 ngx_http_core_loc_conf_t *clcf; |
1461 ngx_http_core_srv_conf_t *cscf; | 1461 ngx_http_core_srv_conf_t *cscf; |
1462 | 1462 #if (NGX_PCRE) |
1463 vn = r->virtual_names; | 1463 ngx_int_t n; |
1464 | 1464 ngx_uint_t i; |
1465 if (vn->hash.buckets) { | 1465 ngx_str_t name; |
1466 cscf = ngx_hash_find(&vn->hash, hash, host, len); | 1466 ngx_http_server_name_t *sn; |
1467 if (cscf) { | 1467 #endif |
1468 | |
1469 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, host, len); | |
1470 | |
1471 if (cscf) { | |
1472 goto found; | |
1473 } | |
1474 | |
1475 #if (NGX_PCRE) | |
1476 | |
1477 if (r->virtual_names->nregex) { | |
1478 | |
1479 name.len = len; | |
1480 name.data = host; | |
1481 | |
1482 sn = r->virtual_names->regex; | |
1483 | |
1484 for (i = 0; i < r->virtual_names->nregex; i++) { | |
1485 | |
1486 n = ngx_regex_exec(sn[i].regex, &name, NULL, 0); | |
1487 | |
1488 if (n == NGX_REGEX_NO_MATCHED) { | |
1489 continue; | |
1490 } | |
1491 | |
1492 if (n < 0) { | |
1493 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
1494 ngx_regex_exec_n | |
1495 " failed: %d on \"%V\" using \"%V\"", | |
1496 n, &name, &sn[i].name); | |
1497 return; | |
1498 } | |
1499 | |
1500 /* match */ | |
1501 | |
1502 cscf = sn[i].core_srv_conf; | |
1503 | |
1468 goto found; | 1504 goto found; |
1469 } | 1505 } |
1470 } | 1506 } |
1471 | 1507 |
1472 if (vn->dns_wildcards && vn->dns_wildcards->hash.buckets) { | 1508 #endif |
1473 cscf = ngx_hash_find_wildcard(vn->dns_wildcards, host, len); | |
1474 | |
1475 if (cscf) { | |
1476 goto found; | |
1477 } | |
1478 } | |
1479 | 1509 |
1480 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); | 1510 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); |
1481 | 1511 |
1482 if (cscf->wildcard) { | 1512 if (cscf->wildcard) { |
1483 r->server_name.len = len; | 1513 r->server_name.len = len; |