Changeset 09603d13f50b9162de5f1e183128d6c6663ee59c

Show
Ignore:
Timestamp:
04/26/12 15:58:45 (2 years ago)
Author:
Philip Maddox <pmaddox@circonus.com>
git-committer:
Philip Maddox <pmaddox@circonus.com> 1335455925 +0000
git-parent:

[add4f486f20b6917e51f1603859d657476297871]

git-author:
Philip Maddox <pmaddox@circonus.com> 1335455925 +0000
Message:

Fixed a byte where tt_connect was getting junk values when there were redirects in the HTTP check

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules-lua/noit/module/http.lua

    rcc06de2 r09603d1  
    252252    local next_location 
    253253    local cookies = { } 
     254    local setfirstbyte = 1 
    254255 
    255256    -- callbacks from the HttpClient 
    256257    local callbacks = { } 
    257258    callbacks.consume = function (str) 
    258         if firstbytetime == nil then firstbytetime = noit.timeval.now() end 
     259        if setfirstbyte == 1 then 
     260            firstbytetime = noit.timeval.now() 
     261            setfirstbyte = 0 
     262        end 
    259263        output = output .. (str or '') 
    260264    end 
     
    339343    -- artificially increase redirects as the initial request counts 
    340344    redirects = redirects + 1 
     345    starttime = noit.timeval.now() 
    341346    repeat 
    342         starttime = noit.timeval.now() 
    343347        local optclient = HttpClient:new(callbacks) 
    344348        local rv, err = optclient:connect(target, port, use_ssl) 
     
    350354        optclient:do_request(method, uri, headers, payload) 
    351355        optclient:get_response(read_limit) 
     356        setfirstbyte = 1 
    352357 
    353358        redirects = redirects - 1