For a project I am using Httpoison.Async in stream_to in order to handle large files without loading the download in memory first. However, I am experiencing an issue which seems to only affect downloading a redirected link to Github. Could not find the same issue using Google. Has anyone experienced this before and knows a solution?
Relevant code which triggers the error: https://github.com/benoitc/hackney/blob/5b51fb82547dd3a492aaac5d63f7aa1ada1e65cf/src/hackney_stream.erl#L29
{:unknown_error, {{:error, {:case_clause, {:more, {:client, {1518, 24733,
397001},
{:metrics_ng, :metrics_dummy},
:hackney_ssl, 'github.com',
443, "github.com", [
:async,
{:stream_to,
#PID<0.5401.0>},
{:max_redirect, 12},
{:follow_redirect, true},
{:ssl_options, [
versions: [:"tlsv1.2"]
]},
{:recv_timeout, 120000},
{:connect_timeout, 120000},
:insecure
], {:sslsocket, {:gen_tcp,
#Port<0.20301>,
:tls_connection,
:undefined},
#PID<0.5387.0>},
{:default,
#Reference<0.855242680.2168717314.205030>,
{'github.com', 443,
:hackney_ssl},
#PID<0.653.0>,
:hackney_ssl},
#Reference<0.855242680.2168717314.205030>,
true, :hackney_pool, 120000,
true, 12, false, 12, nil,
"https://raw.githubusercontent.com/[cut]",
{:hparser, :response, 4096,
10, 0, :on_header,
"Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src render.githubusercontent.com; connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.g",
{1, 1}, "", [], :undefined,
"", "",
"text/html; charset=utf-8",
"https://raw.githubusercontent.com/[cut]",
:waiting}, {0, {:dict, 0,
16, 16, 8,
80, 48, {[],
[],
[],
[],
[],
[],
[],
[],
[],
...},
{{[], [],
[], [],
[], [],
[],
...}}}},
:connected, :on_header, nil,
:normal, false, true, false,
:undefined, #PID<0.5401.0>,
&:hackney_request.send/2,
:waiting, nil, 4096, "", [
{"Expect-CT",
"max-age=2592000, report-uri=\"https://api.github.com/_private/browser/errors\""},
{"X-Runtime", "0.050706"},
{"X-UA-Compatible", ...},
{...},
...
], {1, 1}, nil, nil, nil,
...}, ""}}, [
{:hackney_stream, :maybe_redirect, 6, [
file: '/[cut]/deps/hackney/src/hackney_stream.erl',
line: 174
]},
{:hackney_stream, :init, 4, [
file: '[cut]/deps/hackney/src/hackney_stream.erl',
line: 32
]},
{:proc_lib, :init_p_do_apply, 3, [
file: 'proc_lib.erl',
line: 247
]}
]}, 'An unexpected error occurred.'}}