mttkay / ignition

Kick-starts Android application development.
1.28k stars 290 forks source link

RemoteImageLoader: properly support servers which don't send a Content-Length header #12

Closed mlc closed 12 years ago

mlc commented 12 years ago

I noticed there was some code in RemoteImageLoaderJob which purported to deal with servers which fail to send a Content-Length header, but it didn't work properly. This patch fixes that.

Thanks so much!

jonson commented 12 years ago

I noticed this too, my local fix is almost identical -- code is def broken w/o this.

mttkay commented 12 years ago

Just checking, is this fully tested to work? If yes, I'll merge back as soon as the minor issue is fixed that I mentioned in the comment above.

Thanks!

mlc commented 12 years ago

I made the suggested logging change in mlc@9e6400f.

The image loader with the initial change is working great for me (we swapped out our old image loader and expect to put the new version of our app with Ignition into the market early next week).

If you want to test yourself, you should be able to visit http://z.mlcastle.net/test/image.jpeg to see an image with a Content-Length header or http://z.mlcastle.net/test/image.php to see the same image without one. (In production, we're talking to some sort of fancy cache which omits the Content-Length header the first time a file is requested but includes it on subsequent requests. But the silly two-line PHP script here seems to be able to replicate the issue.)

mttkay commented 12 years ago

Great, thanks!