summaryrefslogtreecommitdiffstats
path: root/plugins/check_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index f8ec853..41d4781 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
1368void 1369void
1369redir (char *pos, char *status_line) 1370redir (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, '/')))