1

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!

joacoleza
  • 775
  • 1
  • 9
  • 26

2 Answers2

1

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.

Limmen
  • 1,407
  • 11
  • 17
0

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.

programmerq
  • 6,262
  • 25
  • 40
  • Yes I know. But it's for a university homework. I have to tell which HTTP protocols a given server supports. if I send HTTP/1.0 request and get a HTTP/1.0 response I know that server suppport 1.0, but if the response is with 1.1, does that mean that the server do not support 1.0? – joacoleza Oct 14 '16 at 23:47
  • I believe the specification states that the server must return 1.1 if the response at all doesn't comply with 1.0. I don't know how many webservers strictly adhere to these guidelines. It's possible that some servers simply ignore 1.0 in the version and treat everything as 1.1. – programmerq Oct 14 '16 at 23:58