summaryrefslogtreecommitdiff
path: root/ot_http.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-25 19:42:27 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-10-25 19:42:27 +0100
commit5bc4c0663576fd99bb06068e6dfd624690865c89 (patch)
treee1e90e6966abebf960ed9c9d4ed0937be22961ff /ot_http.c
parent33b095eb26ab8be3af48d8bd034262cd5ab03a04 (diff)
Be stricter about const char*, Wwrite-strings will warn in the future and we don't want to try to overwrite string literals
Diffstat (limited to 'ot_http.c')
-rw-r--r--ot_http.c10
1 files changed, 5 insertions, 5 deletions
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 @@
37 37
38#define OT_MAXMULTISCRAPE_COUNT 64 38#define OT_MAXMULTISCRAPE_COUNT 64
39#define OT_BATCH_LIMIT (1024 * 1024 * 16) 39#define OT_BATCH_LIMIT (1024 * 1024 * 16)
40extern char *g_redirecturl; 40extern const char *g_redirecturl;
41 41
42char *g_stats_path; 42const char *g_stats_path;
43ssize_t g_stats_path_len; 43ssize_t g_stats_path_len;
44 44
45enum { SUCCESS_HTTP_HEADER_LENGTH = 80, SUCCESS_HTTP_SIZE_OFF = 17 }; 45enum { 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) {
125#define HTTPERROR_404 return http_issue_error(sock, ws, CODE_HTTPERROR_404) 125#define HTTPERROR_404 return http_issue_error(sock, ws, CODE_HTTPERROR_404)
126#define HTTPERROR_500 return http_issue_error(sock, ws, CODE_HTTPERROR_500) 126#define HTTPERROR_500 return http_issue_error(sock, ws, CODE_HTTPERROR_500)
127ssize_t http_issue_error(const int64_t sock, struct ot_workstruct *ws, int code) { 127ssize_t http_issue_error(const int64_t sock, struct ot_workstruct *ws, int code) {
128 char *error_code[] = {"302 Found", "400 Invalid Request", "400 Invalid Request", "400 Invalid Request", "402 Payment Required", 128 const char *error_code[] = {"302 Found", "400 Invalid Request", "400 Invalid Request", "400 Invalid Request", "402 Payment Required",
129 "403 Not Modest", "403 Access Denied", "404 Not Found", "500 Internal Server Error"}; 129 "403 Not Modest", "403 Access Denied", "404 Not Found", "500 Internal Server Error"};
130 char *title = error_code[code]; 130 const char *title = error_code[code];
131 131
132 ws->reply = ws->outbuf; 132 ws->reply = ws->outbuf;
133 if (code == CODE_HTTPERROR_302) 133 if (code == CODE_HTTPERROR_302)
@@ -491,7 +491,7 @@ unsigned long long numwants[201];
491#endif 491#endif
492 492
493#if defined(WANT_KEEPALIVE) || defined(WANT_IP_FROM_PROXY) 493#if defined(WANT_KEEPALIVE) || defined(WANT_IP_FROM_PROXY)
494static char *http_header(char *data, size_t byte_count, char *header) { 494static char *http_header(char *data, size_t byte_count, const char *header) {
495 size_t i; 495 size_t i;
496 long sl = strlen(header); 496 long sl = strlen(header);
497 for (i = 0; i + sl + 2 < byte_count; ++i) { 497 for (i = 0; i + sl + 2 < byte_count; ++i) {