为什么我的移动运营商重新连接code文件当我下载了吗? [英] why does my mobile carrier re-encode a file when I download it?

查看:119
本文介绍了为什么我的移动运营商重新连接code文件当我下载了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在Android的一个很奇怪的现象。我发现,在3G之后计算的SHA1下载图像时是比它应该是occording到的是服务器上的文件不同。经进一步调查,我发现图像实际上减小尺寸并重新连接codeD。这样看来,我的移动运营商(Verizon公司)正试图优化我是下载文件。下面是一些统计数据的文件和的下载之一。

I have found a very strange occurrence in android. I have found that when downloading an image over 3g the sha1 computed afterwards is different than what it should have been occording to the file that is on the server. Upon further investigation, I found that the image was actually down sized and re-encoded. It would appear that my mobile carrier (verizon) is trying to optimize files that i'm downloading. Here are some stats for the original file, and the downloaded one.

我的问题是,任何人都可以证实,移动网络它的土地在设备上之前,可能会优化您的文件?如果是这样,有没有设置不知何故地方,这样我可以禁用它。

My question is, can anyone else confirm that mobile networks might optimize your file before it lands on your device? And if so, is there a setting somewhere somehow so that I can disable this.

要知道,我已经下载什么文件的SHA1等于什么服务器说它应该是它在我的应用程序非常重要的。

It's very important in my app to know that the file's sha1 of what I've downloaded equals what the server says it should be.

下面是发现了一个一篇关于Verizon的优化3克传输。

Here's an article found about verizon optimizing 3g transfers.

推荐答案

您没有说,但是让我们假设这是一个HTTP连接。

You didn't say, but let's assume this is an HTTP connection.

总之,他们这样做是为了节省带宽。 3G是不是免费的!

In short, they are doing it to save bandwidth. 3G isn't Free!

如果您是直接请求资源(GET),那么你是在处理该HTTP响应所有中介机构(即代理,网关)的怜悯,你可以肯定,他们可以看到头的MIME类型,相应的行为。

If you are directly requesting resources (GET), then you are at the mercy of all intermediaries that process the HTTP response (i.e. proxies, gateways), and you can be sure they can see the MIME type in the headers, and behave accordingly.

您可以尝试使用HTTP 接受头在你的请求,并使用参数设置为提示你想要最大的保真度。

You can try using the HTTP Accept header in your request, and use the q parameter to "hint" that you want maximum fidelity.

http://www.w3.org/Protocols/rfc2616/rfc2616- sec14.html

Accept: image/png;q=1

的取值范围从0到1您可以用较低的值就完事了(大于1)。请阅读详细信息链接的部分。

The q ranges from 0 to 1. You may be able to get away with a lower value (than 1). Please read the linked section for more details.

您还可以检查传入内容类型头;如果有质量甚至MIME类型的申报改变它可能揭示。这可能是告诉你它的所作所为!

You can also inspect the incoming Content-Type header; it may reveal if there's a "declared" change in quality or even MIME type. It may be telling you what it did!

这将是优秀的,如果标准,它的工作适合你!

It would be excellent if the "standard" does its job for you!

如果不工作,你是在服务器端控制已经使用备用的基于文本的编码它,像Base64的,中介机构不能COM preSS为您服务。 SOAP已经这样做,因为永远!

If that doesn't work, and you are in control of the server end already, use an alternate text-based encoding for it, like Base64, that intermediaries cannot "compress" for you. SOAP has been doing that since ever!

如果你真的真的需要绕过影像融为一体pression和接受不工作,你必须代理那些类型的请求自己,并重新连接code它们与非图像的MIME类型的响应

If you really really need to bypass image compression, and Accept doesn't work, you must proxy those kinds of requests yourself, and re-encode them with a non-image MIME type in the response.

如果您打算自代理路线,你很可能与调用您的图像脱身应用程序/ octect流这是MIME类型uninter preTED字节。这将允许数据的更多或更少的直通,并希望保持中介机构援助之手把你的东西!

If you are going the self-proxy route, you could probably get away with calling your images application/octect-stream which is the MIME type for "uninterpreted bytes". This would allow for more-or-less pass-through of the data, and hopefully keep intermediaries "helping hands" off your stuff!

这篇关于为什么我的移动运营商重新连接code文件当我下载了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆