mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
use ngx_strstrn() and ngx_strcasestrn()
This commit is contained in:
parent
1bd987019d
commit
0659720dc8
@ -279,7 +279,7 @@ ngx_http_gzip_header_filter(ngx_http_request_t *r)
|
|||||||
|| r->headers_in.accept_encoding == NULL
|
|| r->headers_in.accept_encoding == NULL
|
||||||
|| (r->headers_out.content_length_n != -1
|
|| (r->headers_out.content_length_n != -1
|
||||||
&& r->headers_out.content_length_n < conf->min_length)
|
&& r->headers_out.content_length_n < conf->min_length)
|
||||||
|| ngx_strstr(r->headers_in.accept_encoding->value.data, "gzip") == NULL
|
|| ngx_strcasestrn(r->headers_in.accept_encoding->value.data, "gzip", 3)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ngx_http_next_header_filter(r);
|
return ngx_http_next_header_filter(r);
|
||||||
|
@ -1204,10 +1204,10 @@ static ngx_int_t
|
|||||||
ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
|
ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
|
||||||
ngx_uint_t offset)
|
ngx_uint_t offset)
|
||||||
{
|
{
|
||||||
if (ngx_strstr(h->value.data, "close")) {
|
if (ngx_strcasestrn(h->value.data, "close", 4)) {
|
||||||
r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
|
r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
|
||||||
|
|
||||||
} else if (ngx_strstr(h->value.data, "keep-alive")) {
|
} else if (ngx_strcasestrn(h->value.data, "keep-alive", 9)) {
|
||||||
r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
|
r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,7 +1319,8 @@ ngx_http_process_request_header(ngx_http_request_t *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (r->headers_in.transfer_encoding
|
if (r->headers_in.transfer_encoding
|
||||||
&& ngx_strstr(r->headers_in.transfer_encoding->value.data, "chunked"))
|
&& ngx_strcasestrn(r->headers_in.transfer_encoding->value.data,
|
||||||
|
"chunked", 6))
|
||||||
{
|
{
|
||||||
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
||||||
"client sent \"Transfer-Encoding: chunked\" header");
|
"client sent \"Transfer-Encoding: chunked\" header");
|
||||||
@ -1351,7 +1352,7 @@ ngx_http_process_request_header(ngx_http_request_t *r)
|
|||||||
|
|
||||||
user_agent = r->headers_in.user_agent->value.data;
|
user_agent = r->headers_in.user_agent->value.data;
|
||||||
|
|
||||||
ua = (u_char *) ngx_strstr(user_agent, "MSIE");
|
ua = ngx_strstrn(user_agent, "MSIE", 3);
|
||||||
|
|
||||||
if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
|
if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
|
||||||
|
|
||||||
@ -1369,7 +1370,7 @@ ngx_http_process_request_header(ngx_http_request_t *r)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_strstr(user_agent, "Opera")) {
|
if (ngx_strstrn(user_agent, "Opera", 4)) {
|
||||||
r->headers_in.opera = 1;
|
r->headers_in.opera = 1;
|
||||||
r->headers_in.msie = 0;
|
r->headers_in.msie = 0;
|
||||||
r->headers_in.msie4 = 0;
|
r->headers_in.msie4 = 0;
|
||||||
@ -1377,10 +1378,10 @@ ngx_http_process_request_header(ngx_http_request_t *r)
|
|||||||
|
|
||||||
if (!r->headers_in.msie && !r->headers_in.opera) {
|
if (!r->headers_in.msie && !r->headers_in.opera) {
|
||||||
|
|
||||||
if (ngx_strstr(user_agent, "Gecko/")) {
|
if (ngx_strstrn(user_agent, "Gecko/", 5)) {
|
||||||
r->headers_in.gecko = 1;
|
r->headers_in.gecko = 1;
|
||||||
|
|
||||||
} else if (ngx_strstr(user_agent, "Konqueror")) {
|
} else if (ngx_strstrn(user_agent, "Konqueror", 8)) {
|
||||||
r->headers_in.konqueror = 1;
|
r->headers_in.konqueror = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2636,7 +2636,7 @@ ngx_http_upstream_rewrite_refresh(ngx_http_request_t *r, ngx_table_elt_t *h,
|
|||||||
|
|
||||||
if (r->upstream->rewrite_redirect) {
|
if (r->upstream->rewrite_redirect) {
|
||||||
|
|
||||||
p = (u_char *) ngx_strstr(ho->value.data, "url=");
|
p = ngx_strcasestrn(ho->value.data, "url=", 3);
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
rc = r->upstream->rewrite_redirect(r, ho, p + 4 - ho->value.data);
|
rc = r->upstream->rewrite_redirect(r, ho, p + 4 - ho->value.data);
|
||||||
|
Loading…
Reference in New Issue
Block a user