From b91bb8614ddc09d9141131de0cda2737bb1074f6 Mon Sep 17 00:00:00 2001 From: Nate Choe Date: Thu, 10 Feb 2022 09:43:23 -0600 Subject: [PATCH] Changed how execResposnes work --- documentation/sitefiles.md | 2 +- src/responses.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/sitefiles.md b/documentation/sitefiles.md index d231b4a..89a899e 100644 --- a/documentation/sitefiles.md +++ b/documentation/sitefiles.md @@ -14,7 +14,7 @@ sitefiles also allow comments with # * ```set [variable] [value]``` - sets some local variable for the following pages * ```define [variable] [value]``` - sets some global variable * ```read [http path] [file path]``` - if the requested path matches ```[http path]```, return the contents of ```[file path]```. If [file path] is a directory, then the http path is appended to [file path] and that is read instead. -* ```exec [http path] [file path]``` - if the requested path matches ```[http path]```, execute ```[file path]``` and send the the contents of stdout. ```argv[0]``` is the ```[file path]```, ```argv[1]``` is a header, ```argv[2]``` is the value for that header, ```argv[3]``` is the next header, and so on. +* ```exec [http path] [file path]``` - if the requested path matches ```[http path]```, execute ```[file path]``` and send the the contents of stdout. ```argv[0]``` is the requested path, ```argv[1]``` is a header, ```argv[2]``` is the value for that header, ```argv[3]``` is the next header, and so on. * ```throw [http path] [error code]``` - If the requested path matches ```[http path]```, send back the http error code ```[error code]```. For standardization purposes, these error codes are just the number. ##### Other than set, commands should take in a regex as argument 1 and operate on a file specified in argument 2. diff --git a/src/responses.c b/src/responses.c index d6845a8..1897238 100644 --- a/src/responses.c +++ b/src/responses.c @@ -150,7 +150,7 @@ static int execResponse(Connection *conn, char *path) { close(output[1]); exit(EXIT_FAILURE); } - args[0] = path; + args[0] = conn->path; for (int i = 0; i < conn->fieldCount; i++) { args[i * 2 + 1] = conn->fields[i].field; args[i * 2 + 2] = conn->fields[i].value;