HTTP 1.0与1.1 [英] HTTP 1.0 vs 1.1

查看:125
本文介绍了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按规范有一个必需的主机头。

HTTP 1.1 has a required Host header by spec.

HTTP 1.0没有正式要求主机头,但添加一个并没有什么坏处,许多应用程序(代理)都希望看到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通过使用名为entity tag的东西扩展了缓存支持。
如果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继续。这是为了防止客户端在客户端甚至不确定服务器是否可以处理请求或是否有权处理请求时发送大量请求。在这种情况下,客户端仅发送标题,服务器将告诉客户端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.

更多:


  • 摘要式身份验证和代理身份验证

  • 额外的新状态代码

  • 分块传输编码

  • 连接标头

  • 增强的压缩支持

  • 远远更多。

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

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

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