gpt4 book ai didi

.net - HTTP 压缩 - 我可以配置客户端来压缩发送到服务器的数据吗?

转载 作者:可可西里 更新时间:2023-11-01 16:05:56 24 4
gpt4 key购买 nike

我正在使用 IIS 7 作为我的应用程序的 Web 服务器。如果我在服务器中启用动态内容压缩,这是否也使客户端能够将压缩数据发送到服务器(如果可以)?

我的意思是,我的应用程序使用 SOAP 网络服务,客户端通常会向服务器发送大量数据。客户端是用 C#/.NET 编写的。我可以在网络引用/服务引用中进行任何类型的配置,以便告诉他们在将内容发送到 IIS 之前压缩内容吗?我是否必须在 IIS 中进行任何类型的配置才能使其正常工作?

提前致谢

最佳答案

HTTP 压缩由客户端指定 Accept-Encoding header 及其接受的压缩类型来工作:

Accept-Encoding: compress, gzip

服务器随后会看到这一点,并会根据 accept encoding rules defined here 选择一种编码类型。 .响应将采用可接受的值之一或身份编码。


请求:

一般来说,请求不能先压缩,因为通信是从请求开始的。 HTTP 客户端可以发送选项请求并使用它,如果您可以控制客户端和服务器源代码,则可以执行此操作。

The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

这方面的一个例子是用于 SVN 的 apache 模块,也是一个 svn 客户端。它们可以配置为对请求数据进行 HTTP 压缩。

See RFC 2616: Section 9

关于.net - HTTP 压缩 - 我可以配置客户端来压缩发送到服务器的数据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2655376/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com