mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-07 03:48:46 +00:00
This commit provides an hlua_httpclient object which is a bridge between the httpclient and the lua API. The HTTPClient is callable in lua this way: local httpclient = core.httpclient() local response = httpclient:get("http://127.0.0.1:9000/?s=9999") core.Debug("Status: ".. res.status .. ", Reason : " .. res.reason .. ", Len:" .. string.len(res.body) .. "\n") The resulting response object will provide a "status" field which contains the status code, a "reason" string which contains the reason string, and a "body" field which contains the response body. The implementation uses the httpclient callback to wake up the lua task which yield each time it pushes some data. The httpclient works in the same thread as the lua task. |
||
---|---|---|
.. | ||
haproxy | ||
import |