HttpStatusDescription.cs 2.8 KB

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