http
The http library allows either the server or client to communicate with external websites via HTTP, both GET
(http.Fetch) and POST
(http.Post) are supported. A more powerful & advanced method can be used via the global HTTP function.
Methods
Launches an asynchronous GET request to an HTTP server. Internally calls HTTP.
HTTP requests returning a status code >= 400 are still considered a success and will call the onSuccess callback.
The onFailure callback is usually only called on DNS or TCP errors (e. g. the website is unavailable or the domain does not exist).
A rough overview of possible onFailure messages:
invalid url - Invalid/empty url ( no request was attempted )
invalid request - Steam HTTP lib failed to create a HTTP request
error - OnComplete callback's second argument, bError, is true
unsuccessful - OnComplete's first argument, pResult->m_bRequestSuccessful, returned false
This cannot send or receive multiple headers with the same name. Issue Tracker: 2232HTTP-requests that respond with a large body may return an unsuccessful error. Try using the Range header to download the file in chunks. HTTP-requests to destinations on private networks (such as 192. 168. 0. 1, or 127. 0. 0. 1) won't work.
To enable HTTP-requests to destinations on private networks use Command Line Parameters -allowlocalhttp. (Dedicated servers only)
Not all headers are allowed in the client realm, here is a list of known blacklisted headers inside the client realm:
host
expect
content-length
proxy-authenticate
accept-charset
connection
accept-encoding
origin
date
http.Post( string url, table parameters, function onSuccess = nil, function onFailure = nil, table headers = {} )
Sends an asynchronous POST request to an HTTP server. Internally calls HTTP.
HTTP requests returning a status code >= 400 are still considered a success and will call the onSuccess callback.
The onFailure callback is usually only called on DNS or TCP errors (e. g. the website is unavailable or the domain does not exist).
This cannot send or receive multiple headers with the same name. Issue Tracker: 2232HTTP-requests that respond with a large body may return an unsuccessful error. Try using the Range header to download the file in chunks. HTTP-requests to destinations on private networks (such as 192. 168. 0. 1, or 127. 0. 0. 1) won't work.
To enable HTTP-requests to destinations on private networks use Command Line Parameters -allowlocalhttp. (Dedicated servers only)