Skip to content

Commit

Permalink
feat(http): add an option mark to set SO_MARK
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Mar 13, 2024
1 parent 5719639 commit 98e842b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion http/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ function methods:request(method, url, body, opts)
headers[k:lower()] = v
end

local answers, err = dns.query(host, { type = opts.ipv6 and dns.TYPE_AAAA or dns.TYPE_A })
local answers, err = dns.query(host, {
type = opts.ipv6 and dns.TYPE_AAAA or dns.TYPE_A,
mark = opts.mark
})
if not answers then
return nil, 'resolve "' .. host .. '" fail: ' .. err
end
Expand Down Expand Up @@ -426,6 +429,7 @@ end
insecure: A boolean, SSL connecting with insecure.
ipv6: A boolean, parse ipv6 address for host.
body_to_file: A string indicates that the body is to be written to the file.
mark: a number used to set SO_MARK to socket
In case of failure, the function returns nil followed by an error message.
If successful, returns a table contains the
Expand Down

0 comments on commit 98e842b

Please sign in to comment.