2 // System.Net.HttpListenerResponseHelper
5 // Gonzalo Paniagua Javier (gonzalo@novell.com)
7 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
8 // Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 namespace System.Net {
31 // do not inline into HttpListenerResponse as this recursively brings everything that's
32 // reachable by IDisposable.Dispose (and that's quite a lot in this case).
33 static class HttpListenerResponseHelper {
35 internal static string GetStatusDescription (int code)
38 case 100: return "Continue";
39 case 101: return "Switching Protocols";
40 case 102: return "Processing";
41 case 200: return "OK";
42 case 201: return "Created";
43 case 202: return "Accepted";
44 case 203: return "Non-Authoritative Information";
45 case 204: return "No Content";
46 case 205: return "Reset Content";
47 case 206: return "Partial Content";
48 case 207: return "Multi-Status";
49 case 300: return "Multiple Choices";
50 case 301: return "Moved Permanently";
51 case 302: return "Found";
52 case 303: return "See Other";
53 case 304: return "Not Modified";
54 case 305: return "Use Proxy";
55 case 307: return "Temporary Redirect";
56 case 400: return "Bad Request";
57 case 401: return "Unauthorized";
58 case 402: return "Payment Required";
59 case 403: return "Forbidden";
60 case 404: return "Not Found";
61 case 405: return "Method Not Allowed";
62 case 406: return "Not Acceptable";
63 case 407: return "Proxy Authentication Required";
64 case 408: return "Request Timeout";
65 case 409: return "Conflict";
66 case 410: return "Gone";
67 case 411: return "Length Required";
68 case 412: return "Precondition Failed";
69 case 413: return "Request Entity Too Large";
70 case 414: return "Request-Uri Too Long";
71 case 415: return "Unsupported Media Type";
72 case 416: return "Requested Range Not Satisfiable";
73 case 417: return "Expectation Failed";
74 case 422: return "Unprocessable Entity";
75 case 423: return "Locked";
76 case 424: return "Failed Dependency";
77 case 500: return "Internal Server Error";
78 case 501: return "Not Implemented";
79 case 502: return "Bad Gateway";
80 case 503: return "Service Unavailable";
81 case 504: return "Gateway Timeout";
82 case 505: return "Http Version Not Supported";
83 case 507: return "Insufficient Storage";