Added new Test Website and fixed wwwserver

This commit is contained in:
Andrew Pamment 2016-01-29 21:06:08 +10:00
parent 2956c3d6ce
commit e15beac2d7
6 changed files with 86 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

BIN
misc/www/images/footer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

BIN
misc/www/images/header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

34
misc/www/index.html Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Quinn - Test Page</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="wholepage">
<div id="header">
<a href="index.php"><img src="images/header.png" /></a>
</div>
<div id="pagecontent">
<div id="maincontent">
<h3>Quinn Test Page</h3>
<p>
Quinn's webserver is based on Mite 0.6 a webserver I wrote
some time ago for Linux.
</p>
<p>
This particular version of Mite has had the CGI and POST features
pulled out and will only serve HTML, PNG and Text Files.
</p>
<p>
The webserver root is disk0:/www/
</p>
</div>
</div>
<div id="footer">
Quinn &copy; 2016 Andrew Pamment
</div>
</div>
</body>
</html>

46
misc/www/style.css Normal file
View File

@ -0,0 +1,46 @@
body {
margin: 0;
padding: 0;
background:#ccc;
font-family: Arial, Helvetica, sans-serif;
}
#wholepage {
width: 670px;
margin: auto;
}
#header img {
display: block;
}
#pagecontent {
background: url('images/background.png') repeat-y;
}
#info {
background-color: #fffbd2;
border: 2px solid #c4b941;
width: 100%;
margin: 0 10px 0 0;
padding: 10px;
}
#maincontent {
width: 600px;
padding-left:35px;
padding-right:20px;
padding-top: 20px;
padding-bottom: 20px;
}
#footer {
clear: both;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-size: x-small;
height: 47px;
background: url('images/footer.png') no-repeat;
}

View File

@ -244,15 +244,18 @@ void do_get(unsigned int s, struct request_t *req) {
sprintf(buffer, "Connection: close\r\n");
socket_write(s, buffer, strlen(buffer));
if (strcasecmp(&req->path[strlen(req->path) - 5], "html") == 0) {
if (strcasecmp(&req->fspath[strlen(req->fspath) - 4], "html") == 0) {
sprintf(buffer, "Content-Type: text/html\r\n");
socket_write(s, buffer, strlen(buffer));
} else if (strcasecmp(&req->path[strlen(req->path) - 4], "htm") == 0) {
} else if (strcasecmp(&req->fspath[strlen(req->fspath) - 3], "htm") == 0) {
sprintf(buffer, "Content-Type: text/html\r\n");
socket_write(s, buffer, strlen(buffer));
} else if (strcasecmp(&req->path[strlen(req->path) - 4], "png") == 0) {
} else if (strcasecmp(&req->fspath[strlen(req->fspath) - 3], "png") == 0) {
sprintf(buffer, "Content-Type: image/png\r\n");
socket_write(s, buffer, strlen(buffer));
} else if (strcasecmp(&req->fspath[strlen(req->fspath) - 3], "css") == 0) {
sprintf(buffer, "Content-Type: text/css\r\n");
socket_write(s, buffer, strlen(buffer));
} else {
sprintf(buffer, "Content-Type: text/plain\r\n");
socket_write(s, buffer, strlen(buffer));