http2_client Library¶
A simple HTTP/2 client.
Synopsis¶
Usage in LUA:
client = http2_client()
client:connect("remote.server.com", "80")
status, content = client:get("/")
print(LOG_DEBUG, status, content)
-
http2_client
()¶ Constructor.
Returns: A http2_client object Return type: http_client -
connect
(host[, port = "80"][, ssl = false][, ssl_verify = true])¶ Connect to an endpoint.
Parameters: - host (string) – The hostname or ip address to connect to.
- port (string) – The port to connect to.
- ssl (boolean) – Enable SSL for the connection.
- ssl_verify (boolean) – If SSL is enabled, this value defines if the server certificate gets verified.
-
read_timeout
(milliseconds)¶ Set the timeout in milliseconds for a read attempt. The default is set to 5000.
Parameters: milliseconds (int) – The timeout.
-
get
(path)¶ Send a GET request to a connected remote endpoint and receive the response content.
Parameters: path (string) – The path. Returns: (int, string) - The status code and the content.
-