ban4jp -
/
uIP-1-0_webserver
uIP 1.0 based webserver for LPC1114 + ENC28J60
Diff: apps/webserver/httpd.cpp
- Revision:
- 3:a2715e9c7737
- Parent:
- 2:4da9ed411bdc
diff -r 4da9ed411bdc -r a2715e9c7737 apps/webserver/httpd.cpp --- a/apps/webserver/httpd.cpp Sat Jun 21 11:54:24 2014 +0000 +++ b/apps/webserver/httpd.cpp Mon Jun 30 16:00:08 2014 +0000 @@ -121,9 +121,14 @@ next_scriptstate(struct httpd_state *s) { char *p; - p = strchr(s->scriptptr, ISO_nl) + 1; - s->scriptlen -= (unsigned short)(p - s->scriptptr); - s->scriptptr = p; + + if((p = strchr(s->scriptptr, ISO_nl)) != NULL) { + p += 1; + s->scriptlen -= (unsigned short)(p - s->scriptptr); + s->scriptptr = p; + } else { + s->scriptlen = 0; + } } /*---------------------------------------------------------------------------*/ static @@ -274,7 +279,7 @@ strncpy(s->filename, http_index_html, sizeof(s->filename)); } else { s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename)); + strncpy(s->filename, s->inputbuf, sizeof(s->filename)); } /* httpd_log_file(uip_conn->ripaddr, s->filename);*/ @@ -340,7 +345,7 @@ extern "C" void httpd_init(void) { - uip_listen(HTONS(80)); + uip_listen(UIP_HTONS(80)); } /*---------------------------------------------------------------------------*/ /** @} */