+/*
+ * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/StatusCode.h"
+#include "SquidConfig.h"
const char *
Http::StatusCodeString(const Http::StatusCode status)
// 000
case Http::scNone:
- return "Init"; /* we init .status with code 0 */
+ return "Init"; /* we init .status with code 0 */
break;
// 100-199
return "Processing";
break;
+ case Http::scEarlyHints: // 103
+ return "Early Hints";
+ break;
+
// 200-299
case Http::scOkay:
return "OK";
return "Precondition Failed";
break;
- case Http::scPayloadTooLarge:
- return "Payload Too Large";
+ case Http::scContentTooLarge:
+ return "Content Too Large";
break;
case Http::scUriTooLong:
return "Expectation Failed";
break;
+ case Http::scMisdirectedRequest:
+ return "Misdirected Request";
+ break;
+
case Http::scUnprocessableEntity:
return "Unprocessable Entity";
break;
return "Request Header Fields Too Large";
break;
+ case scUnavailableForLegalReasons:
+ return "Unavailable For Legal Reasons";
+ break;
+
// 500-599
case Http::scInternalServerError:
return "Internal Server Error";
// 600+
case Http::scInvalidHeader:
case Http::scHeaderTooLarge:
- // fall through to default.
+ // fall through to default.
default:
debugs(57, 3, "Unassigned HTTP status code: " << status);
}
return "Unassigned";
}
+
+bool
+Http::IsReforwardableStatus(const StatusCode s)
+{
+ switch (s) {
+
+ case scBadGateway:
+ case scGatewayTimeout:
+ return true;
+
+ case scForbidden:
+ case scInternalServerError:
+ case scNotImplemented:
+ case scServiceUnavailable:
+ return Config.retry.onerror;
+
+ default:
+ return false;
+ }
+
+ /* NOTREACHED */
+}
+