处理压缩请求的 Yii 框架
我对 Yii 框架还很陌生,我需要一些处理压缩的帮助。我点击了这个链接http://www.yiiframework.com/wiki/39/,其中就像魅力一样!现在我的服务器正在压缩响应中的所有内容。
但是,我还通过 POST 将图像从客户端 (iPhone) 发送到服务器。我还将数据压缩到服务器。然而,当我在客户端打开压缩时,事情开始崩溃。服务器看到 POST 调用,但是看不到该调用的任何参数。我认为这是由于不了解压缩造成的。
我查看了代理上的流量,POST 看起来很好,数据也符合预期。
我需要做什么才能使服务器能够在压缩的情况下处理 POST 消息?
干杯, 延义
I am pretty new to the Yii framework, and I needs some help with dealing with compression. I followed this link http://www.yiiframework.com/wiki/39/, which works like a charm! Now my server is compressing everything in the responses.
However, I am also sending images from my client (iPhone) to the server through a POST. I am also compressing the data to the server. However, when I turn on the compression on the client side, things start to fall apart. The server sees the POST call, however, it does not see any of the parameters of the call. I think it is due to not understanding the compression.
I look at the traffic on a proxy, and the POST looks fine, and the data is also as expected.
What do I need to do to enable the server to be able to deal with the POST message with compression on?
Cheers,
Yenyi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
压缩 POST 上传的图像效率不是很高。请求的最大部分(99%+)是已经压缩的图像数据。添加额外的压缩可能会节省一些字节,并且会花费大量的资源来实现。压缩是一项 CPU 密集型任务,因此也会耗尽 iPhone 的电池电量。
HTTP 请求的客户端压缩很少见,并且大多数 Web 服务器不支持开箱即用。
阅读有关服务器端 gzip 压缩的问题:压缩内容PHP ob_start() 与 Apache Deflate/Gzip?
Compressing image POST uploads is not very efficient. The largest part (99%+) of the request is image data which is already compressed. Adding extra compression will save you maybe a few bytes and it will cost a lot of resources to implement. Compression is a CPU intensive task, so it will also drain the battery of the iPhone.
Client side compression for HTTP requests is rare and most web servers don't support it out of the box.
Read this question regarding server side gzip compression: Compressing content with PHP ob_start() vs Apache Deflate/Gzip?