~w(content-type content-disposition content-encoding content-range accept-ranges vary)
@default_cache_control_header "public, max-age=1209600"
@valid_resp_codes [200, 206, 304]
- @max_read_duration :timer.minutes(2)
+ @max_read_duration :timer.seconds(30)
@max_body_length :infinity
@methods ~w(GET HEAD)
end
with {:ok, code, headers, client} <- request(method, url, req_headers, hackney_opts),
- :ok <- header_lenght_constraint(headers, Keyword.get(opts, :max_body_length)) do
+ :ok <- header_length_constraint(headers, Keyword.get(opts, :max_body_length)) do
response(conn, client, url, code, headers, opts)
else
{:ok, code, headers} ->
end
end
- defp header_lenght_constraint(headers, limit) when is_integer(limit) and limit > 0 do
+ defp header_length_constraint(headers, limit) when is_integer(limit) and limit > 0 do
with {_, size} <- List.keyfind(headers, "content-length", 0),
{size, _} <- Integer.parse(size),
true <- size <= limit do
end
end
- defp header_lenght_constraint(_, _), do: :ok
+ defp header_length_constraint(_, _), do: :ok
defp body_size_constraint(size, limit) when is_integer(limit) and limit > 0 and size >= limit do
{:error, :body_too_large}