From 0f9f81e9fa9c19d687765fcd53359b8e55b29aa8 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 9 Sep 2021 11:17:13 +0300 Subject: [PATCH] Http: Add cloudflare 5XX status code strings --- src/Http.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Http.cpp b/src/Http.cpp index 3ac754c..f9e452a 100644 --- a/src/Http.cpp +++ b/src/Http.cpp @@ -82,7 +82,7 @@ std::string Http::GET(const std::string& host, int port, const std::string& targ if (status) { *status = res.base().result_int(); } - + // ignore ec // If we get here then the connection is closed gracefully @@ -270,12 +270,22 @@ static std::map Map = { { 508, "Loop Detected" }, { 510, "Not Extended" }, { 511, "Network Authentication Required" }, + // cloudflare status codes + { 520, "(CDN) Web Server Returns An Unknown Error" }, + { 521, "(CDN) Web Server Is Down" }, + { 522, "(CDN) Connection Timed Out" }, + { 523, "(CDN) Origin Is Unreachable" }, + { 524, "(CDN) A Timeout Occurred" }, + { 525, "(CDN) SSL Handshake Failed" }, + { 526, "(CDN) Invalid SSL Certificate" }, + { 527, "(CDN) Railgun Listener To Origin Error" }, + { 530, "(CDN) 1XXX Internal Error" }, }; std::string Http::Status::ToString(int code) { if (Map.find(code) != Map.end()) { return Map.at(code); } else { - return "Unassigned"; + return std::to_string(code); } }