Changes to raven-webserver by "David Kopf" <dak664@embarqmail.com>:
*Fixed bug in the cgi script handling *Making a special check for index.html and treating it like index.shtml to allow a common header for all files. *adding robots.txt to keep google, msn, yahoo out *adding a nice icon through a <link rel="icon"... in the header *saying "not enabled" for temperature if it hasn't been initialized
This commit is contained in:
parent
e362e2b99e
commit
a0a9ccf2db
8 changed files with 371 additions and 408 deletions
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: httpd.c,v 1.1 2008/10/14 10:14:13 julienabeille Exp $
|
||||
* $Id: httpd.c,v 1.2 2008/11/16 15:28:37 c_oflynn Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -101,12 +101,12 @@ PT_THREAD(send_part_of_file(struct httpd_state *s))
|
|||
{
|
||||
PSOCK_BEGIN(&s->sout);
|
||||
|
||||
static int oldfilelen, oldlen;
|
||||
static int oldfilelen, oldlen;
|
||||
static char * olddata;
|
||||
|
||||
//Store stuff that gets clobbered...
|
||||
oldfilelen = s->file.len;
|
||||
oldlen = s->len;
|
||||
oldlen = s->len;
|
||||
olddata = s->file.data;
|
||||
|
||||
//How much to send
|
||||
|
@ -119,7 +119,7 @@ PT_THREAD(send_part_of_file(struct httpd_state *s))
|
|||
} while(s->file.len > 0);
|
||||
|
||||
s->len = oldlen;
|
||||
s->file.len = oldfilelen;
|
||||
s->file.len = oldfilelen;
|
||||
s->file.data = olddata;
|
||||
|
||||
PSOCK_END(&s->sout);
|
||||
|
@ -137,18 +137,20 @@ next_scriptstate(struct httpd_state *s)
|
|||
} else {
|
||||
s->scriptlen = 0;
|
||||
}
|
||||
|
||||
/* char *p;
|
||||
p = strchr(s->scriptptr, ISO_nl) + 1;
|
||||
s->scriptlen -= (unsigned short)(p - s->scriptptr);
|
||||
s->scriptptr = p;*/
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static char filenamebuf[25],*pptr;//See below!
|
||||
static
|
||||
PT_THREAD(handle_script(struct httpd_state *s))
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
char filenamebuf[25];
|
||||
// char *ptr; //one of these gets whomped unless in globals
|
||||
// char filenamebuf[25];
|
||||
|
||||
PT_BEGIN(&s->scriptpt);
|
||||
|
||||
|
@ -158,9 +160,9 @@ PT_THREAD(handle_script(struct httpd_state *s))
|
|||
if(httpd_fs_getchar(s->file.data) == ISO_percent &&
|
||||
httpd_fs_getchar(s->file.data + 1) == ISO_bang) {
|
||||
s->scriptptr = s->file.data + 3;
|
||||
s->scriptlen = s->file.len - 3;
|
||||
|
||||
memcpy_P(filenamebuf, s->scriptptr, 25);
|
||||
s->scriptlen = s->file.len - 3;
|
||||
|
||||
memcpy_P(filenamebuf, s->scriptptr, 25);
|
||||
|
||||
if(httpd_fs_getchar(s->scriptptr - 1) == ISO_colon) {
|
||||
httpd_fs_open(filenamebuf + 1, &s->file);
|
||||
|
@ -186,13 +188,13 @@ PT_THREAD(handle_script(struct httpd_state *s))
|
|||
}
|
||||
|
||||
if(httpd_fs_getchar(s->file.data) == ISO_percent) {
|
||||
ptr = (char *) httpd_fs_strchr(s->file.data + 1, ISO_percent);
|
||||
pptr = (char *) httpd_fs_strchr(s->file.data + 1, ISO_percent);
|
||||
} else {
|
||||
ptr = (char *) httpd_fs_strchr(s->file.data, ISO_percent);
|
||||
pptr = (char *) httpd_fs_strchr(s->file.data, ISO_percent);
|
||||
}
|
||||
if(ptr != NULL &&
|
||||
ptr != s->file.data) {
|
||||
s->len = (int)(ptr - s->file.data);
|
||||
if(pptr != NULL &&
|
||||
pptr != s->file.data) {
|
||||
s->len = (int)(pptr - s->file.data);
|
||||
if(s->len >= uip_mss()) {
|
||||
s->len = uip_mss();
|
||||
}
|
||||
|
@ -254,7 +256,8 @@ PT_THREAD(handle_output(struct httpd_state *s))
|
|||
send_headers(s,
|
||||
http_header_200));
|
||||
ptr = strchr(s->filename, ISO_period);
|
||||
if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) {
|
||||
if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0 || strcmp_P(s->filename,PSTR("/index.html")) ==0) {
|
||||
// if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0 ) {
|
||||
PT_INIT(&s->scriptpt);
|
||||
PT_WAIT_THREAD(&s->outputpt, handle_script(s));
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue