且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Restkit加载gzip压缩的json

更新时间:2023-02-16 20:00:01

您可以使用HTTP代理(如Charles)发布标头中的内容吗?

Can you post what's in your headers using an HTTP Proxy (like Charles)?

您可能需要在邮寄电话中修改您的请求标头".

You may need to modify your "request headers" in the post call.

确保您的防火墙能够接受POST呼叫.这可能是一个https问题.

Make sure your firewall is able to accept POST calls. This might be an https issue.

您可能需要将服务器配置为始终根据扩展名类型以GZIP和DEFLATE返回响应.这是基于此处的( http://betterexplained .com/articles/如何优化带有gzip压缩的网站/).

You may need to configure your server to always return the response as a GZIP and DEFLATE based on the extension type. This is based on here (http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/).

示例:

# compress json format in .htaccess (for apache servers):
AddOutputFilterByType DEFLATE application/json

您可以在此处找到"mod_deflate"文档( http://httpd .apache.org/docs/2.0/mod/mod_deflate.html )

You can find the 'mod_deflate' documentation here (http://httpd.apache.org/docs/2.0/mod/mod_deflate.html)

如果您可以发布传出标头,这也将很有用,因为它们应包括:

If you can post the outgoing headers, that would also be useful, as they should include:

Accept-Encoding: gzip, deflate

类似的问题

奇怪的"406 not accept"错误

https://serverfault. com/questions/183843/content-length-not-sent-send-when-gzip-compression-enabled-in-apache

请确保您也这样做:

[[RKClient sharedClient] setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];

或这个

[[RKClient sharedClient] setValue:@"gzip, deflate" forHTTPHeaderField:@"Accept-Encoding"];

这应将标头的值设置为接受"gzip"以对响应进行编码.我注意到了以下github问题:

This should set the value of your header to accept "gzip" for encoding the response. I noticed these github issues:

https://github.com/RestKit/RestKit/issues/511