1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/tools/flip_server/http_message_constants.h"
6
7 namespace net {
8
get_http_status_message(int status_message)9 const char* get_http_status_message(int status_message) {
10 switch (status_message) {
11 case 100:
12 return "Continue";
13 case 101:
14 return "Switching Protocols";
15 case 200:
16 return "OK";
17 case 201:
18 return "Created";
19 case 202:
20 return "Accepted";
21 case 203:
22 return "Non-Authoritative Information";
23 case 204:
24 return "No Content";
25 case 205:
26 return "Reset Content";
27 case 206:
28 return "Partial Content";
29 case 300:
30 return "Multiple Choices";
31 case 301:
32 return "Moved Permanently";
33 case 302:
34 return "Found";
35 case 303:
36 return "See Other";
37 case 304:
38 return "Not Modified";
39 case 305:
40 return "Use Proxy";
41 case 307:
42 return "Temporary Redirect";
43 case 400:
44 return "Bad Request";
45 case 401:
46 return "Unauthorized";
47 case 402:
48 return "Payment Required";
49 case 403:
50 return "Forbidden";
51 case 404:
52 return "Not Found";
53 case 405:
54 return "Method Not Allowed";
55 case 406:
56 return "Not Acceptable";
57 case 407:
58 return "Proxy Authentication Required";
59 case 408:
60 return "Request Time-out";
61 case 409:
62 return "Conflict";
63 case 410:
64 return "Gone";
65 case 411:
66 return "Length Required";
67 case 412:
68 return "Precondition Failed";
69 case 413:
70 return "Request Entity Too Large";
71 case 414:
72 return "Request-URI Too Large";
73 case 415:
74 return "Unsupported Media Type";
75 case 416:
76 return "Requested range not satisfiable";
77 case 417:
78 return "Expectation Failed";
79 case 500:
80 return "Internal Server Error";
81 case 501:
82 return "Not Implemented";
83 case 502:
84 return "Bad Gateway";
85 case 503:
86 return "Service Unavailable";
87 case 504:
88 return "Gateway Time-out";
89 case 505:
90 return "HTTP Version not supported";
91 }
92 return "unknown";
93 }
94
95 ////////////////////////////////////////////////////////////////////////////////
96
97 const int http_status_codes[] = {
98 100,
99 101,
100 200,
101 201,
102 202,
103 203,
104 204,
105 205,
106 206,
107 300,
108 301,
109 302,
110 303,
111 304,
112 305,
113 307,
114 400,
115 401,
116 402,
117 403,
118 404,
119 405,
120 406,
121 407,
122 408,
123 409,
124 410,
125 411,
126 412,
127 413,
128 414,
129 415,
130 416,
131 417,
132 500,
133 501,
134 502,
135 503,
136 504,
137 505
138 };
139
140 ////////////////////////////////////////////////////////////////////////////////
141
142 const int http_status_code_count = sizeof(http_status_codes) /
143 sizeof(http_status_codes[0]);
144
145 } // namespace net
146
147