by supz_k · 2y ago · 0 comments
The code in question, simplified:
defp try_get_request?(%Link{method: :head}, %StatusResponse{} = response) do
# Per HTTP specification, the HEAD response should be functionally equivalent to a
# GET, but shall not contain any body.
# Not all servers respect this, so might have a different status response on HEAD than on GET.
#
# We assume that some HTTP status codes are suspicious and worth retrying.
#
# HTTP 520 is seen with Cloudflare to mean "Web Server Returned an Unknown Error", possibly
# in response to a HEAD request.
response.code in [403, 404, 405, 520]
end