/[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.44 by hauk, Fri Apr 22 22:37:13 2005 UTC revision 1.45 by hauk, Sun May 1 20:03:07 2005 UTC
# Line 297  static int do_regex(Http_T *H, Request_T Line 297  static int do_regex(Http_T *H, Request_T
297      H->content_length= HTTP_CONTENT_MAX;      H->content_length= HTTP_CONTENT_MAX;
298    else if(H->content_length > HTTP_CONTENT_MAX)    else if(H->content_length > HTTP_CONTENT_MAX)
299      H->content_length= HTTP_CONTENT_MAX;      H->content_length= HTTP_CONTENT_MAX;
300      
301    n= 0;    n= 0;
302    size= 0;    size= 0;
303    length= H->content_length;    length= H->content_length;
304    buf= xmalloc(H->content_length);    buf= xmalloc(H->content_length);
305      
306    do {    do {
307        n= socket_read(H->s, &buf[size], length);        n= socket_read(H->s, &buf[size], length);
308        if(n<=0)        if(n<=0)
# Line 308  static int do_regex(Http_T *H, Request_T Line 310  static int do_regex(Http_T *H, Request_T
310        size+= n;        size+= n;
311        length-= n;        length-= n;
312    } while(length>0);    } while(length>0);
313      
314    if(size==0) {    if(size==0) {
315      rv= FALSE;      rv= FALSE;
316      log("HTTP: error receiving data -- %s\n", STRERROR);      log("HTTP: error receiving data -- %s\n", STRERROR);
# Line 383  error: Line 386  error:
386    
387    
388  /*  /*
389   * Follow redirect responses from the server. FIXME: there is a   * Follow redirect responses from the server.
  * BIG shortcoming here since the code only follow redirects on the  
  * same server. What we need to do is to open a new socket against  
  * the server in the location header. This may provide problems since  
  * the socket is owned by the caller. Anyway, do investigate this further.  
390   */   */
391  static int do_redirect(Http_T *H) {  static int do_redirect(Http_T *H) {
392    
# Line 395  static int do_redirect(Http_T *H) { Line 394  static int do_redirect(Http_T *H) {
394    char auth[STRLEN]= {0};    char auth[STRLEN]= {0};
395    Port_T P= socket_get_Port(H->s);    Port_T P= socket_get_Port(H->s);
396    
397      
398      /*
399       * FIXME: there is a
400       * BIG shortcoming here since the code only follow redirects on the
401       * same server. What we need to do is to open a new socket against
402       * the server in the location header. This may provide problems since
403       * the socket is owned by the caller. Anyway, do investigate this further.
404       */
405      
406    if(!*H->location) {    if(!*H->location) {
407      DEBUG("HTTP error: Missing Location header in response\n");      DEBUG("HTTP error: Missing Location header in response\n");
408      return FALSE;      return FALSE;

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

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