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

Diff of /monit/protocols/dwp.c

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

revision 1.4 by martinp, Fri Feb 14 08:22:33 2003 UTC revision 1.5 by hauk, Thu Jul 24 00:35:25 2003 UTC
# Line 60  Line 60 
60   *   *
61   *  @file   *  @file
62   */   */
63  int check_dwp(Port_T p) {  int check_dwp(Socket_T s) {
64    
65  #define REQ_LENGTH  1024  #define REQ_LENGTH  1024
66    
# Line 68  int check_dwp(Port_T p) { Line 68  int check_dwp(Port_T p) {
68    int status;    int status;
69    char buf[STRLEN];    char buf[STRLEN];
70    char proto[STRLEN];    char proto[STRLEN];
   char request[REQ_LENGTH];  
71    
72    ASSERT(p);    ASSERT(s);
73    
74    snprintf(request, REQ_LENGTH,    if(socket_print(s, "HEAD / HTTP/1.1\r\n"
75             "HEAD / HTTP/1.1\r\n"                    "Connection: close\r\n\r\n") < 0) {
            "Connection: close\r\n\r\n");  
   
   if(port_send(p, request, strlen(request), 0) < 0) {  
76      log("DWP: error sending data -- %s\n", STRERROR);      log("DWP: error sending data -- %s\n", STRERROR);
77      return FALSE;      return FALSE;
78    }    }
79        
80    if(port_recv(p, buf, sizeof(buf), 0) <= 0) {    if(socket_read(s, buf, sizeof(buf)) <= 0) {
81      log("DWP: error receiving data -- %s\n", STRERROR);      log("DWP: error receiving data -- %s\n", STRERROR);
82      return FALSE;      return FALSE;
83    }    }
# Line 93  int check_dwp(Port_T p) { Line 89  int check_dwp(Port_T p) {
89      log("DWP error: %s\n", buf);      log("DWP error: %s\n", buf);
90      return FALSE;      return FALSE;
91    }    }
92      
93    return TRUE;    return TRUE;
94        
95  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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