#include "http.h" // Very important that this is in the same order as http_request_method const char *request_method_names[] = {"GET", "POST", "PUT", "PATCH", "DELETE"}; const size_t request_method_names_len = sizeof(request_method_names) / sizeof(request_method_names[0]); // clang-format off const char *http_response_type_names[][32] = { // 1xx { "Continue", // 100 "Switching Protocols", // 101, "Processing", // 102 "Early Hints", // 103 }, // 2xx { "OK", // 200 "Created", // 201 "Accepted", // 202 "Non-Authoritative Information", // 203 "No Content", // 204 "Reset Content", // 205 "Partial Content", // 206 "Multi-Status", // 207 "Already Reported", // 208 }, // 3xx { "Multiple Choices", // 300 "Moved Permanently", // 301 "Found", // 302 "See Other", // 303 "Not Modified", // 304 NULL, // 305 NULL, // 306 "Temporary Redirect", // 307 "Permanent Redirect", // 308 }, // 4xx { "Bad Request", // 400 "Unauthorized", // 401 "Payment Required", // 402 "Forbidden", // 403 "Not Found", // 404 "Method Not Allowed", // 405 "Not Acceptable", // 406 "Proxy Authentication Required", // 407 "Request Timeout", // 408 "Conflict", // 409 "Gone", // 410 "Length Required", // 411 "Precondition Failed", // 412 "Content Too Large", // 413 "URI Too Long", // 414 "Unsupported Media Type", // 415 "Range Not Satisfiable", // 416 "Expectation Failed", // 417 "I'm a teapot", // 418 NULL, // 419 NULL, // 420 "Misdirected Request", // 421 "Unprocessable Content", // 422 "Locked", // 423 "Failed Dependency", // 424 "Too Early", // 425 "Upgrade Required", // 426 NULL, // 427 "Precondition Required", // 428 "Too Many Requests", // 429 NULL, // 430 "Request Header Fields Too Large", // 431 }, // 5xx { "Internal Server Error", // 500 "Not Implemented", // 501 "Bad Gateway", // 502 "Service Unavailable", // 503 "Gateway Timeout", // 504 "HTTP Version Not Supported", // 505 "Variant Also Negotiates", // 506 "Insufficient Storage", // 507 "Loop Detected", // 508 NULL, // 509 "Not Extended", // 510 "Network Authentication Required" // 511 }, }; const char *http_header_names[] = { "Connection", "Location", "Content-Type" }; const char *http_mime_type_names[][2] = { { "aac", "audio/aac" }, { "bz", "application/x-bzip" }, { "bz2", "application/x-bzip2" }, { "css", "text/css" }, { "csv", "text/csv" }, { "gz", "application/gzip" }, { "gif", "image/gif" }, { "htm", "text/html" }, { "html", "text/html" }, { "jar", "application/java-archive" }, { "jpeg", "image/jpeg" }, { "jpg", "image/jpeg" }, { "js", "text/javascript" }, { "json", "application/json" }, { "mp3", "audio/mpeg" }, { "mp4", "video/mp4" }, { "png", "image/png" }, { "pdf", "application/pdf" }, { "rar", "application/vnd.rar" }, { "sh", "application/x-sh" }, { "svg", "image/svg+xml" }, { "tar", "application/x-tar" }, { "txt", "text/plain" }, { "wav", "audio/wav" }, { "7z", "application/x-7z-compressed" }, }; // clang-format on