开发者

Gzip compression for HTTP requests

开发者 https://www.devze.com 2023-01-04 19:27 出处:网络
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 ser

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 com开发者_如何学运维press requests as well, and protocol allows that - anybody using it? Configuration tips?


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/...


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消