]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | // | |
7 | ||
8 | #ifndef BEAST_HTTP_REASON_HPP | |
9 | #define BEAST_HTTP_REASON_HPP | |
10 | ||
11 | #include <beast/config.hpp> | |
12 | ||
13 | namespace beast { | |
14 | namespace http { | |
15 | ||
16 | namespace detail { | |
17 | ||
18 | template<class = void> | |
19 | char const* | |
20 | reason_string(int status) | |
21 | { | |
22 | switch(status) | |
23 | { | |
24 | case 100: return "Continue"; | |
25 | case 101: return "Switching Protocols"; | |
26 | case 200: return "OK"; | |
27 | case 201: return "Created"; | |
28 | case 202: return "Accepted"; | |
29 | case 203: return "Non-Authoritative Information"; | |
30 | case 204: return "No Content"; | |
31 | case 205: return "Reset Content"; | |
32 | case 206: return "Partial Content"; | |
33 | case 300: return "Multiple Choices"; | |
34 | case 301: return "Moved Permanently"; | |
35 | case 302: return "Found"; | |
36 | case 303: return "See Other"; | |
37 | case 304: return "Not Modified"; | |
38 | case 305: return "Use Proxy"; | |
39 | case 307: return "Temporary Redirect"; | |
40 | case 400: return "Bad Request"; | |
41 | case 401: return "Unauthorized"; | |
42 | case 402: return "Payment Required"; | |
43 | case 403: return "Forbidden"; | |
44 | case 404: return "Not Found"; | |
45 | case 405: return "Method Not Allowed"; | |
46 | case 406: return "Not Acceptable"; | |
47 | case 407: return "Proxy Authentication Required"; | |
48 | case 408: return "Request Timeout"; | |
49 | case 409: return "Conflict"; | |
50 | case 410: return "Gone"; | |
51 | case 411: return "Length Required"; | |
52 | case 412: return "Precondition Failed"; | |
53 | case 413: return "Request Entity Too Large"; | |
54 | case 414: return "Request-URI Too Long"; | |
55 | case 415: return "Unsupported Media Type"; | |
56 | case 416: return "Requested Range Not Satisfiable"; | |
57 | case 417: return "Expectation Failed"; | |
58 | case 500: return "Internal Server Error"; | |
59 | case 501: return "Not Implemented"; | |
60 | case 502: return "Bad Gateway"; | |
61 | case 503: return "Service Unavailable"; | |
62 | case 504: return "Gateway Timeout"; | |
63 | case 505: return "HTTP Version Not Supported"; | |
64 | ||
65 | case 306: return "<reserved>"; | |
66 | default: | |
67 | break; | |
68 | } | |
69 | return "<unknown-status>"; | |
70 | } | |
71 | ||
72 | } // detail | |
73 | ||
74 | /** Returns the text for a known status code integer. */ | |
75 | inline | |
76 | char const* | |
77 | reason_string(int status) | |
78 | { | |
79 | return detail::reason_string(status); | |
80 | } | |
81 | ||
82 | } // http | |
83 | } // beast | |
84 | ||
85 | #endif |