diff options
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 594a368..e6310c8 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -522,15 +522,15 @@ int | |||
522 | check_http (void) | 522 | check_http (void) |
523 | { | 523 | { |
524 | char *msg = NULL; | 524 | char *msg = NULL; |
525 | char *status_line = NULL; | 525 | char *status_line = ""; |
526 | char *header = NULL; | 526 | char *header = NULL; |
527 | char *page = NULL; | 527 | char *page = ""; |
528 | char *auth = NULL; | 528 | char *auth = NULL; |
529 | int i = 0; | 529 | int i = 0; |
530 | size_t pagesize = 0; | 530 | size_t pagesize = 1; |
531 | char *full_page = NULL; | 531 | char *full_page = ""; |
532 | char *buf = NULL; | 532 | char *buf = NULL; |
533 | char *pos = NULL; | 533 | char *pos = ""; |
534 | char *x = NULL; | 534 | char *x = NULL; |
535 | char *orig_url = NULL; | 535 | char *orig_url = NULL; |
536 | double elapsed_time; | 536 | double elapsed_time; |
@@ -657,8 +657,6 @@ check_http (void) | |||
657 | #endif | 657 | #endif |
658 | 658 | ||
659 | /* fetch the page */ | 659 | /* fetch the page */ |
660 | pagesize = (size_t) 1; | ||
661 | asprintf (&full_page, ""); | ||
662 | while ((i = my_recv ()) > 0) { | 660 | while ((i = my_recv ()) > 0) { |
663 | buffer[i] = '\0'; | 661 | buffer[i] = '\0'; |
664 | asprintf (&full_page, "%s%s", full_page, buffer); | 662 | asprintf (&full_page, "%s%s", full_page, buffer); |
@@ -689,7 +687,7 @@ check_http (void) | |||
689 | page += (size_t) strcspn (page, "\r\n"); | 687 | page += (size_t) strcspn (page, "\r\n"); |
690 | pos = page; | 688 | pos = page; |
691 | page += (size_t) strspn (page, "\r\n"); | 689 | page += (size_t) strspn (page, "\r\n"); |
692 | status_line[pos - status_line] = 0; | 690 | status_line[strcspn(status_line, "\r\n")] = 0; |
693 | strip (status_line); | 691 | strip (status_line); |
694 | if (verbose) | 692 | if (verbose) |
695 | printf ("STATUS: %s\n", status_line); | 693 | printf ("STATUS: %s\n", status_line); |