HTTP 请求的 Gzip 压缩
有没有办法让浏览器和/或 Silverlight 应用程序对 HTTP 请求进行 GZIP 压缩?不要与 HTTP 响应的 GZIP 压缩混淆 - 我知道如何在服务器端进行设置。我需要的是压缩请求,并且协议允许 - 有人使用它吗?配置技巧?
Is there any way to make browsers &/or Silverlight application do a GZIP compression of HTTP requests? Don't confuse with GZIP compression of HTTP responses - I know how to set this up on the server side. What I need is to compress requests as well, and protocol allows that - anybody using it? Configuration tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有一个 MSDN 示例描述了如何制作 WCF 自定义消息编码器:压缩编码器。还没有尝试过,但它可能会提供一些想法。 http://msdn.microsoft.com/en-us/library/ms751458.aspx
There is an MSDN sample that describes how to make a WCF Custom Message Encoder: Compression Encoder. Have not tried this yet, but it may give some ideas. http://msdn.microsoft.com/en-us/library/ms751458.aspx
除非您是这些网站和 silverlight 应用程序的作者,否则您无法制作它们。压缩 http 请求没有标准。您可以设置您的服务器来支持它并将其记录在您的 api 中,这是您能做的最好的事情。
如果您在 silverlight 应用程序中使用 WCF,则可以使用编码器压缩消息。但这又是不可发现的,必须记录下来。
You cannot make them unless you are the author of these websites and silverlight applications. There is no standard for a compressed http request. You can setup your server to support it and document it in your api and that is the best you can do.
If your using WCF in the silverlight application you can compress the message with an encoder. But again this is not discoverable and must be documented.
据我所知,gzip只是HTTP 1.1标准的一部分,用于响应,而不是用于请求数据。
如果您发布大量数据,则需要压缩请求,在这种情况下,您可以在客户端应用程序中压缩数据(例如,在您标记问题的 silverlight 中),并将其作为字节数组发送/溪流。
然后在接收端解压数据。
As far as I know, gzip is only a part of the HTTP 1.1 standard for responses, not for request data.
The need for compressing requests would be if you post a lot of data, and in that case you can compress your data in the client application (eg. in silverlight which you have tagged your question with), and send it over as a byte array/stream.
Then decompress the data on the receiving end.
HTTP 请求可以包含实体标头,其中包括内容编码:
http://www.w3.org/...
一个名叫 Morten Nielsen 的人已经完成了 HTTP 请求压缩Windows Phone 中的 Silverlight,博客文章:
http://www.sharpgis.net/...
HTTP Request can contain entity-headers, which includes Content-Encoding:
http://www.w3.org/...
A guy named Morten Nielsen has done HTTP request compression for Silverlight in Windows Phone, blog post:
http://www.sharpgis.net/...