Made cfs-based webserver example compatible with 8.3 file systems.
This commit is contained in:
parent
8631ae8515
commit
cd24e920b6
|
@ -10,6 +10,7 @@ http_texthtml "text/html"
|
|||
http_location "location: "
|
||||
http_host "host: "
|
||||
http_crnl "\r\n"
|
||||
http_index_htm "/index.htm"
|
||||
http_index_html "/index.html"
|
||||
http_404_html "/404.html"
|
||||
http_referer "Referer:"
|
||||
|
|
|
@ -34,6 +34,9 @@ const char http_host[7] =
|
|||
const char http_crnl[3] =
|
||||
/* "\r\n" */
|
||||
{0xd, 0xa, };
|
||||
const char http_index_htm[11] =
|
||||
/* "/index.htm" */
|
||||
{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, };
|
||||
const char http_index_html[12] =
|
||||
/* "/index.html" */
|
||||
{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, };
|
||||
|
|
|
@ -10,6 +10,7 @@ extern const char http_texthtml[10];
|
|||
extern const char http_location[11];
|
||||
extern const char http_host[7];
|
||||
extern const char http_crnl[3];
|
||||
extern const char http_index_htm[11];
|
||||
extern const char http_index_html[12];
|
||||
extern const char http_404_html[10];
|
||||
extern const char http_referer[9];
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: httpd-cfs.c,v 1.23 2010/08/30 19:44:38 oliverschmidt Exp $
|
||||
* $Id: httpd-cfs.c,v 1.24 2010/09/28 20:40:52 oliverschmidt Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -141,7 +141,7 @@ PT_THREAD(handle_output(struct httpd_state *s))
|
|||
s->fd = cfs_open(&s->filename[1], CFS_READ);
|
||||
petsciiconv_toascii(s->filename, sizeof(s->filename));
|
||||
if(s->fd < 0) {
|
||||
strcpy(s->filename, "/notfound.html");
|
||||
strcpy(s->filename, "/notfound.htm");
|
||||
s->fd = cfs_open(&s->filename[1], CFS_READ);
|
||||
petsciiconv_toascii(s->filename, sizeof(s->filename));
|
||||
PT_WAIT_THREAD(&s->outputpt,
|
||||
|
@ -150,10 +150,10 @@ PT_THREAD(handle_output(struct httpd_state *s))
|
|||
PT_WAIT_THREAD(&s->outputpt,
|
||||
send_string(s, "not found"));
|
||||
uip_close();
|
||||
webserver_log_file(&uip_conn->ripaddr, "404 (no notfound.html)");
|
||||
webserver_log_file(&uip_conn->ripaddr, "404 (no notfound.htm)");
|
||||
PT_EXIT(&s->outputpt);
|
||||
}
|
||||
webserver_log_file(&uip_conn->ripaddr, "404 - notfound.html");
|
||||
webserver_log_file(&uip_conn->ripaddr, "404 - notfound.htm");
|
||||
} else {
|
||||
PT_WAIT_THREAD(&s->outputpt,
|
||||
send_headers(s, http_header_200));
|
||||
|
@ -186,7 +186,7 @@ PT_THREAD(handle_input(struct httpd_state *s))
|
|||
urlconv_tofilename(s->filename, s->inputbuf, sizeof(s->filename));
|
||||
#else /* URLCONV */
|
||||
if(s->inputbuf[1] == ISO_space) {
|
||||
strncpy(s->filename, http_index_html, sizeof(s->filename));
|
||||
strncpy(s->filename, http_index_htm, sizeof(s->filename));
|
||||
} else {
|
||||
s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;
|
||||
strncpy(s->filename, s->inputbuf, sizeof(s->filename));
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Kajtar Zsolt <soci@c64.rulez.org>
|
||||
*
|
||||
* $Id: urlconv.c,v 1.2 2010/08/30 19:44:38 oliverschmidt Exp $
|
||||
* $Id: urlconv.c,v 1.3 2010/09/28 20:40:52 oliverschmidt Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -140,7 +140,7 @@ urlconv_tofilename(char *dest, char *source, unsigned char maxlen)
|
|||
}
|
||||
} while(c);
|
||||
if(*to == ISO_slash && (len + sizeof(http_index_html) - 3) < maxlen) {
|
||||
strcpy(to, http_index_html); // add index.html
|
||||
strcpy(to, http_index_htm); // add index.htm
|
||||
} else {
|
||||
++to;
|
||||
*to = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
# Author: Oliver Schmidt <ol.sc@web.de>
|
||||
#
|
||||
# $Id: Makefile.apple2enh,v 1.17 2010/09/28 19:36:16 oliverschmidt Exp $
|
||||
# $Id: Makefile.apple2enh,v 1.18 2010/09/28 20:40:52 oliverschmidt Exp $
|
||||
#
|
||||
|
||||
CONTIKI_SOURCEFILES += pfs.S
|
||||
|
@ -66,8 +66,8 @@ ifeq ($(findstring WITH_MOUSE,$(DEFINES)),WITH_MOUSE)
|
|||
java -jar $(AC) -p contiki.dsk a2e.stdmou.mou rel 0 < $(CC65_HOME)/mou/a2e.stdmou.mou
|
||||
endif
|
||||
ifeq ($(HTTPD-CFS),1)
|
||||
java -jar $(AC) -p contiki.dsk index.html bin 0 < httpd-cfs/index.html
|
||||
java -jar $(AC) -p contiki.dsk index.htm bin 0 < httpd-cfs/index.htm
|
||||
java -jar $(AC) -p contiki.dsk backgrnd.gif bin 0 < httpd-cfs/backgrnd.gif
|
||||
java -jar $(AC) -p contiki.dsk contiki.gif bin 0 < httpd-cfs/contiki.gif
|
||||
java -jar $(AC) -p contiki.dsk notfound.html bin 0 < httpd-cfs/notfound.html
|
||||
java -jar $(AC) -p contiki.dsk notfound.htm bin 0 < httpd-cfs/notfound.htm
|
||||
endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
# Author: Oliver Schmidt <ol.sc@web.de>
|
||||
#
|
||||
# $Id: Makefile.c128,v 1.12 2010/09/28 19:36:16 oliverschmidt Exp $
|
||||
# $Id: Makefile.c128,v 1.13 2010/09/28 20:40:53 oliverschmidt Exp $
|
||||
#
|
||||
|
||||
CONTIKI_SOURCEFILES += pfs.S pfs_write.S
|
||||
|
@ -57,8 +57,8 @@ ifeq ($(findstring WITH_MOUSE,$(DEFINES)),WITH_MOUSE)
|
|||
$(C1541) -attach contiki.d71 -write $(CC65_HOME)/mou/c128-1351.mou c128-1351.mou,u
|
||||
endif
|
||||
ifeq ($(HTTPD-CFS),1)
|
||||
$(C1541) -attach contiki.d71 -write httpd-cfs/index.html index.html,u
|
||||
$(C1541) -attach contiki.d71 -write httpd-cfs/index.htm index.htm,u
|
||||
$(C1541) -attach contiki.d71 -write httpd-cfs/backgrnd.gif backgrnd.gif,u
|
||||
$(C1541) -attach contiki.d71 -write httpd-cfs/contiki.gif contiki.gif,u
|
||||
$(C1541) -attach contiki.d71 -write httpd-cfs/notfound.html notfound.html,u
|
||||
$(C1541) -attach contiki.d71 -write httpd-cfs/notfound.htm notfound.htm,u
|
||||
endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
# Author: Oliver Schmidt <ol.sc@web.de>
|
||||
#
|
||||
# $Id: Makefile.c64,v 1.14 2010/09/28 19:36:16 oliverschmidt Exp $
|
||||
# $Id: Makefile.c64,v 1.15 2010/09/28 20:40:53 oliverschmidt Exp $
|
||||
#
|
||||
|
||||
CONTIKI_SOURCEFILES += pfs.S pfs_write.S
|
||||
|
@ -57,8 +57,8 @@ ifeq ($(findstring WITH_MOUSE,$(DEFINES)),WITH_MOUSE)
|
|||
$(C1541) -attach contiki.d64 -write $(CC65_HOME)/mou/c64-1351.mou c64-1351.mou,u
|
||||
endif
|
||||
ifeq ($(HTTPD-CFS),1)
|
||||
$(C1541) -attach contiki.d64 -write httpd-cfs/index.html index.html,u
|
||||
$(C1541) -attach contiki.d64 -write httpd-cfs/index.htm index.htm,u
|
||||
$(C1541) -attach contiki.d64 -write httpd-cfs/backgrnd.gif backgrnd.gif,u
|
||||
$(C1541) -attach contiki.d64 -write httpd-cfs/contiki.gif contiki.gif,u
|
||||
$(C1541) -attach contiki.d64 -write httpd-cfs/notfound.html notfound.html,u
|
||||
$(C1541) -attach contiki.d64 -write httpd-cfs/notfound.htm notfound.htm,u
|
||||
endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
# Author: Oliver Schmidt <ol.sc@web.de>
|
||||
#
|
||||
# $Id: Makefile,v 1.6 2010/09/28 19:43:50 oliverschmidt Exp $
|
||||
# $Id: Makefile,v 1.7 2010/09/28 20:40:52 oliverschmidt Exp $
|
||||
#
|
||||
|
||||
ifndef CC65_HOME
|
||||
|
@ -60,10 +60,10 @@ apple2enh-1-disk:
|
|||
java -jar $(AC) -p contiki-1.dsk cs8900a.eth rel 0 < ../../cpu/6502/dhcp/cs8900a.eth
|
||||
java -jar $(AC) -p contiki-1.dsk lan91c96.eth rel 0 < ../../cpu/6502/dhcp/lan91c96.eth
|
||||
java -jar $(AC) -p contiki-1.dsk a2e.stdmou.mou rel 0 < $(CC65_HOME)/mou/a2e.stdmou.mou
|
||||
java -jar $(AC) -p contiki-1.dsk index.html bin 0 < ../../examples/webserver/httpd-cfs/index.html
|
||||
java -jar $(AC) -p contiki-1.dsk index.htm bin 0 < ../../examples/webserver/httpd-cfs/index.htm
|
||||
java -jar $(AC) -p contiki-1.dsk backgrnd.gif bin 0 < ../../examples/webserver/httpd-cfs/backgrnd.gif
|
||||
java -jar $(AC) -p contiki-1.dsk contiki.gif bin 0 < ../../examples/webserver/httpd-cfs/contiki.gif
|
||||
java -jar $(AC) -p contiki-1.dsk notfound.html bin 0 < ../../examples/webserver/httpd-cfs/notfound.html
|
||||
java -jar $(AC) -p contiki-1.dsk notfound.htm bin 0 < ../../examples/webserver/httpd-cfs/notfound.htm
|
||||
|
||||
apple2enh-2-disk:
|
||||
cp ../apple2enh/prodos.dsk contiki-2.dsk
|
||||
|
@ -95,18 +95,18 @@ apple2enh-3-disk:
|
|||
|
||||
c64-1-disk:
|
||||
$(C1541) -format contiki,00 d64 contiki-1.d64
|
||||
$(C1541) -attach contiki-1.d64 -write dummy.cfg contiki.cfg,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../cpu/6502/dhcp/dhcp-client.c64 dhcp,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/webserver-example.c64 webserver,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webbrowser/webbrowser.c64 webbrowser,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/wget/wget.c64 wget,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../cpu/6502/dhcp/cs8900a.eth cs8900a.eth,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../cpu/6502/dhcp/lan91c96.eth lan91c96.eth,u
|
||||
$(C1541) -attach contiki-1.d64 -write $(CC65_HOME)/mou/c64-1351.mou c64-1351.mou,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/index.html index.html,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/backgrnd.gif backgrnd.gif,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/contiki.gif contiki.gif,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/notfound.html notfound.html,u
|
||||
$(C1541) -attach contiki-1.d64 -write dummy.cfg contiki.cfg,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../cpu/6502/dhcp/dhcp-client.c64 dhcp,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/webserver-example.c64 webserver,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webbrowser/webbrowser.c64 webbrowser,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/wget/wget.c64 wget,p
|
||||
$(C1541) -attach contiki-1.d64 -write ../../cpu/6502/dhcp/cs8900a.eth cs8900a.eth,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../cpu/6502/dhcp/lan91c96.eth lan91c96.eth,u
|
||||
$(C1541) -attach contiki-1.d64 -write $(CC65_HOME)/mou/c64-1351.mou c64-1351.mou,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/index.htm index.htm,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/backgrnd.gif backgrnd.gif,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/contiki.gif contiki.gif,u
|
||||
$(C1541) -attach contiki-1.d64 -write ../../examples/webserver/httpd-cfs/notfound.htm notfound.htm,u
|
||||
|
||||
c64-2-disk:
|
||||
$(C1541) -format contiki,00 d64 contiki-2.d64
|
||||
|
@ -132,7 +132,7 @@ c128-1-disk:
|
|||
$(C1541) -attach contiki-1.d71 -write ../../cpu/6502/dhcp/cs8900a.eth cs8900a.eth,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../cpu/6502/dhcp/lan91c96.eth lan91c96.eth,u
|
||||
$(C1541) -attach contiki-1.d71 -write $(CC65_HOME)/mou/c128-1351.mou c128-1351.mou,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../examples/webserver/httpd-cfs/index.html index.html,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../examples/webserver/httpd-cfs/index.htm index.htm,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../examples/webserver/httpd-cfs/backgrnd.gif backgrnd.gif,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../examples/webserver/httpd-cfs/contiki.gif contiki.gif,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../examples/webserver/httpd-cfs/notfound.html notfound.html,u
|
||||
$(C1541) -attach contiki-1.d71 -write ../../examples/webserver/httpd-cfs/notfound.htm notfound.htm,u
|
||||
|
|
Loading…
Reference in a new issue