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