Fix compiler warnings regarding const modifiers
This commit is contained in:
+1
-1
@@ -132,7 +132,7 @@ int http_parse_header_field(http_hdr *hdr, const char *buf, const char *end_ptr,
|
|||||||
if (hdr->last_field_num > list_size(hdr->fields))
|
if (hdr->last_field_num > list_size(hdr->fields))
|
||||||
return http_error(HTTP_ERROR_GENERAL);
|
return http_error(HTTP_ERROR_GENERAL);
|
||||||
|
|
||||||
char *pos1 = (char *) buf, *pos2 = (char *) end_ptr;
|
const char *pos1 = buf, *pos2 = end_ptr;
|
||||||
if (buf[0] == ' ' || buf[0] == '\t') {
|
if (buf[0] == ' ' || buf[0] == '\t') {
|
||||||
if (hdr->last_field_num == -1)
|
if (hdr->last_field_num == -1)
|
||||||
return http_error(HTTP_ERROR_GENERAL);
|
return http_error(HTTP_ERROR_GENERAL);
|
||||||
|
|||||||
+4
-4
@@ -211,13 +211,13 @@ int proxy_request_header(http_req *req, sock *sock) {
|
|||||||
if (forwarded == NULL) {
|
if (forwarded == NULL) {
|
||||||
http_add_header_field(&req->hdr, "X-Forwarded-Host", http_get_header_field(&req->hdr, "Host"));
|
http_add_header_field(&req->hdr, "X-Forwarded-Host", http_get_header_field(&req->hdr, "Host"));
|
||||||
} else {
|
} else {
|
||||||
char *ptr = strchr(forwarded, ',');
|
const char *ptr = strchr(forwarded, ',');
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
if (ptr != NULL) len = ptr - forwarded;
|
if (ptr != NULL) len = ptr - forwarded;
|
||||||
else len = strlen(forwarded);
|
else len = strlen(forwarded);
|
||||||
ptr = strstr(forwarded, "host=");
|
ptr = strstr(forwarded, "host=");
|
||||||
if ((ptr - forwarded) < len) {
|
if ((ptr - forwarded) < len) {
|
||||||
char *end = strchr(ptr, ';');
|
const char *end = strchr(ptr, ';');
|
||||||
if (end == NULL) len -= (ptr - forwarded);
|
if (end == NULL) len -= (ptr - forwarded);
|
||||||
else len = (end - ptr);
|
else len = (end - ptr);
|
||||||
len -= 5;
|
len -= 5;
|
||||||
@@ -233,13 +233,13 @@ int proxy_request_header(http_req *req, sock *sock) {
|
|||||||
if (forwarded == NULL) {
|
if (forwarded == NULL) {
|
||||||
http_add_header_field(&req->hdr, "X-Forwarded-Proto", sock->enc ? "https" : "http");
|
http_add_header_field(&req->hdr, "X-Forwarded-Proto", sock->enc ? "https" : "http");
|
||||||
} else {
|
} else {
|
||||||
char *ptr = strchr(forwarded, ',');
|
const char *ptr = strchr(forwarded, ',');
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
if (ptr != NULL) len = ptr - forwarded;
|
if (ptr != NULL) len = ptr - forwarded;
|
||||||
else len = strlen(forwarded);
|
else len = strlen(forwarded);
|
||||||
ptr = strstr(forwarded, "proto=");
|
ptr = strstr(forwarded, "proto=");
|
||||||
if ((ptr - forwarded) < len) {
|
if ((ptr - forwarded) < len) {
|
||||||
char *end = strchr(ptr, ';');
|
const char *end = strchr(ptr, ';');
|
||||||
if (end == NULL) len -= (ptr - forwarded);
|
if (end == NULL) len -= (ptr - forwarded);
|
||||||
else len = (end - ptr);
|
else len = (end - ptr);
|
||||||
len -= 6;
|
len -= 6;
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ int path_exists(const char *path) {
|
|||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mode) {
|
int uri_init(http_uri *uri, const char *webroot, char *uri_str, int dir_mode) {
|
||||||
char buf0[1024], buf1[1024], buf2[1024], buf3[1024], buf4[1024];
|
char buf0[1024], buf1[1024], buf2[1024], buf3[1024], buf4[1024];
|
||||||
int p_len;
|
int p_len;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
} http_uri;
|
} http_uri;
|
||||||
|
|
||||||
|
|
||||||
int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mode);
|
int uri_init(http_uri *uri, const char *webroot, char *uri_str, int dir_mode);
|
||||||
|
|
||||||
int uri_init_cache(http_uri *uri);
|
int uri_init_cache(http_uri *uri);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -193,7 +193,7 @@ int strcpy_rem_webroot(char *dst, const char *src, const char *webroot) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int str_trim(char **start, char **end) {
|
int str_trim(const char **start, const char **end) {
|
||||||
if (start == NULL || end == NULL || *start == NULL || *end == NULL)
|
if (start == NULL || end == NULL || *start == NULL || *end == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ int str_trim(char **start, char **end) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int str_trim_lws(char **start, char **end) {
|
int str_trim_lws(const char **start, const char **end) {
|
||||||
if (start == NULL || end == NULL || *start == NULL || *end == NULL)
|
if (start == NULL || end == NULL || *start == NULL || *end == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -33,9 +33,9 @@ int mime_is_text(const char *restrict type);
|
|||||||
|
|
||||||
int strcpy_rem_webroot(char *dst, const char *str, const char *webroot);
|
int strcpy_rem_webroot(char *dst, const char *str, const char *webroot);
|
||||||
|
|
||||||
int str_trim(char **start, char **end);
|
int str_trim(const char **start, const char **end);
|
||||||
|
|
||||||
int str_trim_lws(char **start, char **end);
|
int str_trim_lws(const char **start, const char **end);
|
||||||
|
|
||||||
int streq(const char *restrict str1, const char *restrict str2);
|
int streq(const char *restrict str1, const char *restrict str2);
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void local_handler_func(client_ctx_t *ctx) {
|
|||||||
static int range_handler(client_ctx_t *ctx) {
|
static int range_handler(client_ctx_t *ctx) {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
long num0, num1, num2;
|
long num0, num1, num2;
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
int mode;
|
int mode;
|
||||||
const char *range = http_get_header_field(&ctx->req.hdr, "Range");
|
const char *range = http_get_header_field(&ctx->req.hdr, "Range");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user