From cf112ec26e7006e629729e6c7f82b5a17a5945c2 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 6 Feb 2018 19:28:37 -0800 Subject: [PATCH] ircd::http: Better handling of unrecognized HTTP status code to reason string. --- ircd/http.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ircd/http.cc b/ircd/http.cc index 306aa3f02..832593e74 100644 --- a/ircd/http.cc +++ b/ircd/http.cc @@ -888,6 +888,16 @@ ircd::http::status(const string_view &str) ircd::string_view ircd::http::status(const enum code &code) +try { return reason.at(code); } +catch(const std::out_of_range &e) +{ + log::warning + { + "No reason string for HTTP status code %d", int(code) + }; + + return ""_sv; +}