[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.49,1.50

Karl DeBisschop kdebisschop at users.sourceforge.net
Sat Aug 23 07:31:42 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv24967

Modified Files:
	check_http.c 
Log Message:
- hacked interim fix to segfault on redirect - for tesing only


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** check_http.c	22 Aug 2003 06:22:37 -0000	1.49
--- check_http.c	23 Aug 2003 13:59:36 -0000	1.50
***************
*** 91,94 ****
--- 91,95 ----
  char *host_name;
  char *server_url;
+ char *user_agent;
  int server_url_length;
  int server_expect_yn = 0;
***************
*** 131,134 ****
--- 132,137 ----
  	server_url = strdup(HTTP_URL);
  	server_url_length = strlen(server_url);
+ 	asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)",
+ 	          clean_revstring (revision), VERSION);
  
  	if (process_arguments (argc, argv) == ERROR)
***************
*** 473,476 ****
--- 476,482 ----
  #endif
  
+ 	if (verbose)
+ 		printf ("%s://%s:%d%s [%s]\n", server_type, server_address, server_port, server_url, host_name);
+ 
  	/* try to connect to the host at the given port number */
  #ifdef HAVE_SSL
***************
*** 498,511 ****
  #endif
  
! 	asprintf (&buf, "%s %s HTTP/1.0\r\n", http_method, server_url);
  
! 	/* optionally send the host header info (not clear if it's usable) */
  	if (host_name)
  		asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
  
- 	/* send user agent */
- 	asprintf (&buf, "%sUser-Agent: check_http/%s (nagios-plugins %s)\r\n",
- 	          buf, clean_revstring (revision), VERSION);
- 
  	/* optionally send the authentication info */
  	if (strlen(user_auth)) {
--- 504,513 ----
  #endif
  
! 	asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent);
  
! 	/* optionally send the host header info */
  	if (host_name)
  		asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
  
  	/* optionally send the authentication info */
  	if (strlen(user_auth)) {
***************
*** 514,517 ****
--- 516,522 ----
  	}
  
+ 	if (verbose)
+ 		printf ("%s://%s:%d%s\n", server_type, server_address, server_port, server_url);
+ 
  	/* either send http POST data */
  	if (http_post_data) {
***************
*** 525,528 ****
--- 530,536 ----
  	}
  
+ 	if (verbose)
+ 		printf ("%s\n", buf);
+ 
  #ifdef HAVE_SSL
  	if (use_ssl == TRUE) {
***************
*** 618,622 ****
  	}
  
- 
  	/* Exit here if server_expect was set by user and not default */
  	if ( server_expect_yn  )  {
--- 626,629 ----
***************
*** 861,867 ****
  	server_port = i;
  	strcpy (server_type, type);
! 	asprintf (&host_name, "%s", addr);
! 	asprintf (&server_address, "%s", addr);
! 	asprintf (&server_url, "%s", url);
  
  	return check_http ();
--- 868,880 ----
  	server_port = i;
  	strcpy (server_type, type);
! 
! 	free (host_name);
! 	host_name = strdup (addr);
! 
! 	free (server_address);
! 	server_address = strdup (addr);
! 
! 	free (server_url);
! 	server_url = strdup (url);
  
  	return check_http ();





More information about the Commits mailing list