传输编码:在Windows Phone的分块 [英] Transfer-Encoding: chunked in Windows Phone
问题描述
我有Transfer-Encoding的服务器响应:分块
I have a server response with Transfer-Encoding: chunked
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Mon, 18 Feb 2013 08:22:49 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
c7
{<some json data>}
0
在JSON数据请参阅C7块大小
See that c7 chunk size before json data.
我如何读取原始响应流,而无需使用 HttpWebResponse
?
How can I read a raw response stream without chunks in Windows Phone using HttpWebResponse
?
提示:使断绝禁用分块的输出,我只需要指定HTTP / 1.0协议的版本。但我不知道该怎么做,因为没有在的HttpWebRequest
类没有 ProtocolVersion
属性的Windows Phone或Silverlight
Hint: to make sever disable chunked output, I just have to specify HTTP/1.0 protocol version. But I don't know how to do that as there is no ProtocolVersion
property in HttpWebRequest
class in Windows Phone or Silverlight
推荐答案
的HttpClient
能够解析分块自动输出
的http:// MSDN。 microsoft.com/en-us/library/system.net.http.httpclient(v=vs.110).aspx
HttpClient
is able to parse chunked output automatically
http://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.110).aspx
HttpClient的
是PostAsync和GetAsinc和吨的其他善良的整体很酷的事情。
我从来没有,以后再使用HttpWebRequest的。
HttpClient
is an overall cool thing with PostAsync and GetAsinc and tons of other goodness.
I never-ever use HttpWebRequest again.
的HttpClient
是.NET框架4.5一应俱全, Windows 8或Windows Phone的8.1
HttpClient
is readily available in .NET Framework 4.5, Windows 8, or Windows Phone 8.1
使用的NuGet包的 http://www.nuget.org/packages/Microsoft.Net.Http ,如果你需要的HttpClient在
- .NET Framework 4的
- 的Windows Phone的Silverlight 7.5
- Silverlight 4的
- 便携式类库
Use NuGet package http://www.nuget.org/packages/Microsoft.Net.Http if you need HttpClient in - .NET Framework 4 - Windows Phone Silverlight 7.5 - Silverlight 4 - Portable Class Libraries
这篇关于传输编码:在Windows Phone的分块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!