-
Notifications
You must be signed in to change notification settings - Fork 53
MTY_HttpAsyncRequest
Dispatch an HTTP request to the global HTTP thread pool.
void MTY_HttpAsyncRequest(
uint32_t * index,
const char * url,
const char * method,
const char * headers,
const void * body,
size_t bodySize,
const char * proxy,
uint32_t timeout,
bool image
);
index
(uint32_t *
)
The thread index to dispatch the request on. This variable acts as a pseudo context as it should be initialized to 0, then is set to a new index internally. If a request is dispatched using an index already executing, the thread is automatically cleared and the new request is dispatched to a different thread.
url
(const char *
)
The URL for the request, the scheme must be either http
or https
.
method
(const char *
)
The HTTP method, i.e. GET
or POST
.
headers
(const char *
)
HTTP header key/value pairs in the format Key:Value
separated by newline characters.
May be NULL
for no additional headers.
body
(const void *
)
Request payload.
bodySize
(size_t
)
Size in bytes of body
.
proxy
(const char *
)
The proxy URL including the port, i.e. http://example.com:1337
, or NULL
to use the OS's default proxy.
timeout
(uint32_t
)
Time the thread will wait in milliseconds for completion.
image
(bool
)
Attempt to decompress an image response. If successful, the size
argument supplied to MTY_HttpAsyncPoll
will be set to width | height << 16
.