[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Xavante: default request.parsed_url.port
- From: William Trenker <wtrenker@...>
- Date: Wed, 7 Sep 2005 20:54:37 -0400
I would like to suggest that the default port parsed from the incoming
http request should be '80' or nil, not the port the Xavante server
is running on.
Xavante calls socket.url.parse() to parse the request's url. If there
is no explicit port value in the url, Xavante defaults to the port
that the current instance of Xavante is running on as passed to
register() in httpd.lua.
I believe there is a significant difference between what I'll call the
'request port' and the 'server port'. I suggest that the default
value of request.parsed_url.port should be '80' as that is the
standard default value for the http:// scheme. (Or it could be nil
which is the case if no explicit port is specified in the url.)
Consider the following examples:
---------------- Example 1 -----------------------
Xavante is running on the local machine on port 80.
The url:
http://127.0.0.1/page.html
produces the request:
GET /page.html HTTP/1.1
Host: 127.0.0.1
<snip other headers>
Since there is no explicit port value in the request, Xavante defaults
to the server's port which in this example is port 80.
This looks fine.
---------------- Example 2 -----------------------
Xavante is running on the local machine on port 8080.
The url:
http://127.0.0.1:8080/page.html
produces the request:
GET /page.html HTTP/1.1
Host: 127.0.0.1:8080
<snip other headers>
Xavante's value for parsed_url.port is 8080
This is fine. There is an explicit port, 8080, in the url and it is
parsed correctly. It happens to match the server port so everything
works out.
---------------- Example 3 -----------------------
Xavante is running on the local machine on port 8080.
There is a firewall rule redirecting tcp destination port 80 to port 8080.
The url:
http://127.0.0.1/page.html
produces the request:
GET /page.html HTTP/1.1
Host: 127.0.0.1
<snip other headers>
Xavante's value for request.parsed_url.port is 8080
That's not right. 8080 is the server port, not the request port which is nil.
Perhaps one more example will serve to clarify.
---------------- Example 4 -----------------------
Xavante is running on the local machine on port 8080.
There is a firewall rule redirecting tcp destination port 4567 to port 8080.
The url:
http://127.0.0.1:4567/page.html
produces the request:
GET /page.html HTTP/1.1
Host: 127.0.0.1:4567
<snip other headers>
Xavante's value for request.parsed_url.port is 4567.
Tthat's right. The port parsed out of the request is definitely 4567,
not 8080 which is the server port.
So shouldn't the default port, where none is specified in the request,
be 80 (or at least nil)? I don't think it should be the server port.
Thoughts, please.
Regards,
Bill