[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.16,1.17
Karl DeBisschop
kdebisschop at users.sourceforge.net
Mon Jan 27 03:54:04 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv16282/plugins
Modified Files:
check_http.c
Log Message:
do not pass host if none is provided
Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** check_http.c 27 Jan 2003 06:04:03 -0000 1.16
--- check_http.c 27 Jan 2003 11:53:25 -0000 1.17
***************
*** 197,201 ****
char server_type[6] = "http";
/*@null@*/ char *server_address = NULL;
! /*@null@*/ char *host_name = NULL;
/*@null@*/ char *server_url = NULL;
int server_url_length = 0;
--- 197,201 ----
char server_type[6] = "http";
/*@null@*/ char *server_address = NULL;
! char *host_name = "";
/*@null@*/ char *server_url = NULL;
int server_url_length = 0;
***************
*** 402,406 ****
/* Note: H, I, and u must be malloc'd or will fail on redirects */
case 'H': /* Host Name (virtual host) */
! host_name = strscpy (host_name, optarg);
break;
case 'I': /* Server IP-address */
--- 402,406 ----
/* Note: H, I, and u must be malloc'd or will fail on redirects */
case 'H': /* Host Name (virtual host) */
! asprintf (&host_name, "%s", optarg);
break;
case 'I': /* Server IP-address */
***************
*** 465,481 ****
c = optind;
! if (server_address == NULL && host_name == NULL) { server_address = strscpy (NULL, argv[c]);
! host_name = strscpy (NULL, argv[c++]);
}
! if (server_address == NULL && host_name == NULL)
! usage ("check_http: you must specify a host name\n");
if (server_address == NULL)
server_address = strscpy (NULL, host_name);
- if (host_name == NULL)
- host_name = strscpy (NULL, server_address);
-
if (http_method == NULL)
http_method = strscpy (http_method, "GET");
--- 465,483 ----
c = optind;
! if (server_address == NULL) {
! if (c < argc) {
! server_address = strscpy (NULL, argv[c++]);
! }
! else if (strcmp (host_name ,"") == 0) {
! usage ("check_http: you must specify a server address\n");
! }
}
! if (strcmp (host_name ,"") == 0 && c < argc)
! asprintf (&host_name, "%s", argv[c++]);
if (server_address == NULL)
server_address = strscpy (NULL, host_name);
if (http_method == NULL)
http_method = strscpy (http_method, "GET");
***************
*** 632,637 ****
asprintf (&buf, "%s %s HTTP/1.0\r\n", http_method, server_url);
send (sd, buf, strlen (buf), 0);
-
-
/* optionally send the host header info */
--- 634,637 ----
***************
*** 665,669 ****
}
else {
! /* send a newline so the server knows we're done with the request */
asprintf (&buf, "\r\n");
send (sd, buf, strlen (buf), 0);
--- 665,669 ----
}
else {
! /* or just a newline so the server knows we're done with the request */
asprintf (&buf, "\r\n");
send (sd, buf, strlen (buf), 0);
More information about the Commits
mailing list