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

follow_redirect option causes hackney error #240

Closed
pwightman opened this issue Apr 6, 2017 · 3 comments · Fixed by #244
Closed

follow_redirect option causes hackney error #240

pwightman opened this issue Apr 6, 2017 · 3 comments · Fixed by #244

Comments

@pwightman
Copy link

httpoison version: 0.11.1
elixir version: 1.3.4
OTP 19 [erts-8.2]

This is an error in hackney, but it affects httpoison in a simple request so I figured it might be worth tracking here too? hackney issue: benoitc/hackney#400

Using the follow_redirect option with a URL that redirects (https://google.com/ redirects to https://www.google.com/) fails inside hackney's header parsing.

Code:

HTTPoison.get("https://google.com/", [], follow_redirect: true)

Error:

** (FunctionClauseError) no function clause matching in :hackney_headers_new.do_fold/3
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney_headers_new.erl:147: :hackney_headers_new.do_fold([[{1, "Host", 119}], [{2, "Host", 119}], [{3, "Host", 119}], [{4, "Host", 46}], [{5, "Host", 103}], [{6, "Host", 111}], [{7, "Host", 111}], [{8, "Host", 103}], [{9, "Host", 108}], [{10, "Host", 101}], [{11, "Host", 46}], [{12, "Host", 99}], [{13, "Host", 111}], [{14, "Host", 109}]], #Function<6.29524015/3 in :hackney_headers_new.to_iolist/1>, [["User-Agent", ': ', "hackney/1.7.1", '\r\n']])
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney_headers_new.erl:184: :hackney_headers_new.to_iolist/1
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney_request.erl:95: :hackney_request.perform/2
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney.erl:373: :hackney.send_request/2
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney.erl:823: :hackney.redirect/2
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney.erl:757: :hackney.maybe_redirect1/3
      (hackney) /Users/parkerwightman/cs/ohi/deps/hackney/src/hackney.erl:377: :hackney.send_request/2
    (httpoison) lib/httpoison/base.ex:432: HTTPoison.Base.request/9
@pwightman pwightman changed the title follow_redirect cause hackney error follow_redirect causes hackney error Apr 6, 2017
@pwightman pwightman changed the title follow_redirect causes hackney error follow_redirect option causes hackney error Apr 6, 2017
@m1dnight
Copy link

I have same issue. The redirects work with cURL, though.

My particular URL is https://show.io/A6hL83mDL.

jknipp added a commit to spreedly/spreedly-elixir that referenced this issue Apr 17, 2017
Update Hackney version to 1.6.5 and required change to Httpoison 0.10.x
to support the Hackney update.

Note: 1.6.5 at this time is the last of the 1.6 non-retired versions and
there is a bug with 1.7.x that causes issues with InfluxDB / instream
preventing further upgrades.

See edgurgel/httpoison#240.
jknipp added a commit to spreedly/spreedly-elixir that referenced this issue Apr 17, 2017
Update Hackney version to 1.7 and required change to Httpoison 0.11.x
to support the Hackney update.

Note: If using the InfluxDB dep instream, you will need version >= 0.15
which patches a Hackney header issue.

See related issue edgurgel/httpoison#240.
@edevil
Copy link
Contributor

edevil commented Apr 20, 2017

FTR, hackney has been updated to 1.8.0 which fixes this issue benoitc/hackney@6046b34. Now, httpoison needs to bump it's hackney dependency version.

edevil added a commit to edevil/httpoison that referenced this issue Apr 20, 2017
Bump hackney version to fix edgurgel#240.
@edgurgel
Copy link
Owner

I will release a new version soon with this new version dependency. Thanks!

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

Successfully merging a pull request may close this issue.

4 participants