HTTP 1.0 与 1.1 [英] HTTP 1.0 vs 1.1

查看:41
本文介绍了HTTP 1.0 与 1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以简要概述一下 HTTP 1.0 和 HTTP 1.1 之间的区别吗?我在这两个 RFC 上都花了一些时间,但没能找出它们之间的很多区别.维基百科是这样说的:

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.

但这对我来说意义不大.我意识到这是一个有点复杂的主题,所以我不期待一个完整的答案,但有人可以给我一个较低级别的差异的简要概述吗?
我的意思是我正在寻找实现 HTTP 服务器或应用程序所需的信息.我主要是在寻找正确方向的推动力,以便我可以自己解决.

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'm mostly looking for a nudge in the right direction so that I can figure it out on my own.

推荐答案

代理支持和主机字段:

HTTP 1.1 有规范要求的 Host 标头.

HTTP 1.1 has a required Host header by spec.

HTTP 1.0 没有正式要求 Host 标头,但添加一个也无妨,许多应用程序(代理)希望看到 Host 标头,而不管协议版本如何.

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.

示例:

GET / HTTP/1.1
Host: www.blahblahblahblah.com

此标头很有用,因为它允许您通过代理服务器路由消息,还因为您的 Web 服务器可以区分同一服务器上的不同站点.

This header is useful because it allows you to route a message through proxy servers, and also because your web server can distinguish between different sites on the same server.

所以这意味着如果你有 blahblahlbah.com 和 helohelohelo.com 都指向同一个 IP.您的 Web 服务器可以使用主机字段来区分客户端计算机想要的站点.

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.

持久连接:

HTTP 1.1 还允许您拥有持久连接,这意味着您可以在同一个 HTTP 连接上拥有多个请求/响应.

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.

在 HTTP 1.0 中,您必须为每个请求/响应对打开一个新连接.在每次响应之后,连接将被关闭.由于TCP 慢启动,这导致了一些很大的效率问题.

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 方法:

HTTP/1.1 引入了 OPTIONS 方法.HTTP 客户端可以使用此方法来确定 HTTP 服务器的能力.它主要用于 Web 应用程序中的跨域资源共享.

HTTP/1.1 introduces the OPTIONS method. An HTTP client can use this method to determine the abilities of the HTTP server. It's mostly used for Cross Origin Resource Sharing in web applications.

缓存:

HTTP 1.0 通过标头支持缓存:If-Modified-Since.

HTTP 1.0 had support for caching via the header: If-Modified-Since.

HTTP 1.1 通过使用称为实体标签"的东西大大扩展了缓存支持.如果 2 个资源相同,则它们将具有相同的实体标签.

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 还添加了 If-Unmodified-Since、If-Match、If-None-Match 条件标头.

HTTP 1.1 also adds the If-Unmodified-Since, If-Match, If-None-Match conditional headers.

还有其他与缓存相关的附加内容,如 Cache-Control 标头.

There are also further additions relating to caching like the Cache-Control header.

100 继续状态:

HTTP/1.1 100 Continue 中有一个新的返回码.这是为了防止客户端在客户端甚至不确定服务器是否可以处理请求或是否有权处理请求时发送大请求.在这种情况下,客户端只发送头,服务器会告诉客户端 100 继续,继续正文.

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.

更多:

  • 摘要式身份验证和代理身份验证
  • 额外的新状态代码
  • 分块传输编码
  • 连接头
  • 增强的压缩支持
  • 还有更多.

这篇关于HTTP 1.0 与 1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆