1
0
mirror of https://github.com/kakwa/uts-server synced 2024-11-04 17:08:49 +01:00

http headers are case-insensitive replacing strcmp by strcasecmp

This commit is contained in:
kakwa 2016-09-11 18:27:51 +02:00
parent 7d053ddc0b
commit a52869092d

View File

@ -74,10 +74,10 @@ void log_request(const struct mg_request_info *request_info, char *request_id,
const char *content_type = NULL; const char *content_type = NULL;
for (int i = 0; i < request_info->num_headers; i++) { for (int i = 0; i < request_info->num_headers; i++) {
if (strcmp(request_info->http_headers[i].name, "User-Agent") == 0) { if (strcasecmp(request_info->http_headers[i].name, "User-Agent") == 0) {
user_agent = request_info->http_headers[i].value; user_agent = request_info->http_headers[i].value;
} }
if (strcmp(request_info->http_headers[i].name, "Content-Type") == 0) { if (strcasecmp(request_info->http_headers[i].name, "Content-Type") == 0) {
content_type = request_info->http_headers[i].value; content_type = request_info->http_headers[i].value;
} }
} }
@ -122,8 +122,8 @@ int rfc3161_handler(struct mg_connection *conn, void *context) {
for (int i = 0; i < request_info->num_headers; i++) { for (int i = 0; i < request_info->num_headers; i++) {
const char *h_name = request_info->http_headers[i].name; const char *h_name = request_info->http_headers[i].name;
const char *h_value = request_info->http_headers[i].value; const char *h_value = request_info->http_headers[i].value;
if (strcmp(h_name, "Content-Type") == 0 && if (strcasecmp(h_name, "Content-Type") == 0 &&
strcmp(h_value, "application/timestamp-query") == 0) strcasecmp(h_value, "application/timestamp-query") == 0)
is_tsq = 1; is_tsq = 1;
} }