HTTP 压缩 - 我可以配置客户端来压缩发送到服务器的数据吗?
我使用 IIS 7 作为我的应用程序的 Web 服务器。如果我在服务器中启用动态内容压缩,这是否也使客户端能够将压缩数据发送到服务器(如果可以的话)?
我的意思是,我的应用程序使用 SOAP Web 服务,并且客户端通常会向服务器发送大量数据。客户端是用 C#/.NET 编写的。我可以在 Web 参考/服务参考中进行任何类型的配置,以便告诉他们在将内容发送到 IIS 之前压缩内容吗?我是否必须在 IIS 中进行任何类型的配置才能使其正常工作?
提前致谢
I'm using IIS 7 as web server for my application. If I enable dynamic content compression in the server, will this also enable clients to send compressed data to the server, if they can?
I mean, my application uses SOAP webservices, and clients usually send large chunks of data to the server. The clients are written in C#/.NET. Is there any kind of configuration I can do in a web reference / serice reference in order to tell them to compress the content before they send it to IIS? And do I have to do any kind of configuration in IIS in order for this to work?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTTP 压缩的工作原理是客户端指定一个
Accept-Encoding
标头及其接受的压缩类型:服务器会看到这一点,并根据 接受此处定义的编码规则。响应将采用可接受的值或身份编码之一。
请求:
一般来说,请求不能首先压缩,因为通信是从请求开始的。 HTTP 客户端可以发送选项请求,如果您可以控制客户端和服务器源代码,则可以使用该选项请求。
一个例子是 SVN 的 apache 模块,也是 svn 客户端。它们可以配置为对请求数据进行 HTTP 压缩。
请参阅 RFC 2616:第 9 节
HTTP compression works by the client specifying an
Accept-Encoding
header with the compression types it accepts:The server then sees this and will chose one of the encoding types based on the accept encoding rules defined here. The response will be in one of the accepted values or the identity encoding.
Requests:
In general a request can't come in compressed first because the communication starts with a request. An HTTP client could send an options request though and use that if you have control of the client and server source code you could do this.
An example of this is an apache module for SVN, and also an svn client. They can be configured to do HTTP compression on the request data.
See RFC 2616: Section 9