@cryptotaxi247 / netdata-1 / commits / aa40a3521

update http response code descriptions (#15379)

Costa Tsaousis committed Jul 13, 2023 at 16:28 UTC aa40a352108eb0af242600599304e555d0f34945
2 files changed +145 -16
libnetdata/buffer/buffer.h
+5
@@ -61,6 +61,11 @@ typedef enum __attribute__ ((__packed__)) {
61 CT_IMAGE_ICNS,
62 CT_IMAGE_BMP,
63 CT_PROMETHEUS,
64 + CT_AUDIO_MPEG,
65 + CT_AUDIO_OGG,
66 + CT_VIDEO_MP4,
67 + CT_APPLICATION_PDF,
68 + CT_APPLICATION_ZIP,
69 } HTTP_CONTENT_TYPE;
70
71 typedef struct web_buffer {
web/server/web_client.c
+140 -16
@@ -743,7 +743,7 @@ const char *web_content_type_to_string(HTTP_CONTENT_TYPE content_type) {
743 return "application/json; charset=utf-8";
744
745 case CT_APPLICATION_X_JAVASCRIPT:
746 - return "application/x-javascript; charset=utf-8";
746 + return "application/javascript; charset=utf-8";
747
748 case CT_TEXT_CSS:
749 return "text/css; charset=utf-8";
@@ -796,35 +796,159 @@ const char *web_content_type_to_string(HTTP_CONTENT_TYPE content_type) {
796 case CT_PROMETHEUS:
797 return "text/plain; version=0.0.4";
798
799 + case CT_AUDIO_MPEG:
800 + return "audio/mpeg";
801 +
802 + case CT_AUDIO_OGG:
803 + return "audio/ogg";
804 +
805 + case CT_VIDEO_MP4:
806 + return "video/mp4";
807 +
808 + case CT_APPLICATION_PDF:
809 + return "application/pdf";
810 +
811 + case CT_APPLICATION_ZIP:
812 + return "application/zip";
813 +
814 default:
815 case CT_TEXT_PLAIN:
816 return "text/plain; charset=utf-8";
817 }
818 }
819
805 -
820 const char *web_response_code_to_string(int code) {
821 switch(code) {
808 - case HTTP_RESP_OK:
822 + case 100:
823 + return "Continue";
824 + case 101:
825 + return "Switching Protocols";
826 + case 102:
827 + return "Processing";
828 + case 103:
829 + return "Early Hints";
830 +
831 + case 200:
832 return "OK";
810 -
811 - case HTTP_RESP_MOVED_PERM:
833 + case 201:
834 + return "Created";
835 + case 202:
836 + return "Accepted";
837 + case 203:
838 + return "Non-Authoritative Information";
839 + case 204:
840 + return "No Content";
841 + case 205:
842 + return "Reset Content";
843 + case 206:
844 + return "Partial Content";
845 + case 207:
846 + return "Multi-Status";
847 + case 208:
848 + return "Already Reported";
849 + case 226:
850 + return "IM Used";
851 +
852 + case 300:
853 + return "Multiple Choices";
854 + case 301:
855 return "Moved Permanently";
813 -
814 - case HTTP_RESP_REDIR_TEMP:
856 + case 302:
857 + return "Found";
858 + case 303:
859 + return "See Other";
860 + case 304:
861 + return "Not Modified";
862 + case 305:
863 + return "Use Proxy";
864 + case 306:
865 + return "Switch Proxy";
866 + case 307:
867 return "Temporary Redirect";
868 + case 308:
869 + return "Permanent Redirect";
870
817 - case HTTP_RESP_BAD_REQUEST:
871 + case 400:
872 return "Bad Request";
819 -
820 - case HTTP_RESP_FORBIDDEN:
873 + case 401:
874 + return "Unauthorized";
875 + case 402:
876 + return "Payment Required";
877 + case 403:
878 return "Forbidden";
822 -
823 - case HTTP_RESP_NOT_FOUND:
879 + case 404:
880 return "Not Found";
825 -
826 - case HTTP_RESP_PRECOND_FAIL:
827 - return "Preconditions Failed";
881 + case 405:
882 + return "Method Not Allowed";
883 + case 406:
884 + return "Not Acceptable";
885 + case 407:
886 + return "Proxy Authentication Required";
887 + case 408:
888 + return "Request Timeout";
889 + case 409:
890 + return "Conflict";
891 + case 410:
892 + return "Gone";
893 + case 411:
894 + return "Length Required";
895 + case 412:
896 + return "Precondition Failed";
897 + case 413:
898 + return "Payload Too Large";
899 + case 414:
900 + return "URI Too Long";
901 + case 415:
902 + return "Unsupported Media Type";
903 + case 416:
904 + return "Range Not Satisfiable";
905 + case 417:
906 + return "Expectation Failed";
907 + case 418:
908 + return "I'm a teapot";
909 + case 421:
910 + return "Misdirected Request";
911 + case 422:
912 + return "Unprocessable Entity";
913 + case 423:
914 + return "Locked";
915 + case 424:
916 + return "Failed Dependency";
917 + case 425:
918 + return "Too Early";
919 + case 426:
920 + return "Upgrade Required";
921 + case 428:
922 + return "Precondition Required";
923 + case 429:
924 + return "Too Many Requests";
925 + case 431:
926 + return "Request Header Fields Too Large";
927 + case 451:
928 + return "Unavailable For Legal Reasons";
929 +
930 + case 500:
931 + return "Internal Server Error";
932 + case 501:
933 + return "Not Implemented";
934 + case 502:
935 + return "Bad Gateway";
936 + case 503:
937 + return "Service Unavailable";
938 + case 504:
939 + return "Gateway Timeout";
940 + case 505:
941 + return "HTTP Version Not Supported";
942 + case 506:
943 + return "Variant Also Negotiates";
944 + case 507:
945 + return "Insufficient Storage";
946 + case 508:
947 + return "Loop Detected";
948 + case 510:
949 + return "Not Extended";
950 + case 511:
951 + return "Network Authentication Required";
952
953 default:
954 if(code >= 100 && code < 200)
@@ -837,7 +961,7 @@ const char *web_response_code_to_string(int code) {
961 return "Redirection";
962
963 if(code >= 400 && code < 500)
840 - return "Bad Request";
964 + return "Client Error";
965
966 if(code >= 500 && code < 600)
967 return "Server Error";