Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1944 closed Bug (fixed)

Web Client 301 redirect violates w3c.org specification

Reported by: spil Owned by: Gimp
Priority: Normal Milestone: 1.52
Component: Web Client Version: 1.51
Severity: Normal Keywords:
Cc:

Description

Transcript of session

# telnet 127.0.0.1 9091
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: www.example.org

HTTP/1.1 301 Moved Permanently
Server: Transmission
Location: /transmission/web/
Date: Mon, 23 Mar 2009 09:58:23 GMT
Content-Length: 31
Content-Type: text/html; charset=ISO-8859-1

<h1>301: Moved Permanently</h1>

The Location header returned violates the w3c.org HTTP/1.1 specification http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Section 14.30 Location specifies: "The field value consists of a single absolute URI."

The webserver must in return the header Location: http://www.example.org/transmission/web

transmission-daemon-1.51 built from ports running on FreeBSD 7.1/i386

Change History (5)

comment:1 Changed 12 years ago by charles

  • Resolution set to wontfix
  • Status changed from new to closed

I wonder what the correct solution for this is. I don't see a good way of getting the public IP address out of evhttp for using as the domain here.

Is this actually breaking on any browser?

If someone submits a patch for this, I'd be inclined to use it, but as things are now the relaxed usage of 301 doesn't seem to be causing any harm.

comment:2 Changed 12 years ago by spil

  • Resolution wontfix deleted
  • Status changed from closed to reopened

The fix is to use the Host: header from the HTTP request, and the protocol that you've bound on (always http for transmission-web I guess) Create the Location header from the <protocol>:<Host-header>/URI

Original Request from the browser is:

GET / HTTP/1.1
Host: www.example.org

Apache will request at the daemon:9901 :

GET / HTTP/1.1
Host: 127.0.0.1:9901

You're working on a http request, so the reply from the daemon should be:

HTTP/1.1 301 Moved Permanently
Server: Transmission
Location: http://127.0.0.1:9901/transmission/web/

Apache will then rewrite the Location part for you in the reply that is sent to the client (provided that the correct ProxyPassReverse? is in place):

HTTP/1.1 301 Moved Permanently
Server: Transmission
Location: http://www.example.org/transmission/web/

comment:3 Changed 12 years ago by charles

spil: the host header did the trick. Thanks for the pointer.

Fixed in trunk in r8081.

comment:4 Changed 12 years ago by charles

  • Milestone changed from None Set to 1.52
  • Resolution set to fixed
  • Status changed from reopened to closed

comment:5 Changed 12 years ago by charles

Fixed in 1.5x branch in r8082.

Note: See TracTickets for help on using tickets.