Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on Redirects - Request Failed 302 #119

Closed
alenz316 opened this issue Sep 5, 2014 · 8 comments · Fixed by #125
Closed

Fails on Redirects - Request Failed 302 #119

alenz316 opened this issue Sep 5, 2014 · 8 comments · Fixed by #125
Assignees
Labels
Milestone

Comments

@alenz316
Copy link

alenz316 commented Sep 5, 2014

Glide does not follow redirects (302).

Sample:
Glide fails when trying to get Facebook profile pics through the Graph endpoint.

http://graph.facebook.com/zuck/picture?width=144&height=144
    java.io.IOException: Request failed 302: forced.302
            at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:50)
            at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:14)
            at com.bumptech.glide.load.model.ImageVideoModelLoader$ImageVideoFetcher.loadData(ImageVideoModelLoader.java:69)
            at com.bumptech.glide.load.model.ImageVideoModelLoader$ImageVideoFetcher.loadData(ImageVideoModelLoader.java:52)
            at com.bumptech.glide.load.engine.SourceResourceRunner.decodeFromSource(SourceResourceRunner.java:175)
            at com.bumptech.glide.load.engine.SourceResourceRunner.runWrapped(SourceResourceRunner.java:141)
            at com.bumptech.glide.load.engine.SourceResourceRunner.run(SourceResourceRunner.java:123)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)
            at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:52)
@sjudd sjudd self-assigned this Sep 6, 2014
@sjudd
Copy link
Collaborator

sjudd commented Sep 6, 2014

Turns out it fails specifically on http to https redirects. The above url you gave redirects to https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/v/t1.0-1/c14.4.153.153/1939620_10101266232851011_437577509_n.jpg?oh=568bd6cf288e4c7eca82012c47d1c5f3&oe=54A8F19F&__gda__=1419608114_f3addf5b726616c11a72bbde9434c502

The HttpUrlConnection docs indicate that it normally follows up to 5 redirects, but not http to https redirects.

Thanks for reporting this, I'll continue to look in to it.

@sjudd
Copy link
Collaborator

sjudd commented Sep 6, 2014

In the meantime you can fix this by changing to using https: http://graph.facebook.com/zuck/picture?width=144&height=144. Maybe checkout return_ssl_resources here: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1

@TWiStErRob
Copy link
Collaborator

Can volley or okhttp help?

@alenz316
Copy link
Author

alenz316 commented Sep 6, 2014

Using OkHttp seems to fix the issue. Thanks for pointing that our @TWiStErRob.

@sjudd
Copy link
Collaborator

sjudd commented Sep 6, 2014

Thanks for looking in to this @alenz316 and @TWiStErRob. I have a fix for the default version, but I'm trying to look more into the security implications of following http -> https redirects. I assume HttpUrlConnection disables these by default for a reason. Glad to know OkHttp works.

@sjudd sjudd added this to the 3.3.1 milestone Sep 7, 2014
@sjudd sjudd closed this as completed in #125 Sep 9, 2014
@sjudd
Copy link
Collaborator

sjudd commented Sep 9, 2014

As @bubbleguuum pointed out, this doesn't handle relative redirects, re-opening.

@sjudd sjudd reopened this Sep 9, 2014
sjudd added a commit to sjudd/glide that referenced this issue Sep 9, 2014
@sjudd sjudd added the bug label Sep 10, 2014
@sjudd sjudd closed this as completed in 4679c6e Sep 10, 2014
@DeanSingh
Copy link

I was still getting this crash or perhaps similiar when DLing a Facebook Image URL https://graph.facebook.com/10155197719330646/picture?width=200&height=200. Using any other ImageURL works.

I tried upgrading and OKHTTP, Glide, and Glide OKHTTP Integration to latest and it still crashes on the Facebook URL.

Any ideas?

@sjudd
Copy link
Collaborator

sjudd commented Mar 11, 2015

Can you file a new issue and fill out the template (you can find a link to the template in CONTRIBUTORS.md)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants