diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2022-11-25 10:30:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 10:30:05 +0100 |
commit | 917dba07fded8ef04967183a4c0443b5cce2db82 (patch) | |
tree | bd3017f225186b3e7f29db257f0d3b5790846ff2 /plugins/check_http.c | |
parent | 4ff0dfa44306c4e8a7dc46fcb1c508f7a191638b (diff) | |
parent | 1bc6d81651c5b5fe865515d420fc2772f4997059 (diff) | |
download | monitoring-plugins-917dba0.tar.gz |
Merge branch 'master' into dev/check_ssh-patches
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index f8ec853b..41d47816 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1070,9 +1070,8 @@ check_http (void) | |||
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | xasprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); | 1072 | xasprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); |
1073 | xasprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | 1073 | xasprintf (&buf, "%s%s", buf, http_post_data); |
1074 | } | 1074 | } else { |
1075 | else { | ||
1076 | /* or just a newline so the server knows we're done with the request */ | 1075 | /* or just a newline so the server knows we're done with the request */ |
1077 | xasprintf (&buf, "%s%s", buf, CRLF); | 1076 | xasprintf (&buf, "%s%s", buf, CRLF); |
1078 | } | 1077 | } |
@@ -1363,7 +1362,9 @@ check_http (void) | |||
1363 | #define HD2 URI_HTTP "://" URI_HOST "/" URI_PATH | 1362 | #define HD2 URI_HTTP "://" URI_HOST "/" URI_PATH |
1364 | #define HD3 URI_HTTP "://" URI_HOST ":" URI_PORT | 1363 | #define HD3 URI_HTTP "://" URI_HOST ":" URI_PORT |
1365 | #define HD4 URI_HTTP "://" URI_HOST | 1364 | #define HD4 URI_HTTP "://" URI_HOST |
1366 | #define HD5 URI_PATH | 1365 | /* relative reference redirect like //www.site.org/test https://tools.ietf.org/html/rfc3986 */ |
1366 | #define HD5 "//" URI_HOST "/" URI_PATH | ||
1367 | #define HD6 URI_PATH | ||
1367 | 1368 | ||
1368 | void | 1369 | void |
1369 | redir (char *pos, char *status_line) | 1370 | redir (char *pos, char *status_line) |
@@ -1440,9 +1441,21 @@ redir (char *pos, char *status_line) | |||
1440 | use_ssl = server_type_check (type); | 1441 | use_ssl = server_type_check (type); |
1441 | i = server_port_check (use_ssl); | 1442 | i = server_port_check (use_ssl); |
1442 | } | 1443 | } |
1444 | /* URI_HTTP, URI_HOST, URI_PATH */ | ||
1445 | else if (sscanf (pos, HD5, addr, url) == 2) { | ||
1446 | if(use_ssl){ | ||
1447 | strcpy (type,"https"); | ||
1448 | } | ||
1449 | else{ | ||
1450 | strcpy (type, server_type); | ||
1451 | } | ||
1452 | xasprintf (&url, "/%s", url); | ||
1453 | use_ssl = server_type_check (type); | ||
1454 | i = server_port_check (use_ssl); | ||
1455 | } | ||
1443 | 1456 | ||
1444 | /* URI_PATH */ | 1457 | /* URI_PATH */ |
1445 | else if (sscanf (pos, HD5, url) == 1) { | 1458 | else if (sscanf (pos, HD6, url) == 1) { |
1446 | /* relative url */ | 1459 | /* relative url */ |
1447 | if ((url[0] != '/')) { | 1460 | if ((url[0] != '/')) { |
1448 | if ((x = strrchr(server_url, '/'))) | 1461 | if ((x = strrchr(server_url, '/'))) |