mirror of
https://github.com/nginx/nginx.git
synced 2025-01-22 04:02:58 +08:00
merge r2980, r2981, r2982:
win32 fixes: *) ngx_http_set_exten() is always successful since 0.3.46 *) skip URI trailing dots under Win32 *) use caseless regex locations on caseless filesystems: MacOSX, Win32, Cygwin
This commit is contained in:
parent
0ac11cd241
commit
a544b2ee98
@ -1220,10 +1220,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
|
||||
ngx_memcpy(p, name, path.len);
|
||||
}
|
||||
|
||||
if (ngx_http_set_exten(r) != NGX_OK) {
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_OK;
|
||||
}
|
||||
ngx_http_set_exten(r);
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"try file uri: \"%V\"", &r->uri);
|
||||
@ -1633,7 +1630,7 @@ ngx_http_set_content_type(ngx_http_request_t *r)
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
void
|
||||
ngx_http_set_exten(ngx_http_request_t *r)
|
||||
{
|
||||
ngx_int_t i;
|
||||
@ -1647,14 +1644,14 @@ ngx_http_set_exten(ngx_http_request_t *r)
|
||||
r->exten.len = r->uri.len - i - 1;
|
||||
r->exten.data = &r->uri.data[i + 1];
|
||||
|
||||
break;
|
||||
return;
|
||||
|
||||
} else if (r->uri.data[i] == '/') {
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return NGX_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -2079,9 +2076,7 @@ ngx_http_subrequest(ngx_http_request_t *r,
|
||||
sr->method_name = ngx_http_core_get_method;
|
||||
sr->http_protocol = r->http_protocol;
|
||||
|
||||
if (ngx_http_set_exten(sr) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
ngx_http_set_exten(sr);
|
||||
|
||||
sr->main = r->main;
|
||||
sr->parent = r;
|
||||
@ -2160,10 +2155,7 @@ ngx_http_internal_redirect(ngx_http_request_t *r,
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"internal redirect: \"%V?%V\"", uri, &r->args);
|
||||
|
||||
if (ngx_http_set_exten(r) != NGX_OK) {
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_DONE;
|
||||
}
|
||||
ngx_http_set_exten(r);
|
||||
|
||||
/* clear the modules contexts */
|
||||
ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
|
||||
@ -2566,6 +2558,10 @@ ngx_http_core_regex_location(ngx_conf_t *cf, ngx_http_core_loc_conf_t *clcf,
|
||||
err.len = NGX_MAX_CONF_ERRSTR;
|
||||
err.data = errstr;
|
||||
|
||||
#if (NGX_HAVE_CASELESS_FILESYSTEM)
|
||||
caseless = 1;
|
||||
#endif
|
||||
|
||||
clcf->regex = ngx_regex_compile(regex, caseless ? NGX_REGEX_CASELESS: 0,
|
||||
cf->pool, &err);
|
||||
|
||||
|
@ -437,7 +437,7 @@ ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r,
|
||||
|
||||
void *ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash);
|
||||
ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r);
|
||||
ngx_int_t ngx_http_set_exten(ngx_http_request_t *r);
|
||||
void ngx_http_set_exten(ngx_http_request_t *r);
|
||||
u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name,
|
||||
size_t *root_length, size_t reserved);
|
||||
ngx_int_t ngx_http_auth_basic_user(ngx_http_request_t *r);
|
||||
|
@ -763,6 +763,22 @@ ngx_http_process_request_line(ngx_event_t *rev)
|
||||
r->args.data = r->args_start;
|
||||
}
|
||||
|
||||
#if (NGX_WIN32)
|
||||
{
|
||||
u_char *p;
|
||||
|
||||
p = r->uri.data + r->uri.len - 1;
|
||||
|
||||
if (*p == '.') {
|
||||
|
||||
while (--p > r->uri.data && *p == '.') { /* void */ }
|
||||
|
||||
r->uri.len = p + 1 - r->uri.data;
|
||||
|
||||
ngx_http_set_exten(r);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http request line: \"%V\"", &r->request_line);
|
||||
|
@ -1074,11 +1074,7 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_http_set_exten(r) != NGX_OK) {
|
||||
e->ip = ngx_http_script_exit;
|
||||
e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
return;
|
||||
}
|
||||
ngx_http_set_exten(r);
|
||||
}
|
||||
|
||||
e->ip += sizeof(ngx_http_script_regex_end_code_t);
|
||||
|
@ -149,6 +149,7 @@ ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
|
||||
| (fi)->ftLastWriteTime.dwLowDateTime) \
|
||||
- 116444736000000000) / 10000000)
|
||||
|
||||
#define NGX_HAVE_CASELESS_FILESYSTEM 1
|
||||
|
||||
#define ngx_filename_cmp(s1, s2, n) _strnicmp((char *) s1, (char *) s2, n)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user