OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_HTTP_HTTP_STATUS_CODE_H_ | 5 #ifndef NET_HTTP_HTTP_STATUS_CODE_H_ |
6 #define NET_HTTP_HTTP_STATUS_CODE_H_ | 6 #define NET_HTTP_HTTP_STATUS_CODE_H_ |
7 | 7 |
8 #include "net/base/net_export.h" | 8 #include "net/base/net_export.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 // HTTP status codes. | 12 // HTTP status codes. |
13 // Taken from RFC 2616 Section 10. | |
14 enum HttpStatusCode { | 13 enum HttpStatusCode { |
15 // Informational 1xx | |
16 HTTP_CONTINUE = 100, | |
17 HTTP_SWITCHING_PROTOCOLS = 101, | |
18 | 14 |
19 // Successful 2xx | 15 #define HTTP_STATUS(label, code, reason) HTTP_ ## label = code, |
20 HTTP_OK = 200, | 16 #include "net/http/http_status_code_list.h" |
21 HTTP_CREATED = 201, | 17 #undef HTTP_STATUS |
22 HTTP_ACCEPTED = 202, | |
23 HTTP_NON_AUTHORITATIVE_INFORMATION = 203, | |
24 HTTP_NO_CONTENT = 204, | |
25 HTTP_RESET_CONTENT = 205, | |
26 HTTP_PARTIAL_CONTENT = 206, | |
27 | 18 |
28 // Redirection 3xx | |
29 HTTP_MULTIPLE_CHOICES = 300, | |
30 HTTP_MOVED_PERMANENTLY = 301, | |
31 HTTP_FOUND = 302, | |
32 HTTP_SEE_OTHER = 303, | |
33 HTTP_NOT_MODIFIED = 304, | |
34 HTTP_USE_PROXY = 305, | |
35 // 306 is no longer used. | |
36 HTTP_TEMPORARY_REDIRECT = 307, | |
37 | |
38 // Client error 4xx | |
39 HTTP_BAD_REQUEST = 400, | |
40 HTTP_UNAUTHORIZED = 401, | |
41 HTTP_PAYMENT_REQUIRED = 402, | |
42 HTTP_FORBIDDEN = 403, | |
43 HTTP_NOT_FOUND = 404, | |
44 HTTP_METHOD_NOT_ALLOWED = 405, | |
45 HTTP_NOT_ACCEPTABLE = 406, | |
46 HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, | |
47 HTTP_REQUEST_TIMEOUT = 408, | |
48 HTTP_CONFLICT = 409, | |
49 HTTP_GONE = 410, | |
50 HTTP_LENGTH_REQUIRED = 411, | |
51 HTTP_PRECONDITION_FAILED = 412, | |
52 HTTP_REQUEST_ENTITY_TOO_LARGE = 413, | |
53 HTTP_REQUEST_URI_TOO_LONG = 414, | |
54 HTTP_UNSUPPORTED_MEDIA_TYPE = 415, | |
55 HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416, | |
56 HTTP_EXPECTATION_FAILED = 417, | |
57 | |
58 // Server error 5xx | |
59 HTTP_INTERNAL_SERVER_ERROR = 500, | |
60 HTTP_NOT_IMPLEMENTED = 501, | |
61 HTTP_BAD_GATEWAY = 502, | |
62 HTTP_SERVICE_UNAVAILABLE = 503, | |
63 HTTP_GATEWAY_TIMEOUT = 504, | |
64 HTTP_VERSION_NOT_SUPPORTED = 505, | |
65 }; | 19 }; |
66 | 20 |
67 // Returns the corresponding HTTP status description to use in the Reason-Phrase | 21 // Returns the corresponding HTTP status description to use in the Reason-Phrase |
68 // field in an HTTP response for given |code|. It's based on the IANA HTTP | 22 // field in an HTTP response for given |code|. It's based on the IANA HTTP |
69 // Status Code Registry. | 23 // Status Code Registry. |
70 // http://www.iana.org/assignments/http-status-codes/http-status-codes.xml | 24 // http://www.iana.org/assignments/http-status-codes/http-status-codes.xml |
71 // | 25 // |
72 // This function doesn't cover all codes defined above. It returns an empty | 26 // This function doesn't cover all codes defined in the registry. It returns an |
wtc
2013/06/07 21:24:18
doesn't cover => may not cover
registry => IANA r
tyoshino (SeeGerritForStatus)
2013/06/10 06:14:00
Done
| |
73 // string (or crash in debug build) for status codes which are not yet covered | 27 // empty string (or crash in debug build) for status codes which are not yet |
74 // or just invalid. Please extend it when needed. | 28 // covered or just invalid. Please extend it when needed. |
75 NET_EXPORT const char* GetHttpReasonPhrase(HttpStatusCode code); | 29 NET_EXPORT const char* GetHttpReasonPhrase(HttpStatusCode code); |
76 | 30 |
77 } // namespace net | 31 } // namespace net |
78 | 32 |
79 #endif // NET_HTTP_HTTP_STATUS_CODE_H_ | 33 #endif // NET_HTTP_HTTP_STATUS_CODE_H_ |
OLD | NEW |