summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_http.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 2259c6f..5da5750 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -597,7 +597,7 @@ check_http (void)
597 } 597 }
598 } 598 }
599 599
600 /* optionally send http POST data */ 600 /* either send http POST data */
601 if (http_post_data) { 601 if (http_post_data) {
602 asprintf (&buf, "Content-Type: application/x-www-form-urlencoded\r\n"); 602 asprintf (&buf, "Content-Type: application/x-www-form-urlencoded\r\n");
603 if (SSL_write (ssl, buf, strlen (buf)) == -1) { 603 if (SSL_write (ssl, buf, strlen (buf)) == -1) {
@@ -615,12 +615,13 @@ check_http (void)
615 return STATE_CRITICAL; 615 return STATE_CRITICAL;
616 } 616 }
617 } 617 }
618 618 else {
619 /* send a newline so the server knows we're done with the request */ 619 /* or just a newline so the server knows we're done with the request */
620 asprintf (&buf, "\r\n\r\n"); 620 asprintf (&buf, "\r\n");
621 if (SSL_write (ssl, buf, strlen (buf)) == -1) { 621 if (SSL_write (ssl, buf, strlen (buf)) == -1) {
622 ERR_print_errors_fp (stderr); 622 ERR_print_errors_fp (stderr);
623 return STATE_CRITICAL; 623 return STATE_CRITICAL;
624 }
624 } 625 }
625 626
626 } 627 }
@@ -652,7 +653,7 @@ check_http (void)
652 send (sd, buf, strlen (buf), 0); 653 send (sd, buf, strlen (buf), 0);
653 } 654 }
654 655
655 /* optionally send http POST data */ 656 /* either send http POST data */
656 /* written by Chris Henesy <lurker@shadowtech.org> */ 657 /* written by Chris Henesy <lurker@shadowtech.org> */
657 if (http_post_data) { 658 if (http_post_data) {
658 asprintf (&buf, "Content-Type: application/x-www-form-urlencoded\r\n"); 659 asprintf (&buf, "Content-Type: application/x-www-form-urlencoded\r\n");
@@ -662,10 +663,11 @@ check_http (void)
662 http_post_data = strscat (http_post_data, "\r\n"); 663 http_post_data = strscat (http_post_data, "\r\n");
663 send (sd, http_post_data, strlen (http_post_data), 0); 664 send (sd, http_post_data, strlen (http_post_data), 0);
664 } 665 }
665 666 else {
666 /* send a newline so the server knows we're done with the request */ 667 /* send a newline so the server knows we're done with the request */
667 asprintf (&buf, "\r\n"); 668 asprintf (&buf, "\r\n");
668 send (sd, buf, strlen (buf), 0); 669 send (sd, buf, strlen (buf), 0);
670 }
669#ifdef HAVE_SSL 671#ifdef HAVE_SSL
670 } 672 }
671#endif 673#endif