summaryrefslogtreecommitdiff
path: root/spider_server/src/http_status.rs
diff options
context:
space:
mode:
Diffstat (limited to 'spider_server/src/http_status.rs')
-rw-r--r--spider_server/src/http_status.rs60
1 files changed, 60 insertions, 0 deletions
diff --git a/spider_server/src/http_status.rs b/spider_server/src/http_status.rs
new file mode 100644
index 0000000..0ea889e
--- /dev/null
+++ b/spider_server/src/http_status.rs
@@ -0,0 +1,60 @@
+pub fn get_status_text(code: u16) -> Option<String> {
+ match code {
+ 100 => Some(String::from("Continue")),
+ 101 => Some(String::from("Switching Protocols")),
+ 102 => Some(String::from("Processing")),
+ 200 => Some(String::from("OK")),
+ 201 => Some(String::from("Created")),
+ 202 => Some(String::from("Accepted")),
+ 203 => Some(String::from("Non Authoritative Information")),
+ 204 => Some(String::from("No Content")),
+ 205 => Some(String::from("Reset Content")),
+ 206 => Some(String::from("Partial Content")),
+ 207 => Some(String::from("Multi Status")),
+ 226 => Some(String::from("IM Used")),
+ 300 => Some(String::from("Multiple Choices")),
+ 301 => Some(String::from("Moved Permanently")),
+ 302 => Some(String::from("Found")),
+ 303 => Some(String::from("See Other")),
+ 304 => Some(String::from("Not Modified")),
+ 305 => Some(String::from("Use Proxy")),
+ 307 => Some(String::from("Temporary Redirect")),
+ 308 => Some(String::from("Permanent Redirect")),
+ 400 => Some(String::from("Bad Request")),
+ 401 => Some(String::from("Unauthorized")),
+ 402 => Some(String::from("Payment Required")),
+ 403 => Some(String::from("Forbidden")),
+ 404 => Some(String::from("Not Found")),
+ 405 => Some(String::from("Method Not Allowed")),
+ 406 => Some(String::from("Not Acceptable")),
+ 407 => Some(String::from("Proxy Authentication Required")),
+ 408 => Some(String::from("Request Timeout")),
+ 409 => Some(String::from("Conflict")),
+ 410 => Some(String::from("Gone")),
+ 411 => Some(String::from("Length Required")),
+ 412 => Some(String::from("Precondition Failed")),
+ 413 => Some(String::from("Request Entity Too Large")),
+ 414 => Some(String::from("Request URI Too Long")),
+ 415 => Some(String::from("Unsupported Media Type")),
+ 416 => Some(String::from("Requested Range Not Satisfiable")),
+ 417 => Some(String::from("Expectation Failed")),
+ 418 => Some(String::from("I'm a teapot")),
+ 421 => Some(String::from("Misdirected Request")),
+ 422 => Some(String::from("Unprocessable Entity")),
+ 423 => Some(String::from("Locked")),
+ 424 => Some(String::from("Failed Dependency")),
+ 426 => Some(String::from("Upgrade Required")),
+ 428 => Some(String::from("Precondition Required")),
+ 429 => Some(String::from("Too Many Requests")),
+ 431 => Some(String::from("Request Header Fields Too Large")),
+ 449 => Some(String::from("Retry With")),
+ 451 => Some(String::from("Unavailable For Legal Reasons")),
+ 500 => Some(String::from("Internal Server Error")),
+ 501 => Some(String::from("Not Implemented")),
+ 502 => Some(String::from("Bad Gateway")),
+ 503 => Some(String::from("Service Unavailable")),
+ 504 => Some(String::from("Gateway Timeout")),
+ 505 => Some(String::from("HTTP Version Not Supported")),
+ _ => None
+ }
+}