Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
httpd_structs.h
00001 #ifndef LWIP_HTTPD_STRUCTS_H 00002 #define LWIP_HTTPD_STRUCTS_H 00003 00004 #include "lwip/apps/httpd.h" 00005 00006 #if LWIP_HTTPD_DYNAMIC_HEADERS 00007 /** This struct is used for a list of HTTP header strings for various 00008 * filename extensions. */ 00009 typedef struct { 00010 const char *extension; 00011 const char *content_type; 00012 } tHTTPHeader; 00013 00014 /** A list of strings used in HTTP headers (see RFC 1945 HTTP/1.0 and 00015 * RFC 2616 HTTP/1.1 for header field definitions) */ 00016 static const char *const g_psHTTPHeaderStrings[] = { 00017 "HTTP/1.0 200 OK\r\n", 00018 "HTTP/1.0 404 File not found\r\n", 00019 "HTTP/1.0 400 Bad Request\r\n", 00020 "HTTP/1.0 501 Not Implemented\r\n", 00021 "HTTP/1.1 200 OK\r\n", 00022 "HTTP/1.1 404 File not found\r\n", 00023 "HTTP/1.1 400 Bad Request\r\n", 00024 "HTTP/1.1 501 Not Implemented\r\n", 00025 "Content-Length: ", 00026 "Connection: Close\r\n", 00027 "Connection: keep-alive\r\n", 00028 "Connection: keep-alive\r\nContent-Length: ", 00029 "Server: "HTTPD_SERVER_AGENT"\r\n", 00030 "\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n" 00031 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE 00032 , "Connection: keep-alive\r\nContent-Length: 77\r\n\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n" 00033 #endif 00034 }; 00035 00036 /* Indexes into the g_psHTTPHeaderStrings array */ 00037 #define HTTP_HDR_OK 0 /* 200 OK */ 00038 #define HTTP_HDR_NOT_FOUND 1 /* 404 File not found */ 00039 #define HTTP_HDR_BAD_REQUEST 2 /* 400 Bad request */ 00040 #define HTTP_HDR_NOT_IMPL 3 /* 501 Not Implemented */ 00041 #define HTTP_HDR_OK_11 4 /* 200 OK */ 00042 #define HTTP_HDR_NOT_FOUND_11 5 /* 404 File not found */ 00043 #define HTTP_HDR_BAD_REQUEST_11 6 /* 400 Bad request */ 00044 #define HTTP_HDR_NOT_IMPL_11 7 /* 501 Not Implemented */ 00045 #define HTTP_HDR_CONTENT_LENGTH 8 /* Content-Length: (HTTP 1.0)*/ 00046 #define HTTP_HDR_CONN_CLOSE 9 /* Connection: Close (HTTP 1.1) */ 00047 #define HTTP_HDR_CONN_KEEPALIVE 10 /* Connection: keep-alive (HTTP 1.1) */ 00048 #define HTTP_HDR_KEEPALIVE_LEN 11 /* Connection: keep-alive + Content-Length: (HTTP 1.1)*/ 00049 #define HTTP_HDR_SERVER 12 /* Server: HTTPD_SERVER_AGENT */ 00050 #define DEFAULT_404_HTML 13 /* default 404 body */ 00051 #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE 00052 #define DEFAULT_404_HTML_PERSISTENT 14 /* default 404 body, but including Connection: keep-alive */ 00053 #endif 00054 00055 #define HTTP_CONTENT_TYPE(contenttype) "Content-Type: "contenttype"\r\n\r\n" 00056 #define HTTP_CONTENT_TYPE_ENCODING(contenttype, encoding) "Content-Type: "contenttype"\r\nContent-Encoding: "encoding"\r\n\r\n" 00057 00058 #define HTTP_HDR_HTML HTTP_CONTENT_TYPE("text/html") 00059 #define HTTP_HDR_SSI HTTP_CONTENT_TYPE("text/html\r\nExpires: Fri, 10 Apr 2008 14:00:00 GMT\r\nPragma: no-cache") 00060 #define HTTP_HDR_GIF HTTP_CONTENT_TYPE("image/gif") 00061 #define HTTP_HDR_PNG HTTP_CONTENT_TYPE("image/png") 00062 #define HTTP_HDR_JPG HTTP_CONTENT_TYPE("image/jpeg") 00063 #define HTTP_HDR_BMP HTTP_CONTENT_TYPE("image/bmp") 00064 #define HTTP_HDR_ICO HTTP_CONTENT_TYPE("image/x-icon") 00065 #define HTTP_HDR_APP HTTP_CONTENT_TYPE("application/octet-stream") 00066 #define HTTP_HDR_JS HTTP_CONTENT_TYPE("application/javascript") 00067 #define HTTP_HDR_RA HTTP_CONTENT_TYPE("application/javascript") 00068 #define HTTP_HDR_CSS HTTP_CONTENT_TYPE("text/css") 00069 #define HTTP_HDR_SWF HTTP_CONTENT_TYPE("application/x-shockwave-flash") 00070 #define HTTP_HDR_XML HTTP_CONTENT_TYPE("text/xml") 00071 #define HTTP_HDR_PDF HTTP_CONTENT_TYPE("application/pdf") 00072 #define HTTP_HDR_JSON HTTP_CONTENT_TYPE("application/json") 00073 #define HTTP_HDR_CSV HTTP_CONTENT_TYPE("text/csv") 00074 #define HTTP_HDR_TSV HTTP_CONTENT_TYPE("text/tsv") 00075 #define HTTP_HDR_SVG HTTP_CONTENT_TYPE("image/svg+xml") 00076 #define HTTP_HDR_SVGZ HTTP_CONTENT_TYPE_ENCODING("image/svg+xml", "gzip") 00077 00078 #define HTTP_HDR_DEFAULT_TYPE HTTP_CONTENT_TYPE("text/plain") 00079 00080 /** A list of extension-to-HTTP header strings (see outdated RFC 1700 MEDIA TYPES 00081 * and http://www.iana.org/assignments/media-types for registered content types 00082 * and subtypes) */ 00083 static const tHTTPHeader g_psHTTPHeaders[] = { 00084 { "html", HTTP_HDR_HTML}, 00085 { "htm", HTTP_HDR_HTML}, 00086 { "shtml", HTTP_HDR_SSI}, 00087 { "shtm", HTTP_HDR_SSI}, 00088 { "ssi", HTTP_HDR_SSI}, 00089 { "gif", HTTP_HDR_GIF}, 00090 { "png", HTTP_HDR_PNG}, 00091 { "jpg", HTTP_HDR_JPG}, 00092 { "bmp", HTTP_HDR_BMP}, 00093 { "ico", HTTP_HDR_ICO}, 00094 { "class", HTTP_HDR_APP}, 00095 { "cls", HTTP_HDR_APP}, 00096 { "js", HTTP_HDR_JS}, 00097 { "ram", HTTP_HDR_RA}, 00098 { "css", HTTP_HDR_CSS}, 00099 { "swf", HTTP_HDR_SWF}, 00100 { "xml", HTTP_HDR_XML}, 00101 { "xsl", HTTP_HDR_XML}, 00102 { "pdf", HTTP_HDR_PDF}, 00103 { "json", HTTP_HDR_JSON} 00104 #ifdef HTTPD_ADDITIONAL_CONTENT_TYPES 00105 /* If you need to add content types not listed here: 00106 * #define HTTPD_ADDITIONAL_CONTENT_TYPES {"ct1", HTTP_CONTENT_TYPE("text/ct1")}, {"exe", HTTP_CONTENT_TYPE("application/exe")} 00107 */ 00108 , HTTPD_ADDITIONAL_CONTENT_TYPES 00109 #endif 00110 }; 00111 00112 #define NUM_HTTP_HEADERS LWIP_ARRAYSIZE(g_psHTTPHeaders) 00113 00114 #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */ 00115 00116 #if LWIP_HTTPD_SSI 00117 static const char *const g_pcSSIExtensions[] = { 00118 ".shtml", ".shtm", ".ssi", ".xml", ".json" 00119 }; 00120 #define NUM_SHTML_EXTENSIONS LWIP_ARRAYSIZE(g_pcSSIExtensions) 00121 #endif /* LWIP_HTTPD_SSI */ 00122 00123 #endif /* LWIP_HTTPD_STRUCTS_H */
Generated on Tue Jul 12 2022 13:54:24 by
