diff --git a/404.html b/404.html new file mode 100644 index 0000000..6390854 --- /dev/null +++ b/404.html @@ -0,0 +1,52 @@ + + + + + LEGO.com Page Not Found + + + + + + + + + + +
+
+ +
+ +
+ + +
+ +
+ + +
+ + +

Page Not Found

+
+ +
+

Sorry, we can't find that page! It might be an old link or maybe it moved.

+ BACK TO LEGO.COM HOME +
+
+ +
+ + +
+ + + +
+ + + \ No newline at end of file diff --git a/content.c b/content.c index d29bb6e..b0f0c92 100644 --- a/content.c +++ b/content.c @@ -33,7 +33,7 @@ #include /* 10 MB is max size */ -#define MAX_CONTENT_SZ (1024*1024*10) +#define MAX_CONTENT_SZ (1024*1024*1024) char * error_resp(char *path, int *len) @@ -62,13 +62,16 @@ content_get(char *path, int *content_len) #ifdef THINK_TIME sleep(1); #endif - + /* Bad path? No file? Too large? */ - if (sanity_check(path) || - stat(path, &s) || - s.st_size > MAX_CONTENT_SZ) goto err; - + if (stat(path, &s)) + { + path = "404.html"; + } + stat(path, &s); + if (sanity_check(path) || s.st_size > MAX_CONTENT_SZ) goto err; content_fd = open(path, O_RDONLY); + if (content_fd < 0) goto err; resp = malloc(s.st_size); diff --git a/gw-http b/gw-http new file mode 100755 index 0000000..4737fd9 Binary files /dev/null and b/gw-http differ diff --git a/ringbuffer.c b/ringbuffer.c new file mode 100644 index 0000000..dcec841 --- /dev/null +++ b/ringbuffer.c @@ -0,0 +1,44 @@ +#include "ringbuffer.h" +#include +#include +void init(RingBuffer *buffer) +{ + buffer->size = 0; + buffer->head = 0; + buffer->tail = 0; + int i = 0; + for(i = 0;i < buffer->size; i ++) + { + buffer[i] = NULL; + } +} +void add(Ticket *ticket, RingBuffer *buffer) +{ + int head = buffer->head; + int tail = buffer->tail; + int size = buffer->size; + tail ++; + tail = tail % size; + buffer->tickets[tail] = ticket; +} +Ticket * createTicket(char * name, int count) +{ + Ticket * ticket = (Ticket *)malloc(sizeof(Ticket)); + ticket->count = count; + strcpy(ticket->name, name); + return ticket; +} + +void freeticket(Ticket *ticket) +{ + if(!ticket) + { + return + } + else + { + free(ticket->path); + free(ticket); + } + +} diff --git a/ringbuffer.h b/ringbuffer.h new file mode 100644 index 0000000..e68ec45 --- /dev/null +++ b/ringbuffer.h @@ -0,0 +1,15 @@ +#include +typedef struct ticket +{ + int count; + char name[]; +}Ticket; + +typedef struct RingBuffer +{ + int size; + ticket * buffer[size]; + int head; + int tail; +}RingBuffer; + diff --git a/server.c b/server.c index 6e0e054..743ec3d 100644 --- a/server.c +++ b/server.c @@ -32,7 +32,7 @@ #include #include #include -#include +//#include #include /*