How to know if a server supports HTTP 1.0

2.8k Views Asked by At

I need to know if a server supports HTTP 1.0. I send this message through a TCP socket:

GET / HTTP/1.0
Host: www.example.com

The thing is that in sometimes I get a HTTP 1.0 response and other times HTTP 1.1 response. How should I interpret this responses?

Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

I need to know if a server supports HTTP 1.0.

When you send the request GET / HTTP/1.0 you're telling the server that the HTTP version you as a client support is 1.0.

If a server is either designed for HTTP 1.0 or designed for HTTP 1.1 with backwards compability to 1.0 then the server should send a 1.0 response to a 1.0 request, not a 1.1 response since the response might not be supported by the client.

2
On

In the HTTP protocol, the client is expected to send the version with the request, before it has any idea about what the server is or does.

That means that your trial-and-error approach is probably the only way to tell.

In practice, HTTP/1.0 isn't really in use the vast majority of the time, and it's almost always appropriate to use HTTP/1.1.