diff options
| author | frosty <gabriel@bwaaa.monster> | 2026-08-08 00:25:08 -0400 |
|---|---|---|
| committer | frosty <gabriel@bwaaa.monster> | 2026-08-08 00:25:08 -0400 |
| commit | 42fe6caf63acdd25e5674d91c13a9ab15f948b7f (patch) | |
| tree | 49344a82098c94f97b1c4f54193458a16dfe6959 /src | |
| parent | 539447047caa6cc3046a1e5814c0bfa563e476df (diff) | |
| download | beaker-42fe6caf63acdd25e5674d91c13a9ab15f948b7f.tar.gz | |
fix: remove redundant code in server.c and routing.c, oops
Diffstat (limited to 'src')
| -rw-r--r-- | src/routing.c | 6 | ||||
| -rw-r--r-- | src/server.c | 1 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/routing.c b/src/routing.c index 1ae4ce9..55a6599 100644 --- a/src/routing.c +++ b/src/routing.c @@ -116,8 +116,7 @@ static int canonicalize_path(char *canonical, const char *path, size_t max_len) static bool is_safe_path_component(const char *component) { if (strstr(component, "..") || - strstr(component, "//") || - strchr(component, '\0') != component + strlen(component)) { + strstr(component, "//")) { return false; } @@ -324,7 +323,6 @@ bool serve_static_file_with_mime(const char *request_path_relative_to_static, co size_t bytes_read; bool send_error = false; - clearerr(fp); while (!send_error && !feof(fp) && !ferror(fp) && (bytes_read = fread(file_buffer, 1, sizeof(file_buffer), fp)) > 0) { if (send(current_client_socket, file_buffer, bytes_read, 0) < 0) { perror("Error sending static file content"); @@ -390,4 +388,4 @@ bool serve_data(const char *data, size_t size, const char *mime_type) { } return true; -}
\ No newline at end of file +} diff --git a/src/server.c b/src/server.c index 828bf26..9f1ca2a 100644 --- a/src/server.c +++ b/src/server.c @@ -9,7 +9,6 @@ #include <sys/socket.h> #include <unistd.h> #include <pthread.h> -#include <unistd.h> #include <stdlib.h> #include <signal.h> #include <fcntl.h> |
