39 #include "lpc43xx_dualcore_config.h"
41 #include "httpd_structs.h"
56 "<html><head><title>Congrats!</title></head>"
57 "<body><h1>Welcome to our lwIP HTTP server!</h1>"
58 "<p>This is a small test page, served by httpd of "
59 "lwip.</p></body></html>";
81 if (xSemaphoreTake(*mx, 500) != pdTRUE) {
100 #elif defined(OS_UCOS_III)
104 #include "os_cfg_app.h"
113 OSMutexPend(mx, 500, OS_OPT_PEND_BLOCKING, &ts, &os_err);
114 if (os_err != OS_ERR_NONE) {
125 OSMutexPost(mx, OS_OPT_POST_NONE, &os_err);
132 OSMutexCreate(&open_lock,
"DOS_FS_Mutex", &os_err);
133 if (os_err == OS_ERR_NONE) {
170 const char *pszExt =
NULL;
178 hdrs[1] = g_psHTTPHeaderStrings[HTTP_HDR_SERVER];
182 if (( fName ==
NULL) || ( *fName == 0) ) {
183 hdrs[0] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_FOUND];
184 hdrs[2] = g_psHTTPHeaderStrings[DEFAULT_404_HTML];
191 if (strstr(fName,
"404")) {
192 iLoop = HTTP_HDR_NOT_FOUND;
194 else if (strstr(fName,
"400")) {
195 iLoop = HTTP_HDR_BAD_REQUEST;
197 else if (strstr(fName,
"501")) {
198 iLoop = HTTP_HDR_NOT_IMPL;
203 hdrs[0] = g_psHTTPHeaderStrings[iLoop];
207 pszExt = strrchr(fName,
'.');
212 if (pszExt ==
NULL) {
218 for (iLoop = 0; (iLoop < NUM_HTTP_HEADERS); iLoop++)
220 if (!strcmp(g_psHTTPHeaders[iLoop].extension, pszExt)) {
222 g_psHTTPHeaderStrings[g_psHTTPHeaders[iLoop].headerIndex];
227 if (iLoop == NUM_HTTP_HEADERS) {
229 hdrs[2] = g_psHTTPHeaderStrings[HTTP_HDR_DEFAULT_TYPE];
233 iLoop = strlen(hdrs[0]);
234 strcpy(buff, hdrs[0]);
235 strcat(buff, hdrs[1]);
236 strcat(buff, hdrs[2]);
273 fds = malloc(
sizeof(*fds));
275 DEBUGSTR(
"Malloc Failure, Out of Memory!\r\n");
278 memset(fds, 0,
sizeof(*fds));
280 fs->pextension = (
void *) fds;
282 fs->data = (
const char *) fds->
scratch;
286 fs->http_header_included = 1;
307 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: ERROR: Mutex Init!\r\n"));
312 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: ERROR: Mutex Timeout!\r\n"));
315 memset(&tmpds, 0,
sizeof(tmpds));
319 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: VOLUME: Read Error!\r\n"));
325 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: OPEN: File %s does not exist\r\n", name));
330 fds = malloc(
sizeof(*fds));
332 DEBUGSTR(
"Malloc Failure, Out of Memory!\r\n");
336 memcpy(fds, &tmpds,
sizeof(*fds));
340 fs->pextension = (
void *) fds;
342 fs->data = (
const char *) fds->
scratch;
345 fs->http_header_included = 1;
359 free(file->pextension);
370 int fs_read(
struct fs_file *file,
char *buffer,
int count)
387 return file->len - file->index;
399 void assert_printf(
char *msg,
int line,
char *file)
401 DEBUGOUT(
"ASSERT: %s at %s:%d\r\n", msg, file, line);
409 const char *lwip_strerr(err_t eno)