Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="_htmltag" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><link href="http://cache.lego.com/r/www/en-us/design/shared/global/buttons.aspx?l.r2=-1614871973" type="text/css" rel="stylesheet"><style type="text/css">H2 {background: url(http://cache.lego.com/r/www/-/media/portal%20v2010/errors/en/404%20header%20image.png?l.r2=1338408711) no-repeat; width:254px; height: 41px;}
</style><meta http-equiv="content-language" content="en" /><meta http-equiv="content-type" content="text/html charset=utf-8" /><title>
LEGO.com Page Not Found
</title><meta name="google" value="notranslate" /><base id="basetag" href="http://www.lego.com/en-US/"></base>
<script type="text/javascript" src="http://cache.lego.com/r/www/components/core.modernizr/modernizr.min.js?l.r2=1.0.0.1585"></script>

<script src="https://mi-od-live-s.legocdn.com/r/www/r/analytics/Modules/TrackManApi" data-initial-page="portal:errors:404" data-tracking-script="http://cache.lego.com/r/www/design/tracking/page-tracking.js?l.r2=1.0.0.1585"></script>

<script type="text/javascript" src="http://cache.lego.com/r/www/design/portal/errorpages/scripts/errorpages.js?l.r2=1.0.0.1585"></script><script src="http://cache.lego.com/r/www/design/global/js_9be41044a5320129c3569409189072abab01cfb2" type="text/javascript"></script>
<script src="http://cache.lego.com/r/www/design/www/js_85cb23ac085b6959d789003aab0a19750a1d0525" type="text/javascript"></script><link href="http://cache.lego.com/r/www/design/global/css_8b3ca8593eba51da08eaf59c21af883f26e16c98" type="text/css" rel="stylesheet">
<link href="http://cache.lego.com/r/www/design/www/css_3096a292c25d9d486b215193ef77c12ddb5502e1" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://cache.lego.com/r/www/design/portal/errorpages/css/errorpages.css?l.r2=1.0.0.1585" /></head>
<body class="Genus chrome chrome53">
<form method="post" action="/404notfound" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2ODkwNjU4MDEPFgIeE1ZhbGlkYXRlUmVxdWVzdE1vZGUCAWRk9ZQ9JmEKUrUBSfk+e8Y573phHck=" />
</div>

<div class="aspNetHidden">

<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="8B8C8B03" />
</div>

<div id="globalWrapper">


<div id="site" class="clearfix">


<h2>Page Not Found</h2>
<div class="userPrompt">
<img src="http://cache.lego.com/r/www/-/media/portal%20v2010/errors/404%20mainstage%20image.jpg?l.r2=1953967734" alt="" />
<div>
<p>Sorry, we can't find that page! It might be an old link or maybe it moved.</p>
<a class="btn cancel large blue" href="/en-US"><span class="label">BACK TO LEGO.COM HOME </span><span class="decor"></span></a>
</div>
</div>

</div>


</div>
<script type="text/javascript" src="http://cache.lego.com/r/www/r/globalnavigationservices/api/v1/global/scripts/en-US/lego.global.javascriptwrapper/www?l.r2=1.0.0.1585"></script>


</form>
<script src="http://cache.lego.com/r/www/scripts/dist/release.js?l.r2=1.0.0.1585" type="text/javascript"></script>
</body>
</html>
15 changes: 9 additions & 6 deletions content.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <unistd.h>

/* 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)
Expand Down Expand Up @@ -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);
Expand Down
Binary file added gw-http
Binary file not shown.
44 changes: 44 additions & 0 deletions ringbuffer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "ringbuffer.h"
#include <string.h>
#include <stdio.h>
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);
}

}
15 changes: 15 additions & 0 deletions ringbuffer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdio.h>
typedef struct ticket
{
int count;
char name[];
}Ticket;

typedef struct RingBuffer
{
int size;
ticket * buffer[size];
int head;
int tail;
}RingBuffer;

2 changes: 1 addition & 1 deletion server.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <netinet/in.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <malloc.h>
//#include <malloc.h>
#include <unistd.h>

/*
Expand Down