Nguyên Nghĩa

Hãy biết đam mê và mãi mãi khát khao học hỏi.

MENU
Tìm kiếm thông tin
Nguyên Nghĩa
Mr.N2

What are the differences between HTTP 1.0 and 1.1?

http

Question:

Could somebody give me a brief overview of the differences between HTTP 1.0 and HTTP 1.1? I’ve spent some time with both of the RFCs, but haven’t been able to pull out a lot of difference between them. Wikipedia says this:

HTTP/1.1 (1997-1999)
Current version; persistent connections enabled by default and works well with proxies. Also supports request pipelining, allowing multiple requests to be sent at the same time, allowing the server to prepare for the workload and potentially transfer the requested resources more quickly to the client.

But that doesn’t mean a lot to me. I realize this is a somewhat complicated subject, so I’m not expecting a full answer, but can someone give me a brief overview of the differences at a bit lower level? By this I mean that I’m looking for the info I would need to know to implement either an HTTP server or application.

I realize that this can be a somewhat complicated subject (based on what I know about HTTP as of right now), so I’m not necessarily looking for a full answer. I’m really more looking for a nudge in the right direction so that I can figure it out on my own.

Answers:

HTTP 1.0 VS HTTP 1.1

When the browser receives and renders HTML, it sends new request to get any resource the HTML points to (e.g. images).
In HTTP 1.0 each request creates new TCP connection, while in HTTP 1.1 the browser creates one TCP connection and sends many requests through it.

HTTP 1.0
http 1.0

HTTP 1.1
http 1.1

Proxy support and the Host field:

HTTP 1.1 has a required Host header by spec.
HTTP 1.0 does not officially require a Host header, but it doesn’t hurt to add one, and many applications (proxies) expect to see the Host header regardless of the protocol version.

Example:

GET / HTTP/1.1
Host: www.blahblahblahblah.com
This header is useful because it allows you to route a message through proxy servers, and also because your a web server can distinguish between different sites on the same server.

So this means if you have blahblahlbah.com and helohelohelo.com both pointing to the same IP. Your web server can use the Host field to distinguish which site the client machine wants.

Persistent connections:

HTTP 1.1 also allows you to have persistent connections which means that you can have more than one request/response on the same HTTP connection.
In HTTP 1.0 you had to open a new connection for each request/response pair. And after each response the connection would be closed. This lead to some big efficiency problems because of TCP Slow Start.

OPTIONS method:

HTTP/1.1 introduces the OPTIONS method. An HTTP client can use this method to determine the abilities of the HTTP server. Although it is not very much used today, most of this information is passed on server responses.

Caching:

HTTP 1.0 had support for caching via the header: If-Modified-Since.
HTTP 1.1 expands on the caching support a lot by using something called ‘entity tag’. If 2 resources are the same, then they will have the same entity tags.
HTTP 1.1 also adds the If-Unmodified-Since, If-Match, If-None-Match conditional headers.
There are also further additions relating to caching like the Cache-Control header.

100 Continue status:

There is a new return code in HTTP/1.1 100 Continue. This is to prevent a client from sending a large request when that client is not even sure if the server can process the request, or is authorized to process the request. In this case the client sends only the headers, and the server will tell the client 100 Continue, go ahead with the body.

Much more:

  • Digest authentication and proxy authentication
  • Extra new status codes.
  • Chunked transfer encoding.
  • Connection header.
  • Enhanced compression support.
  • Much much more.

Research More:
http://www8.org/w8-papers/5c-protocols/key/key.html
http://stackoverflow.com/questions/246859/http-1-0-vs-1-1/247026
http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.6.1
http://baraknaamafinal.appspot.com/http.jsp

Tags:
Bình luận

Leave a Reply