Added more information towards dynamic pages

This commit is contained in:
Nate Choe
2022-02-14 17:26:47 -06:00
parent e1fd93f5ab
commit ce6bc14fa5
3 changed files with 5 additions and 1 deletions

View File

@@ -133,7 +133,7 @@ static int processField(Connection *conn) {
"Content-Length") == 0) "Content-Length") == 0)
conn->bodylen = atol(conn->fields[i].value); conn->bodylen = atol(conn->fields[i].value);
} }
conn->body = malloc(conn->bodylen + 1); conn->body = malloc(conn->bodylen);
if (conn->body == NULL) if (conn->body == NULL)
return 1; return 1;
conn->receivedBody = 0; conn->receivedBody = 0;

View File

@@ -162,6 +162,8 @@ static int linkedResponse(Connection *conn,
request.fields = conn->fields; request.fields = conn->fields;
request.path = conn->path; request.path = conn->path;
request.type = conn->type; request.type = conn->type;
request.body = conn->body;
request.bodylen = conn->bodylen;
code = getResponse(&request, &response); code = getResponse(&request, &response);

View File

@@ -51,6 +51,8 @@ typedef struct {
Field *fields; Field *fields;
char *path; char *path;
RequestType type; RequestType type;
void *body;
size_t bodylen;
} Request; } Request;
typedef enum { typedef enum {