On Thu, Nov 29, 2018 at 09:03:34AM +0100, Willy Tarreau wrote:
> OK thanks, I'll take a look at it once I've flushed my pending stuff on
> H2+HTX :-(

Great, I had my morning coffee and visited my optometrist, so here is
a fixed test script (correctly setting Host header).

P.S.
Lua usually suffers trying to do things in tasks, I don't think this is
the first time something gets broken. Can we make reg test with Lua
script (maybe strip out LuaSocket requirement)?

Best regards,
-- 
Adis Nezirovic
Software Engineer
HAProxy Technologies - Powering your uptime!
375 Totten Pond Road, Suite 302 | Waltham, MA 02451, US
+1 (844) 222-4340 | https://www.haproxy.com
local http = require 'socket.http'
local ltn12 = require 'ltn12'

local function main(applet)
end

local function cron()
    local headers = {
        host = 'www.haproxy.org'
    }
    local content = {}

    while true do
        core.Debug('CRON')
        local b, c, h = http.request {
            method='GET',
            headers=headers,
            url = 'http://51.15.8.218',
            sink = ltn12.sink.table(content),
            redirect = false,
            create = core.tcp
        }
        core.Debug(tostring(c))
        core.msleep(1000)
    end
end

core.register_service("cron", "http", main)
core.register_task(cron)
global
    log /dev/log local0 debug
    nbproc 1
    daemon
    lua-load cron.lua

defaults
    log global
    mode http
    option httplog
    timeout connect 5s
    timeout client 10s
    timeout server 10s

frontend cron
    bind 127.0.0.1:9000
    http-request use-service lua.cron

Reply via email to