http_message_constants.cc revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
153238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com// Copyright 2013 The Chromium Authors. All rights reserved.
253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com// Use of this source code is governed by a BSD-style license that can be
353238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com// found in the LICENSE file.
453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com
553238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com#include "net/tools/balsa/http_message_constants.h"
653238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com
753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.comnamespace net {
853238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com
953238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.comconst char* get_http_status_message(int status_message) {
1053238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  switch (status_message) {
1153238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com    case 100:
1253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com      return "Continue";
1376f10a3bd936af7dbe2b5873d5a7eedd73cdc5dareed@google.com    case 101:
1453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com      return "Switching Protocols";
154469938e92d779dff05e745559e67907bbf21e78reed@google.com    case 200:
164469938e92d779dff05e745559e67907bbf21e78reed@google.com      return "OK";
1753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com    case 201:
1815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Created";
1915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 202:
2015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Accepted";
2115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 203:
2215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Non-Authoritative Information";
2315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 204:
2415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "No Content";
2515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 205:
2615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Reset Content";
2715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 206:
2815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Partial Content";
2915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 300:
3015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Multiple Choices";
31969588f0c9030d5a4942085a4b5a5ea7e8d2bc25skia.committer@gmail.com    case 301:
3215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Moved Permanently";
3315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 302:
3415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Found";
3515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 303:
3615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "See Other";
3715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 304:
3815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Not Modified";
3915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 305:
4015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Use Proxy";
4115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 307:
4215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Temporary Redirect";
4315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 400:
4415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Bad Request";
4515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 401:
4615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Unauthorized";
4715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 402:
4828fcae2ec77eb16a79e155f8d788b20457f1c951commit-bot@chromium.org      return "Payment Required";
4915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 403:
5015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Forbidden";
5115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 404:
5215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Not Found";
5315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 405:
5415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Method Not Allowed";
5515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 406:
5615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Not Acceptable";
5715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 407:
5815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Proxy Authentication Required";
5915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 408:
6015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Request Time-out";
6115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 409:
6253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com      return "Conflict";
6353238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com    case 410:
6453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com      return "Gone";
6553238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com    case 411:
6615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Length Required";
6715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 412:
6815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Precondition Failed";
6953238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com    case 413:
7053238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com      return "Request Entity Too Large";
7115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 414:
7215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Request-URI Too Large";
7315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 415:
7415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Unsupported Media Type";
7515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 416:
7615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Requested range not satisfiable";
7715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 417:
7815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Expectation Failed";
7915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 500:
8015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Internal Server Error";
81a3264e53ee3f3c5d6a2c813df7e44b5b96d207f2commit-bot@chromium.org    case 501:
8215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Not Implemented";
8315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 502:
8415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Bad Gateway";
8515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 503:
8615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Service Unavailable";
8715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 504:
8815a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "Gateway Time-out";
8915a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org    case 505:
9015a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org      return "HTTP Version not supported";
9115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org  }
9253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  return "unknown";
9315a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org}
9415a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org
9515a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org////////////////////////////////////////////////////////////////////////////////
9615a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org
9715a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.orgconst int http_status_codes[] = {
9853238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  100,
9953238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  101,
100c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org  200,
101c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org  201,
102c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org  202,
103c3bd8af6d5722e854feca70c40d92f4954c5b67bcommit-bot@chromium.org  203,
10453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  204,
10553238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  205,
10653238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  206,
10753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  300,
10853238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  301,
10953238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  302,
11053238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  303,
11115a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org  304,
11215a140599942f70e47380e3f700a825c7cece3b4commit-bot@chromium.org  305,
11353238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  307,
11453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  400,
11553238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  401,
11653238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  402,
11753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  403,
11853238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  404,
11953238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  405,
12053238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  406,
12153238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  407,
12253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  408,
12353238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  409,
12453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  410,
12553238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  411,
12653238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  412,
12753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  413,
12853238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  414,
12953238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  415,
13053238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  416,
13153238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  417,
13253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  500,
13353238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  501,
13453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  502,
135ae761f7545d8ebf181d220169afac2056b057b8ccommit-bot@chromium.org  503,
13653238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  504,
13753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com  505
13853238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com};
139ae761f7545d8ebf181d220169afac2056b057b8ccommit-bot@chromium.org
1404cb543d6057b692e1099e9f115155f0bf323a0c8senorblanco@chromium.org////////////////////////////////////////////////////////////////////////////////
14153238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com
14253238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.comconst int http_status_code_count = sizeof(http_status_codes) /
14353238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com                                   sizeof(http_status_codes[0]);
14453238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com
145ae761f7545d8ebf181d220169afac2056b057b8ccommit-bot@chromium.org}  // namespace net
14653238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com
14753238bc96051d1774b7f72d3ebfd35a7dd4c04dfrobertphillips@google.com