monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HTTP_CONTENT_MAX and url method


From: Ben Hartshorne
Subject: HTTP_CONTENT_MAX and url method
Date: Thu, 21 Apr 2005 14:52:26 -0700
User-agent: Mutt/1.5.6+20040907i

Hi everyone,

I am trying to use the 'url' method of monit 4.5.1, and have come across
what seems to be a bug.  Though the docs claim that monit will grab the
first 1MB of a file if the HTTP server does not specify a Content-Length
header, it seems to only grab about the first 970ish bytes.

I first noticed this because my url content regexp test was failing,
though it seemed as if it should succeed.  I tried matching different
strings at different places in the document returned until I settled on
about 1000 characters.

I went poking around the code and found the HTTP_CONTENT_MAX variable,
which seemed to limit the amount of data scarfed if there was no
Content-Length header:
[excerpt from protocols/http.c]

  if(H->content_length < 0) /* Not defined in response */
    H->content_length= HTTP_CONTENT_MAX;
  else if(H->content_length > HTTP_CONTENT_MAX)
    H->content_length= HTTP_CONTENT_MAX;

I put in some debugging lines around this to make sure it was actually
being run as I expected, and H->content_length is being set correctly.

I also put in a debugging line to print out what is contained in the
buffer allocated for the page, against which the regexp is tested.

I found that though reducing HTTP_CONTENT_MAX below 1000ish decreased
the amount of the page that was in the buffer, increasing it did not.
there was a cutoff at about 970, over which it seems to ignore
H->content_length.  

I'm not up on my socket foo to go any further, but I wonder if anybody
has any insight into this problem.  

I've attached protocols/http.c, my monitrc file (you're welcome to hit
my server to repeat the experiment), and the debugging output of
'./monit -I -v -c ./monitrc'

-ben

-- 
Ben Hartshorne
email: address@hidden
http://ben.hartshorne.net

Attachment: monitrc
Description: Text document

Attachment: http.c
Description: Text Data

Attachment: monitout.txt
Description: Text document

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]