Changeset 801a7a7a883d444a9d4f0dd3d8627bf0b2dde5b1

Show
Ignore:
Timestamp:
05/09/11 18:30:38 (3 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1304965838 -0400
git-parent:

[cf7b26ddb90b3af00507f136770962d5ff029f77]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1304965838 -0400
Message:

Performance optimization on HTTP requests.
The previous code was splitting up a single request into multiple
packets. Now, we assemble the whole request into a single write.

Files:

Legend:

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

    rf60d872 r801a7a7  
    6363    self.raw_bytes = 0 
    6464    self.content_bytes = 0 
    65     self.e:write(method .. " " .. uri .. " " .. "HTTP/1.1\r\n") 
     65    local sstr = method .. " " .. uri .. " " .. "HTTP/1.1\r\n" 
    6666    headers["Content-Length"] = nil 
    6767    if payload ~= nil and string.len(payload) > 0 then 
     
    7373    end 
    7474    for header, value in pairs(headers) do 
    75       if value ~= nil then self.e:write(header .. ": " .. value .. "\r\n") end 
    76     end 
    77     self.e:write("\r\n") 
     75      if value ~= nil then sstr = sstr .. header .. ": " .. value .. "\r\n" end 
     76    end 
     77    sstr = sstr .. "\r\n" 
    7878    if payload ~= nil and string.len(payload) > 0 then 
    79       self.e:write(payload) 
    80     end 
     79      sstr = sstr .. payload 
     80    end 
     81    self.e:write(sstr) 
    8182end 
    8283