Changeset 3c4929015c7e763c1aa84c4ecf095f93e09a936f
- Timestamp:
- 09/27/11 06:28:12 (2 years ago)
- git-parent:
[559e017dc530d5467cb14742be11d9f328bf4e01], [4d67783cefed3fcbb1d0054cfd469b63262bc00c]
- Files:
-
- src/modules-lua/noit/module/tcp.lua (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/modules-lua/noit/module/tcp.lua
r5f14683 ra751ee3 44 44 <parameter name="banner_match" required="optional" 45 45 allowed=".+">This regular expression is matched against the response banner. If a match is not found, the check will be marked as bad.</parameter> 46 <parameter name="send_body" required="optional" 47 allowed=".+">Data to send on the socket once connected and optionally SSL is negotiated, but before the body match is tested.</parameter> 48 <parameter name="body_match" required="optional" 49 allowed=".+">This regular expression is matched against the body (the leftover data up to 1024 bytes) after the banner.</parameter> 46 50 <parameter name="use_ssl" required="optional" allowed="^(?:true|false|on|off)$" default="false">Upgrade TCP connection to use SSL.</parameter> 47 51 <parameter name="ca_chain" … … 177 181 end 178 182 183 if check.config.send_body ~= nil then 184 if e:write(check.config.send_body) < 0 then 185 check.bad() 186 check.status("send_body: received hangup") 187 return 188 end 189 end 179 190 180 191 -- match banner … … 205 216 end 206 217 218 -- match body 219 if check.config.body_match ~= nil then 220 str = e:read(1024) 221 if str == nil then 222 check.status("bad body length " .. (str and str:len() or "0")) 223 return 224 end 225 local bodybytetime = noit.timeval.now() 226 elapsed(check, "tt_body", starttime, bodybytetime) 227 228 local exre = noit.pcre(check.config.body_match) 229 local rv = true 230 local found = false 231 local m = nil 232 while rv and m ~= '' do 233 rv, m, key, value = exre(str or '', { limit = pcre_match_limit }) 234 if rv then 235 found = true 236 if key ~= nil then 237 check.metric(key, value) 238 end 239 end 240 end 241 242 if found then 243 status = status .. ',body_match=matched' 244 else 245 good = false 246 status = status .. ',body_match=failed' 247 end 248 249 check.metric_string('body',str) 250 end 251 207 252 -- turnaround time 208 253 local endtime = noit.timeval.now()
