http compression on windows phone 7 http stack
I asked this question before the final WP7 platform was released and never received a definitive answer from the team - it appears that the http stack in WP7 DOES NOT support compression. The way I found this out was by using fiddler while running the emulator - when I request an ODATA feed that is compressed when received by Silverlight3/4 - is not compressed when received by an WP7 app.
Does anyone have confirmation that th开发者_运维知识库e Silverlight HTTP stack on WP7 DOES/DOES NOT support http compression?
thanks Michael
In response to my question on twitter "Do you know if it's possible to support gzip encoding for REST services?", Joe Marini (Principal Program Manager at Microsoft for Web platform on Windows Phone) replied "Yes, gzip is supported."
The longer answer is that compressed HTTP content is supported, but you can't change the Accept-Encoding header in an HTTP request to request that the response is compressed. However, if the response is compressed, then you can receive, decompress, and handle that response.
I'm currently working on a WP7 application that has exactly this problem, which we have worked round by using a different header to request a compressed response (X-Accept-Encoding), but this requires that the server understands this custom header.
You might the find the Hammock library useful; I think it supports GZIP compression via the X-Accept-Encoding.
精彩评论