Added url variables, removed exec pages

This commit is contained in:
Nate Choe
2022-02-20 21:43:19 -06:00
parent 458c0a545d
commit 4366c8ad65
13 changed files with 202 additions and 98 deletions

View File

@@ -5,7 +5,10 @@
#include <swebs/swebs.h>
int getResponse(Request *request, Response *response) {
char *str = request->path;
printf("%d\n", request->path.fieldCount);
for (int i = 0; i < request->path.fieldCount; i++)
printf("%s: %s\n", request->path.fields[i].var.data, request->path.fields[i].value.data);
char *str = request->path.path.data;
response->type = BUFFER;
response->response.buffer.data = malloc(100);
strcpy(response->response.buffer.data, str);

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "<p>By the way today's date is $(date)</p>"

View File

@@ -3,5 +3,4 @@
<h3>It's not very polished but it's certainly a website</h3>
<a href="blog/2022-1-25.html">2021-1-25</a>
<a href="blog/2022-1-31">2021-1-31</a>
<a href="blog/forbidden">The forbidden blog post</a>

View File

@@ -10,7 +10,6 @@ set host localhost:8000
read / site/index.html
read /hello site/hello.html
throw /blog/forbidden 403
exec /blog/2022-1-31 site/blog/blog/2022-1-31.sh
read /blog/.* site/blog/
#/blog/2021-1-25.html turns into site/blog//blog/2021-1-25.html
linked /library