From 5bc4c0663576fd99bb06068e6dfd624690865c89 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 25 Oct 2026 19:42:27 +0100 Subject: Be stricter about const char*, Wwrite-strings will warn in the future and we don't want to try to overwrite string literals --- ot_http.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ot_http.c') diff --git a/ot_http.c b/ot_http.c index 6448860..fc27eb8 100644 --- a/ot_http.c +++ b/ot_http.c @@ -37,9 +37,9 @@ #define OT_MAXMULTISCRAPE_COUNT 64 #define OT_BATCH_LIMIT (1024 * 1024 * 16) -extern char *g_redirecturl; +extern const char *g_redirecturl; -char *g_stats_path; +const char *g_stats_path; ssize_t g_stats_path_len; enum { SUCCESS_HTTP_HEADER_LENGTH = 80, SUCCESS_HTTP_SIZE_OFF = 17 }; @@ -125,9 +125,9 @@ static void http_senddata(const int64_t sock, struct ot_workstruct *ws) { #define HTTPERROR_404 return http_issue_error(sock, ws, CODE_HTTPERROR_404) #define HTTPERROR_500 return http_issue_error(sock, ws, CODE_HTTPERROR_500) ssize_t http_issue_error(const int64_t sock, struct ot_workstruct *ws, int code) { - char *error_code[] = {"302 Found", "400 Invalid Request", "400 Invalid Request", "400 Invalid Request", "402 Payment Required", + const char *error_code[] = {"302 Found", "400 Invalid Request", "400 Invalid Request", "400 Invalid Request", "402 Payment Required", "403 Not Modest", "403 Access Denied", "404 Not Found", "500 Internal Server Error"}; - char *title = error_code[code]; + const char *title = error_code[code]; ws->reply = ws->outbuf; if (code == CODE_HTTPERROR_302) @@ -491,7 +491,7 @@ unsigned long long numwants[201]; #endif #if defined(WANT_KEEPALIVE) || defined(WANT_IP_FROM_PROXY) -static char *http_header(char *data, size_t byte_count, char *header) { +static char *http_header(char *data, size_t byte_count, const char *header) { size_t i; long sl = strlen(header); for (i = 0; i + sl + 2 < byte_count; ++i) { -- cgit v1.3