/[monit]/monit/protocols/http.c
ViewVC logotype

Diff of /monit/protocols/http.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by chopp, Wed Sep 25 14:54:49 2002 UTC revision 1.15 by hauk, Sat Dec 21 13:56:04 2002 UTC
# Line 79  int check_http(Port_T p) { Line 79  int check_http(Port_T p) {
79    char proto[STRLEN];    char proto[STRLEN];
80    char request[REQ_LENGTH];    char request[REQ_LENGTH];
81    
82      ASSERT(p);
83    
84    snprintf(request, REQ_LENGTH,    snprintf(request, REQ_LENGTH,
85             "GET %s HTTP/1.1\r\n"             "GET %s HTTP/1.1\r\n"
86             "Host: %s\r\n"             "Host: %s\r\n"
# Line 88  int check_http(Port_T p) { Line 90  int check_http(Port_T p) {
90             p->request?p->request:"/",             p->request?p->request:"/",
91             get_host_header(p, host), prog, VERSION);             get_host_header(p, host), prog, VERSION);
92    
93    if (port_send(p, request, strlen(request), 0) < 0) {    if(port_send(p, request, strlen(request), 0) < 0) {
94      log("HTTP: error sending data -- %s\n", STRERROR);      log("HTTP: error sending data -- %s\n", STRERROR);
95      return FALSE;      return FALSE;
96    }    }
97        
98    if (port_recv(p, buf, sizeof(buf), 0) <= 0) {    if(port_recv(p, buf, sizeof(buf), 0) <= 0) {
99      log("HTTP: error receiving data -- %s\n", STRERROR);      log("HTTP: error receiving data -- %s\n", STRERROR);
100      return FALSE;      return FALSE;
101    }    }
# Line 120  int check_http(Port_T p) { Line 122  int check_http(Port_T p) {
122   */   */
123  static char *get_host_header(Port_T p, char *hostbuf) {  static char *get_host_header(Port_T p, char *hostbuf) {
124    
125    if ( ! strcmp(LOCALHOST, p->hostname) || inet_aton(p->hostname, NULL) ) {    if(! strcmp(LOCALHOST, p->hostname) || inet_aton(p->hostname, NULL)) {
126    
127      *hostbuf= 0;      *hostbuf= 0;
128    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26