[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.55,1.56

Ton Voon tonvoon at users.sourceforge.net
Thu Feb 19 19:33:26 CET 2004


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6445

Modified Files:
	check_http.c 
Log Message:
Added Content-type when POSTing (Shawn Wills)


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** check_http.c	11 Dec 2003 10:00:07 -0000	1.55
--- check_http.c	20 Feb 2004 03:21:40 -0000	1.56
***************
*** 112,115 ****
--- 112,116 ----
  char *http_method;
  char *http_post_data;
+ char *http_content_type;
  char buffer[MAX_INPUT_BUFFER];
  
***************
*** 208,211 ****
--- 209,213 ----
  		{"onredirect", required_argument, 0, 'f'},
  		{"certificate", required_argument, 0, 'C'},
+ 		{"content-type", required_argument, 0, 'T'},
  		{"min", required_argument, 0, 'm'},
  		{"use-ipv4", no_argument, 0, '4'},
***************
*** 346,349 ****
--- 348,354 ----
  			server_expect_yn = 1;
  			break;
+ 		case 'T': /* Content-type */
+ 			asprintf (&http_content_type, "%s", optarg);
+ 			break;
  #ifndef HAVE_REGEX_H
   		case 'l': /* linespan */
***************
*** 520,524 ****
  	/* either send http POST data */
  	if (http_post_data) {
! 		asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf);
  		asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data));
  		asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF);
--- 525,533 ----
  	/* either send http POST data */
  	if (http_post_data) {
! 		if (http_content_type) {
! 			asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type);
! 		} else {
! 			asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf);
! 		}
  		asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data));
  		asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF);
***************
*** 1144,1148 ****
     URL to GET or POST (default: /)\n\
   -P, --post=STRING\n\
!    URL encoded http POST data\n"), HTTP_EXPECT);
  
  #ifdef HAVE_REGEX_H
--- 1153,1159 ----
     URL to GET or POST (default: /)\n\
   -P, --post=STRING\n\
!    URL encoded http POST data\n\
!  -T, --content-type=STRING\n\
!    specify Content-Type header media type when POSTing\n"), HTTP_EXPECT);
  
  #ifdef HAVE_REGEX_H





More information about the Commits mailing list