Barry Margolin wrote:
> In general, when protocol designers make such drastic changes that this
> could happen, they also assign a new port to make it unlikely that
> grossly incompatible clients and servers will talk to each other.
Right.
> This
> allows the server to assume some basic level of interoperability with
> clients that have connected to them -- the fact that the client
> connected to port 80 implies that he understands the least common
> denominator of HTTP 0.9, 1.0, and 1.1; if not, he shouldn't have
> connected to port 80, and it's not the server's job to protect the
> client from such mistakes.
I agree. So you should send an HTTP 0.9 style error.
> Didn't HTTP 0.9 have error codes roughly
> similar to 1.0 and 1.1 (I assume so, since the scheme is mostly just
> copied from SMTP and FTP)?
No. Check this out:
$ telnet www.apache.org 80
Trying 192.87.106.226...
Connected to www.apache.org.
Escape character is '^]'.
GET foobar
400 Bad Request
Bad Request
Your browser sent a request that this server could not
understand.
Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g Server at
www.apache.org Port 80
Connection closed by foreign host.
Notice that *no* headers were sent in reply. This is because HTTP 0.9
did not support any headers. Now watch this:
$ telnet www.apache.org 80
Trying 192.87.106.226...
Connected to www.apache.org.
Escape character is '^]'.
GET foobar
400 Bad Request
Bad Request
Your browser sent a request that this server could not
understand.
Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g Server at
www.apache.org Port 80
Connection closed by foreign host.
[davids@youknow pdcfg]$ telnet www.apache.org 80
Trying 192.87.106.226...
Connected to www.apache.org.
Escape character is '^]'.
MOO cow
400 Bad Request
Bad Request
Your browser sent a request that this server could not
understand.
Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.7g Server at
www.apache.org Port 80
Connection closed by foreign host.
This is, IMO, sensible behavior.
However, Apache treats any query with three terms as implying support
for HTTP headers. I don't know how you can really argue that this is
wrong or right. There is no overarching standard to specify how a
multi-protocol server should handle a query that doesn't definitely
establish what protocol the client is using.
> As a similar problem, tell your browser to go to URL
> http://some-smtp-server:25 and do a packet capture to see what happens.
> The SMTP server will receive an HTTP GET command. Of course, it won't
> recognize this, so it will send a "500 Command not understood" reply
> (although the browser won't process this properly, having already
> received the server's "220" greeting).
Right, nothing you can do about that, until and unless someone creates
some super-standard that provides a way to say "I am an SMTP server"
and both server and client support that standard.
Arguably, it would be a good idea for all servers that can practically
do so to recognize HTTP 0.9, 1.0 and 1.1 requests and provide a
sensible error messages. You can't always do this, but you can most of
the time.
DS