HttpStatusDescription.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace SocketHttpListener.Net
  7. {
  8. internal static class HttpStatusDescription
  9. {
  10. internal static string Get(HttpStatusCode code)
  11. {
  12. return Get((int)code);
  13. }
  14. internal static string Get(int code)
  15. {
  16. switch (code)
  17. {
  18. case 100: return "Continue";
  19. case 101: return "Switching Protocols";
  20. case 102: return "Processing";
  21. case 200: return "OK";
  22. case 201: return "Created";
  23. case 202: return "Accepted";
  24. case 203: return "Non-Authoritative Information";
  25. case 204: return "No Content";
  26. case 205: return "Reset Content";
  27. case 206: return "Partial Content";
  28. case 207: return "Multi-Status";
  29. case 300: return "Multiple Choices";
  30. case 301: return "Moved Permanently";
  31. case 302: return "Found";
  32. case 303: return "See Other";
  33. case 304: return "Not Modified";
  34. case 305: return "Use Proxy";
  35. case 307: return "Temporary Redirect";
  36. case 400: return "Bad Request";
  37. case 401: return "Unauthorized";
  38. case 402: return "Payment Required";
  39. case 403: return "Forbidden";
  40. case 404: return "Not Found";
  41. case 405: return "Method Not Allowed";
  42. case 406: return "Not Acceptable";
  43. case 407: return "Proxy Authentication Required";
  44. case 408: return "Request Timeout";
  45. case 409: return "Conflict";
  46. case 410: return "Gone";
  47. case 411: return "Length Required";
  48. case 412: return "Precondition Failed";
  49. case 413: return "Request Entity Too Large";
  50. case 414: return "Request-Uri Too Long";
  51. case 415: return "Unsupported Media Type";
  52. case 416: return "Requested Range Not Satisfiable";
  53. case 417: return "Expectation Failed";
  54. case 422: return "Unprocessable Entity";
  55. case 423: return "Locked";
  56. case 424: return "Failed Dependency";
  57. case 426: return "Upgrade Required"; // RFC 2817
  58. case 500: return "Internal Server Error";
  59. case 501: return "Not Implemented";
  60. case 502: return "Bad Gateway";
  61. case 503: return "Service Unavailable";
  62. case 504: return "Gateway Timeout";
  63. case 505: return "Http Version Not Supported";
  64. case 507: return "Insufficient Storage";
  65. }
  66. return null;
  67. }
  68. }
  69. }