Fixed resetConnection()

This commit is contained in:
Nate Choe
2022-01-22 20:22:22 -06:00
parent ad06bbc7be
commit fbb3a4e8cd
3 changed files with 4 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
SRC = $(wildcard src/*.c)
OBJ = $(subst .c,.o,$(subst src,work,$(SRC)))
LIBS =
CFLAGS := -pipe -Wall -Wpedantic -Werror
CFLAGS += -Isrc/include -pthread -ggdb
CFLAGS := -O2 -pipe -Wall -Wpedantic -Werror
CFLAGS += -Isrc/include -pthread
INSTALLDIR := /usr/bin
OUT = swebs

View File

@@ -65,7 +65,7 @@ Connection *newConnection(int fd) {
}
void resetConnection(Connection *conn) {
conn->type = RECEIVE_REQUEST;
conn->progress = RECEIVE_REQUEST;
conn->fieldCount = 0;
free(conn->body);
free(conn->path);

View File

@@ -63,13 +63,13 @@ static void readResponse(Connection *conn, char *path) {
fclose(file);
sendConnection(conn,
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/html; charset=UTF-8\r\n"
"Server: swebs/0.1\r\n"
"Content-Length: %ld\r\n"
"\r\n", len
);
write(conn->fd, data, len);
free(data);
fsync(conn->fd);
}
int sendResponse(Connection *conn, Sitefile *site) {