Mercurial > hg > nginx-vendor-0-8
comparison src/http/modules/ngx_http_dav_module.c @ 376:edf1cb6c328e NGINX_0_7_0
nginx 0.7.0
*) Change: now the 0x00-0x1F, '"' and '\' characters are escaped as
\xXX in an access_log.
Thanks to Maxim Dounin.
*) Change: now nginx allows several "Host" request header line.
*) Feature: the "modified" flag in the "expires" directive.
*) Feature: the $uid_got and $uid_set variables may be used at any
request processing stage.
*) Feature: the $hostname variable.
Thanks to Andrei Nigmatulin.
*) Feature: DESTDIR support.
Thanks to Todd A. Fisher and Andras Voroskoi.
*) Bugfix: a segmentation fault might occur in worker process on Linux,
if keepalive was enabled.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 19 May 2008 00:00:00 +0400 |
parents | babd3d9efb62 |
children | 984bb0b1399b |
comparison
equal
deleted
inserted
replaced
375:52f3c9c7eff0 | 376:edf1cb6c328e |
---|---|
510 | 510 |
511 | 511 |
512 static ngx_int_t | 512 static ngx_int_t |
513 ngx_http_dav_copy_move_handler(ngx_http_request_t *r) | 513 ngx_http_dav_copy_move_handler(ngx_http_request_t *r) |
514 { | 514 { |
515 u_char *p, *desthost, *last, ch; | 515 u_char *p, *host, *last, ch; |
516 size_t len, root; | 516 size_t len, root; |
517 ngx_err_t err; | 517 ngx_err_t err; |
518 ngx_int_t rc, depth; | 518 ngx_int_t rc, depth; |
519 ngx_uint_t overwrite, slash, dir; | 519 ngx_uint_t overwrite, slash, dir; |
520 ngx_str_t path, uri; | 520 ngx_str_t path, uri; |
521 ngx_tree_ctx_t tree; | 521 ngx_tree_ctx_t tree; |
522 ngx_file_info_t fi; | 522 ngx_file_info_t fi; |
523 ngx_table_elt_t *host, *dest, *over; | 523 ngx_table_elt_t *dest, *over; |
524 ngx_http_dav_copy_ctx_t copy; | 524 ngx_http_dav_copy_ctx_t copy; |
525 ngx_http_dav_loc_conf_t *dlcf; | 525 ngx_http_dav_loc_conf_t *dlcf; |
526 | 526 |
527 if (r->headers_in.content_length_n > 0) { | 527 if (r->headers_in.content_length_n > 0) { |
528 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; | 528 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; |
534 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 534 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
535 "client sent no \"Destination\" header"); | 535 "client sent no \"Destination\" header"); |
536 return NGX_HTTP_BAD_REQUEST; | 536 return NGX_HTTP_BAD_REQUEST; |
537 } | 537 } |
538 | 538 |
539 host = r->headers_in.host; | 539 len = r->headers_in.server.len; |
540 | 540 |
541 if (host == NULL) { | 541 if (len == 0) { |
542 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 542 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
543 "client sent no \"Host\" header"); | 543 "client sent no \"Host\" header"); |
544 return NGX_HTTP_BAD_REQUEST; | 544 return NGX_HTTP_BAD_REQUEST; |
545 } | 545 } |
546 | 546 |
551 != 0) | 551 != 0) |
552 { | 552 { |
553 goto invalid_destination; | 553 goto invalid_destination; |
554 } | 554 } |
555 | 555 |
556 desthost = dest->value.data + sizeof("https://") - 1; | 556 host = dest->value.data + sizeof("https://") - 1; |
557 | 557 |
558 } else | 558 } else |
559 #endif | 559 #endif |
560 { | 560 { |
561 if (ngx_strncmp(dest->value.data, "http://", sizeof("http://") - 1) | 561 if (ngx_strncmp(dest->value.data, "http://", sizeof("http://") - 1) |
562 != 0) | 562 != 0) |
563 { | 563 { |
564 goto invalid_destination; | 564 goto invalid_destination; |
565 } | 565 } |
566 | 566 |
567 desthost = dest->value.data + sizeof("http://") - 1; | 567 host = dest->value.data + sizeof("http://") - 1; |
568 } | 568 } |
569 | 569 |
570 len = r->headers_in.host_name_len; | 570 if (ngx_strncmp(host, r->headers_in.server.data, len) != 0) { |
571 | |
572 if (ngx_strncmp(desthost, host->value.data, len) != 0) { | |
573 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 571 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
574 "\"Destination\" URI \"%V\" is handled by " | 572 "\"Destination\" URI \"%V\" is handled by " |
575 "different repository than the source URI", | 573 "different repository than the source URI", |
576 &dest->value); | 574 &dest->value); |
577 return NGX_HTTP_BAD_REQUEST; | 575 return NGX_HTTP_BAD_REQUEST; |
578 } | 576 } |
579 | 577 |
580 last = dest->value.data + dest->value.len; | 578 last = dest->value.data + dest->value.len; |
581 | 579 |
582 for (p = desthost + len; p < last; p++) { | 580 for (p = host + len; p < last; p++) { |
583 if (*p == '/') { | 581 if (*p == '/') { |
584 goto destination_done; | 582 goto destination_done; |
585 } | 583 } |
586 } | 584 } |
587 | 585 |