aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/http.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-12-11 12:24:21 +0000
committerWerner Koch <[email protected]>2018-12-11 12:40:26 +0000
commitb9d71ea64a694582739c18cfef9621b36d5371e9 (patch)
tree15be29cfe7fb479aea5021b2800ff9eccd8b3bbb /dirmngr/http.c
parentgpg: In search-keys return "Not found" instead of "No Data". (diff)
downloadgnupg-b9d71ea64a694582739c18cfef9621b36d5371e9.tar.gz
gnupg-b9d71ea64a694582739c18cfef9621b36d5371e9.zip
dirmngr: New function http_status2string.
* dirmngr/http.c (http_status2string): New. -- Right now only the standard 5xx codes. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit dc61f4ecea5c9815cb00aeb25439978337c1fd64)
Diffstat (limited to 'dirmngr/http.c')
-rw-r--r--dirmngr/http.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/dirmngr/http.c b/dirmngr/http.c
index d37faa87f..9f4afc848 100644
--- a/dirmngr/http.c
+++ b/dirmngr/http.c
@@ -3657,3 +3657,27 @@ http_prepare_redirect (http_redir_info_t *info, unsigned int status_code,
*r_url = newurl;
return 0;
}
+
+
+/* Return string describing the http STATUS. Returns an empty string
+ * for an unknown status. */
+const char *
+http_status2string (unsigned int status)
+{
+ switch (status)
+ {
+ case 500: return "Internal Server Error";
+ case 501: return "Not Implemented";
+ case 502: return "Bad Gateway";
+ case 503: return "Service Unavailable";
+ case 504: return "Gateway Timeout";
+ case 505: return "HTTP version Not Supported";
+ case 506: return "Variant Also Negation";
+ case 507: return "Insufficient Storage";
+ case 508: return "Loop Detected";
+ case 510: return "Not Extended";
+ case 511: return "Network Authentication Required";
+ }
+
+ return "";
+}