Files
cweb/http/http_status.c
2024-11-07 12:02:29 +01:00

264 lines
8.5 KiB
C

#include "http_status.h"
#include <string.h>
void http_status_message(HttpStatus __status, char *msg, size_t __size) {
switch (__status) {
case HTTP_CONTINUE: {
char http_continue[] = "CONTINUE";
strlcpy(msg, http_continue, __size);
} break;
case HTTP_SWITCHING_PROTOCOLS: {
char http_switching_protocols[] = "SWITCHING PROTOCOLS";
strlcpy(msg, http_switching_protocols, __size);
} break;
case HTTP_PROCESSING: {
char http_processing[] = "PROCESSING";
strlcpy(msg, http_processing, __size);
} break;
case HTTP_EARLY_HINTS: {
char http_early_hints[] = "EARLY HINTS";
strlcpy(msg, http_early_hints, __size);
} break;
case HTTP_OK: {
char http_ok[] = "OK";
strlcpy(msg, http_ok, __size);
} break;
case HTTP_CREATED: {
char http_created[] = "CREATED";
strlcpy(msg, http_created, __size);
} break;
case HTTP_ACCEPTED: {
char http_accepted[] = "ACCEPTED";
strlcpy(msg, http_accepted, __size);
} break;
case HTTP_NON_AUTHORITATIVE_INFORMATION: {
char http_non_authoritative_information[] =
"NON AUTHORITATIVE INFORMATION";
strlcpy(msg, http_non_authoritative_information, __size);
} break;
case HTTP_NO_CONTENT: {
char http_no_content[] = "NO CONTENT";
strlcpy(msg, http_no_content, __size);
} break;
case HTTP_RESET_CONTENT: {
char http_reset_content[] = "RESET CONTENT";
strlcpy(msg, http_reset_content, __size);
} break;
case HTTP_PARTIAL_CONTENT: {
char http_partial_content[] = "PARTIAL CONTENT";
strlcpy(msg, http_partial_content, __size);
} break;
case HTTP_MULTI_STATUS: {
char http_multi_status[] = "MULTI STATUS";
strlcpy(msg, http_multi_status, __size);
} break;
case HTTP_ALREADY_REPORTED: {
char http_already_reported[] = "ALREADY REPORTED";
strlcpy(msg, http_already_reported, __size);
} break;
case HTTP_IM_USED: {
char http_im_used[] = "IM USED";
strlcpy(msg, http_im_used, __size);
} break;
case HTTP_MULTIPLE_CHOICES: {
char http_multiple_choices[] = "MULTIPLE CHOICES";
strlcpy(msg, http_multiple_choices, __size);
} break;
case HTTP_MOVED_PERMANENTLY: {
char http_moved_permanently[] = "MOVED PERMANENTLY";
strlcpy(msg, http_moved_permanently, __size);
} break;
case HTTP_FOUND: {
char http_found[] = "FOUND";
strlcpy(msg, http_found, __size);
} break;
case HTTP_SEE_OTHER: {
char http_see_other[] = "SEE OTHER";
strlcpy(msg, http_see_other, __size);
} break;
case HTTP_NOT_MODIFIED: {
char http_not_modified[] = "NOT MODIFIED";
strlcpy(msg, http_not_modified, __size);
} break;
case HTTP_USE_PROXY: {
char http_use_proxy[] = "USE PROXY";
strlcpy(msg, http_use_proxy, __size);
} break;
case HTTP_TEMPORARY_REDIRECT: {
char http_temporary_redirect[] = "TEMPORARY REDIRECT";
strlcpy(msg, http_temporary_redirect, __size);
} break;
case HTTP_PERMANENT_REDIRECT: {
char http_permanent_redirect[] = "PERMANENT REDIRECT";
strlcpy(msg, http_permanent_redirect, __size);
} break;
case HTTP_BAD_REQUEST: {
char http_bad_request[] = "BAD REQUEST";
strlcpy(msg, http_bad_request, __size);
} break;
case HTTP_UNAUTHORIZED: {
char http_unauthorized[] = "UNAUTHORIZED";
strlcpy(msg, http_unauthorized, __size);
} break;
case HTTP_PAYMENT_REQUIRED: {
char http_payment_required[] = "PAYMENT REQUIRED";
strlcpy(msg, http_payment_required, __size);
} break;
case HTTP_FORBIDDEN: {
char http_forbidden[] = "FORBIDDEN";
strlcpy(msg, http_forbidden, __size);
} break;
case HTTP_NOT_FOUND: {
char http_not_found[] = "NOT FOUND";
strlcpy(msg, http_not_found, __size);
} break;
case HTTP_METHOD_NOT_ALLOWED: {
char http_method_not_allowed[] = "METHOD NOT ALLOWED";
strlcpy(msg, http_method_not_allowed, __size);
} break;
case HTTP_NOT_ACCEPTABLE: {
char http_not_acceptable[] = "NOT ACCEPTABLE";
strlcpy(msg, http_not_acceptable, __size);
} break;
case HTTP_PROXY_AUTHENTICATION_REQUIRED: {
char http_proxy_authentication_required[] =
"PROXY AUTHENTICATION REQUIRED";
strlcpy(msg, http_proxy_authentication_required, __size);
} break;
case HTTP_REQUEST_TIMEOUT: {
char http_request_timeout[] = "REQUEST TIMEOUT";
strlcpy(msg, http_request_timeout, __size);
} break;
case HTTP_CONFLICT: {
char http_conflict[] = "CONFLICT";
strlcpy(msg, http_conflict, __size);
} break;
case HTTP_GONE: {
char http_gone[] = "GONE";
strlcpy(msg, http_gone, __size);
} break;
case HTTP_LENGTH_REQUIRED: {
char http_length_required[] = "LENGTH REQUIRED";
strlcpy(msg, http_length_required, __size);
} break;
case HTTP_PRECONDITION_FAILED: {
char http_precondition_failed[] = "PRECONDITION FAILED";
strlcpy(msg, http_precondition_failed, __size);
} break;
case HTTP_PAYLOAD_TOO_LARGE: {
char http_payload_too_large[] = "PAYLOAD TOO LARGE";
strlcpy(msg, http_payload_too_large, __size);
} break;
case HTTP_URI_TOO_LONG: {
char http_uri_too_long[] = "URI TOO LONG";
strlcpy(msg, http_uri_too_long, __size);
} break;
case HTTP_UNSUPPORTED_MEDIA_TYPE: {
char http_unsupported_media_type[] = "UNSUPPORTED MEDIA TYPE";
strlcpy(msg, http_unsupported_media_type, __size);
} break;
case HTTP_RANGE_NOT_SATISFIABLE: {
char http_range_not_satisfiable[] = "RANGE NOT SATISFIABLE";
strlcpy(msg, http_range_not_satisfiable, __size);
} break;
case HTTP_EXPECTATION_FAILED: {
char http_expectation_failed[] = "EXPECTATION FAILED";
strlcpy(msg, http_expectation_failed, __size);
} break;
case HTTP_IM_A_TEAPOT: {
char http_im_a_teapot[] = "IM A TEAPOT";
strlcpy(msg, http_im_a_teapot, __size);
} break;
case HTTP_MISDIRECTED_REQUEST: {
char http_misdirected_request[] = "MISDIRECTED REQUEST";
strlcpy(msg, http_misdirected_request, __size);
} break;
case HTTP_UNPROCESSABLE_ENTITY: {
char http_unprocessable_entity[] = "UNPROCESSABLE ENTITY";
strlcpy(msg, http_unprocessable_entity, __size);
} break;
case HTTP_LOCKED: {
char http_locked[] = "LOCKED";
strlcpy(msg, http_locked, __size);
} break;
case HTTP_FAILED_DEPENDENCY: {
char http_failed_dependency[] = "FAILED DEPENDENCY";
strlcpy(msg, http_failed_dependency, __size);
} break;
case HTTP_TOO_EARLY: {
char http_too_early[] = "TOO EARLY";
strlcpy(msg, http_too_early, __size);
} break;
case HTTP_UPGRADE_REQUIRED: {
char http_upgrade_required[] = "UPGRADE REQUIRED";
strlcpy(msg, http_upgrade_required, __size);
} break;
case HTTP_PRECONDITION_REQUIRED: {
char http_precondition_required[] = "PRECONDITION REQUIRED";
strlcpy(msg, http_precondition_required, __size);
} break;
case HTTP_TOO_MANY_REQUESTS: {
char http_too_many_requests[] = "TOO MANY REQUESTS";
strlcpy(msg, http_too_many_requests, __size);
} break;
case HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE: {
char http_request_header_fields_too_large[] =
"REQUEST HEADER FIELDS TOO LARGE";
strlcpy(msg, http_request_header_fields_too_large, __size);
} break;
case HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: {
char http_unavailable_for_legal_reasons[] =
"UNAVAILABLE FOR LEGAL REASONS";
strlcpy(msg, http_unavailable_for_legal_reasons, __size);
} break;
case HTTP_INTERNAL_SERVER_ERROR: {
char http_internal_server_error[] = "INTERNAL SERVER ERROR";
strlcpy(msg, http_internal_server_error, __size);
} break;
case HTTP_NOT_IMPLEMENTED: {
char http_not_implemented[] = "NOT IMPLEMENTED";
strlcpy(msg, http_not_implemented, __size);
} break;
case HTTP_BAD_GATEWAY: {
char http_bad_gateway[] = "BAD GATEWAY";
strlcpy(msg, http_bad_gateway, __size);
} break;
case HTTP_SERVICE_UNAVAILABLE: {
char http_service_unavailable[] = "SERVICE UNAVAILABLE";
strlcpy(msg, http_service_unavailable, __size);
} break;
case HTTP_GATEWAY_TIMEOUT: {
char http_gateway_timeout[] = "GATEWAY TIMEOUT";
strlcpy(msg, http_gateway_timeout, __size);
} break;
case HTTP_HTTP_VERSION_NOT_SUPPORTED: {
char http_http_version_not_supported[] = "HTTP VERSION NOT SUPPORTED";
strlcpy(msg, http_http_version_not_supported, __size);
} break;
case HTTP_VARIANT_ALSO_NEGOTIATES: {
char http_variant_also_negotiates[] = "VARIANT ALSO NEGOTIATES";
strlcpy(msg, http_variant_also_negotiates, __size);
} break;
case HTTP_INSUFFICIENT_STORAGE: {
char http_insufficient_storage[] = "INSUFFICIENT STORAGE";
strlcpy(msg, http_insufficient_storage, __size);
} break;
case HTTP_LOOP_DETECTED: {
char http_loop_detected[] = "LOOP DETECTED";
strlcpy(msg, http_loop_detected, __size);
} break;
case HTTP_NOT_EXTENDED: {
char http_not_extended[] = "NOT EXTENDED";
strlcpy(msg, http_not_extended, __size);
} break;
case HTTP_NETWORK_AUTHENTICATION_REQUIRED: {
char http_network_authentication_required[] =
"NETWORK AUTHENTICATION REQUIRED";
strlcpy(msg, http_network_authentication_required, __size);
} break;
}
}