diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2008-07-07 10:22:30 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2008-07-07 10:22:30 +0000 |
| commit | c410db96b9103d30a33a7f16f3ede58265d63bab (patch) | |
| tree | d4c212a844ca250be346fe28359e2180a52b7e26 /src/http/modules/ngx_http_dav_module.c | |
| parent | b5f5da3a37f2169d6745f7160203a792ab49cac0 (diff) | |
| download | nginx-c410db96b9103d30a33a7f16f3ede58265d63bab.tar.gz nginx-c410db96b9103d30a33a7f16f3ede58265d63bab.tar.bz2 | |
r2008 merge:
*) host in request line has priority
*) allow several Host headers
*) validate host
Diffstat (limited to 'src/http/modules/ngx_http_dav_module.c')
| -rw-r--r-- | src/http/modules/ngx_http_dav_module.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c index b1e0831b1..3d54525e8 100644 --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -512,7 +512,7 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf) static ngx_int_t ngx_http_dav_copy_move_handler(ngx_http_request_t *r) { - u_char *p, *desthost, *last, ch; + u_char *p, *host, *last, ch; size_t len, root; ngx_err_t err; ngx_int_t rc, depth; @@ -520,7 +520,7 @@ ngx_http_dav_copy_move_handler(ngx_http_request_t *r) ngx_str_t path, uri; ngx_tree_ctx_t tree; ngx_file_info_t fi; - ngx_table_elt_t *host, *dest, *over; + ngx_table_elt_t *dest, *over; ngx_http_dav_copy_ctx_t copy; ngx_http_dav_loc_conf_t *dlcf; @@ -536,9 +536,9 @@ ngx_http_dav_copy_move_handler(ngx_http_request_t *r) return NGX_HTTP_BAD_REQUEST; } - host = r->headers_in.host; + len = r->headers_in.server.len; - if (host == NULL) { + if (len == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "client sent no \"Host\" header"); return NGX_HTTP_BAD_REQUEST; @@ -553,7 +553,7 @@ ngx_http_dav_copy_move_handler(ngx_http_request_t *r) goto invalid_destination; } - desthost = dest->value.data + sizeof("https://") - 1; + host = dest->value.data + sizeof("https://") - 1; } else #endif @@ -564,12 +564,10 @@ ngx_http_dav_copy_move_handler(ngx_http_request_t *r) goto invalid_destination; } - desthost = dest->value.data + sizeof("http://") - 1; + host = dest->value.data + sizeof("http://") - 1; } - len = r->headers_in.host_name_len; - - if (ngx_strncmp(desthost, host->value.data, len) != 0) { + if (ngx_strncmp(host, r->headers_in.server.data, len) != 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "\"Destination\" URI \"%V\" is handled by " "different repository than the source URI", @@ -579,7 +577,7 @@ ngx_http_dav_copy_move_handler(ngx_http_request_t *r) last = dest->value.data + dest->value.len; - for (p = desthost + len; p < last; p++) { + for (p = host + len; p < last; p++) { if (*p == '/') { goto destination_done; } |
