37 #include "lwip/memp.h"
55 "<html><head><title>Congrats!</title></head>"
56 "<body><h1>Welcome to our lwIP HTTP server!</h1>"
57 "<p>This is a small test page, served by httpd of "
58 "lwip.</p></body></html>";
88 if (xSemaphoreTake(*mx, 500) != pdTRUE) {
107 #elif defined(OS_UCOS_III)
111 #include "os_cfg_app.h"
138 static OS_MUTEX fsmutex;
140 OSMutexCreate(&fsmutex,
"DOS_FS_Mutex", &os_err);
179 const char *pszExt =
NULL;
187 hdrs[1] = g_psHTTPHeaderStrings[HTTP_HDR_SERVER];
191 if (( fName ==
NULL) || ( *fName == 0) ) {
192 hdrs[0] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_FOUND];
193 hdrs[2] = g_psHTTPHeaderStrings[DEFAULT_404_HTML];
200 if (strstr(fName,
"404")) {
201 iLoop = HTTP_HDR_NOT_FOUND;
203 else if (strstr(fName,
"400")) {
204 iLoop = HTTP_HDR_BAD_REQUEST;
206 else if (strstr(fName,
"501")) {
207 iLoop = HTTP_HDR_NOT_IMPL;
212 hdrs[0] = g_psHTTPHeaderStrings[iLoop];
216 pszExt = strrchr(fName,
'.');
221 if (pszExt ==
NULL) {
227 for (iLoop = 0; (iLoop < NUM_HTTP_HEADERS); iLoop++)
229 if (!strcmp(g_psHTTPHeaders[iLoop].extension, pszExt)) {
231 g_psHTTPHeaderStrings[g_psHTTPHeaders[iLoop].headerIndex];
236 if (iLoop == NUM_HTTP_HEADERS) {
238 hdrs[2] = g_psHTTPHeaderStrings[HTTP_HDR_DEFAULT_TYPE];
242 iLoop = strlen(hdrs[0]);
243 strcpy(buff, hdrs[0]);
244 strcat(buff, hdrs[1]);
245 strcat(buff, hdrs[2]);
256 if (
final == curr)
return;
258 if ((
final < 0) && (curr > 0)) {
277 NVIC_ClearPendingIRQ(SDIO_IRQn);
280 NVIC_EnableIRQ(SDIO_IRQn);
303 memset(&sdcardinfo, 0,
sizeof(sdcardinfo));
332 NVIC_DisableIRQ(SDIO_IRQn);
334 NVIC_EnableIRQ(SDIO_IRQn);
340 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: ERROR: Mutex Init!\r\n"));
354 fds = (
struct file_ds *)mem_malloc(
sizeof(*fds));
356 DEBUGSTR(
"Malloc Failure, Out of Memory!\r\n");
359 memset(fds, 0,
sizeof(*fds));
382 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: ERROR: Mutex Timeout!\r\n"));
385 memset(&tmpds, 0,
sizeof(tmpds));
390 LWIP_DEBUGF(HTTPD_DEBUG, (
"DFS: OPEN: File %s does not exist\r\n", name));
395 fds = (
struct file_ds *)mem_malloc(
sizeof(*fds));
397 DEBUGSTR(
"Malloc Failure, Out of Memory!\r\n");
401 memcpy(fds, &tmpds,
sizeof(*fds));
439 if (
f_read(&fds->
fi, (uint8_t *) buffer, count, &i))
464 NVIC_DisableIRQ(SDIO_IRQn);
472 void assert_printf(
char *msg,
int line,
char *file)
474 DEBUGOUT(
"ASSERT: %s at %s:%d\r\n", msg, file, line);
479 const char *lwip_strerr(err_t eno)