Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-08-25
09:17 • Ticket [504508ffff] port 80 in "Host:" request header status still... artifact: 5944396210 user: cleverly
2002-01-25
10:01 • Ticket [504508ffff]: 4 changes artifact: 4c886ee915 user: hobbs
10:01 • Add attachment http-port80.txt to ticket [504508ffff] artifact: 7923693d4c user: hobbs
10:01 • Ticket [504508ffff] port 80 in "Host:" request header status still... artifact: c31b25b24f user: hobbs
08:31 • Closed ticket [504508ffff]. artifact: b23745fae5 user: hobbs
07:39 • Ticket [504508ffff]: 5 changes artifact: f6aac5bebf user: apulsifer
05:38 • Open ticket [504508ffff]. artifact: 923b51945d user: hobbs
2002-01-17
02:38 • Pending ticket [504508ffff]. artifact: 6c892a271d user: apulsifer
01:47 • Open ticket [504508ffff]. artifact: 931e0a7f61 user: apulsifer
01:23 • Pending ticket [504508ffff]. artifact: b9b19b7eb8 user: hobbs
2002-01-16
18:15 • New ticket [504508ffff]. artifact: 86cb2133b0 user: apulsifer

port 80 in "Host:" request header

Closed / Fixed504508ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 24 years ago
Descriptionplain2002-01-16 18:15:10
http.tcl v2.4 generates a header line in the http 
request that reads:

Host: www.domain.com:80

I have discovered a server (sorry, can't say where) 
that tries to 302 redirect you to "www.domain.com" 
when you request a document from "www.domain.com:80".  
Yeh, I know its stupid, but since I have no control 
over the server, the only reasonable work around is to 
patch http.tcl.

When patched as follows, it works great:

old code:
puts $s "Host: $host:$port"

new code:
if {$port == 80} {
puts $s "Host: $host"
} else {
puts $s "Host: $host:$port"
}

I suggest making this change to http.tcl in order to 
make it more tolerant of brain damaged servers.

Thanks.
hobbsplain2002-01-17 01:23:52
Logged In: YES 
user_id=72656

Can you say what the server was?  That seems inane, since 
the host:port specification is 100% correct with the RFC.  
I'd register this as a bug against the server, rather than 
Tcl.
apulsiferplain2002-01-17 01:47:53
Logged In: YES 
user_id=429383

I agree, its not a very robust server.  Since the port 
value in the header is optional, this patch would make the 
http package more tolerate of bad server code.

BTW, after looking at the RFC, I realize the patch should 
read (in pseudocode):

if {$port == [default port for the selected protocol]} {
apulsiferplain2002-01-17 02:38:41
Logged In: YES 
user_id=429383

I agree, its not a very robust server.  Since the port 
value in the header is optional, this patch would make the 
http package more tolerate of bad server code.

BTW, after looking at the RFC, I realize the patch should 
read (in pseudocode):

if {$port == [default port for the selected protocol]} {
hobbsplain2002-01-25 05:38:56
Logged In: YES 
user_id=72656

I'd still note this as a server bug, because this might not 
be a robust patch in Tcl.  https and other support 
protocols might prevent the above from behaving properly.
apulsiferplain2002-01-25 07:39:04
Logged In: YES 
user_id=429383

I think it would solve 99% of the problems if you changed 
it to:

if {$port == 80 && "protocol" == "http"} {
puts $s "Host: $host"
} else {
puts $s "Host: $host:$port"
}

Note I downgraded to v8.3.2 and it doesn't have this 
problem.

Thanks,

Allen
hobbsplain2002-01-25 08:31:53
Logged In: YES 
user_id=72656

ok, went with the last solution to that restricts it to 
http proto, to stay on the safe side.  This is in 8.4a4cvs.
hobbsplain2002-01-25 10:01:08
Logged In: YES 
user_id=72656

Found a server that reliably exhibits this bug:

http://www.weather.com/weather/local/24060

From the geturl headers, the server is
   Apache/1.3.12 (Unix) mod_oas/5.1/

This obviously violates the RFC:

http://www.w3.org/Protocols/rfc2616/rfc2616-
sec14.html#sec14.23

Anyway, I'm back-porting to core-8-3-1-branch in case that 
ever goes out as well.  I'm also removing the "http" only 
restriction, because now that I see this happen, I can't 
rely on broken servers to hopefully server https right 
either.  I've attached the 8.4a4cvs patch.
hobbsplain2002-01-25 10:01:09
File Added - 16729: http-port80.txt
cleverlyplain2002-08-25 09:17:11
Logged In: YES 
user_id=22080

Just for the record, PowerDNS that does the redirection for
wiki.tcl.tk is also brain-dead/broken with regards to:
"Host: wiki.tcl.tk:80" :-(
Log in (anonymous is fine) to add a comment.

Attachments: