Bug 38182

Summary: COPY ignores authority in Destination header
Product: Apache httpd-2 Reporter: Julian Reschke <julian.reschke>
Component: mod_davAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: normal CC: malinowskirafal
Priority: P2 Keywords: MassUpdate, PatchAvailable, RFC
Version: 2.0.55   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: Proposed patch for this problem
Patch with non-absolute path support

Description Julian Reschke 2006-01-08 12:30:49 UTC
A COPY request such as

  COPY /xyz HTTP/1.1
  Host: www.example.com
  Destination: http://julian-reschke.de/foo

succeeds. It should fail, unless the server has indeed created the resource at
the destination URI (which it didn't).
Comment 1 Joe Orton 2006-01-10 13:46:06 UTC
The code that checked the hostname/port has been disabled in 2.x for some reason. 


    if (comp.hostname != NULL &&
        !ap_matches_request_vhost(r, comp.hostname, port)) {
Comment 2 Wilfredo Sanchez 2006-01-24 04:32:35 UTC
Julian explains that a potential reason is that being compliant here has problems with reverse proxies:


  MOVE /a HTTP/1.1
  Host: www.example.com
  Destination: http://www.example.com/b

sent to a reverse proxy running on port 80 of www.example.com, which in turn forwards the request to 
port 8080, rewriting the host header, but not touching the Destination header:

  MOVE /a HTTP/1.1
  Host: www.example.com:8080
  Destination: http://www.example.com/b

A compliant WebDAV server will detect that the target of MOVE is on a different server, and fail the 
Comment 3 Wilfredo Sanchez 2006-01-24 04:34:29 UTC
Personally, I don't think that "fixing" the problem for reverse proxies justifies being non-compliant in this 
manner, if this is indeed the reason why we disabled the check.
Comment 4 Wilfredo Sanchez 2006-01-24 04:36:49 UTC
See http://lists.w3.org/Archives/Public/w3c-dist-auth/2006JanMar/0286.html for Julian's expanded 
summary regarding reverse proxies.
Comment 5 Rafa&#322; Malinowski 2008-07-25 11:47:41 UTC
Will it be fixed? Is there any way to do it?
If there is a way just tell me, I will try ;)
Comment 6 Rafa&#322; Malinowski 2008-09-19 07:16:20 UTC
Created attachment 22612 [details]
Proposed patch for this problem

This patch check if Destination host/port is the same as Host host/port. If not, BAD GATEWAY is returned.

It also translates Destination header in reverse proxy mode.
Comment 7 Julian Reschke 2008-09-19 07:32:56 UTC
Did you consider to, while fixing this, also allow the new RFC 4918 format (absolute path instead of absolute URI)?
Comment 8 Rafa&#322; Malinowski 2008-09-19 07:51:02 UTC
No, but it would be one simple check for Destination format.
Comment 9 Rafa&#322; Malinowski 2008-09-20 09:46:57 UTC
Created attachment 22618 [details]
Patch with non-absolute path support
Comment 10 Rafa&#322; Malinowski 2008-09-20 09:47:32 UTC
#7 - done
Comment 11 William A. Rowe Jr. 2018-11-07 21:09:11 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.