mirror of
https://github.com/lammertb/libhttp.git
synced 2026-01-03 16:02:30 +03:00
Add response timeout function (issue #48)
Add the code by rscreene contributed by rscreene to civetweb. This cannot be done with automatic merge of the pull request, since the repositorie seem to be too different. So it is reimplemented at the current main line, with some adjustments.
This commit is contained in:
@@ -616,8 +616,23 @@ CIVETWEB_API struct mg_connection *mg_connect_websocket_client(const char *host,
|
||||
CIVETWEB_API struct mg_connection *mg_connect_client(const char *host, int port, int use_ssl,
|
||||
char *error_buffer, size_t error_buffer_size);
|
||||
|
||||
/* TODO: */
|
||||
/* CIVETWEB_API int mg_get_response(struct mg_connection *conn, char *ebuf, size_t ebuf_len); */
|
||||
|
||||
enum {
|
||||
TIMEOUT_INFINITE = -1
|
||||
};
|
||||
|
||||
/* Wait for a response from the server
|
||||
Parameters:
|
||||
conn: connection
|
||||
ebuf, ebuf_len: error message placeholder.
|
||||
timeout: time to wait for a response in milliseconds (if < 0 then wait forever)
|
||||
|
||||
Return:
|
||||
On success, >= 0
|
||||
On error/timeout, < 0
|
||||
*/
|
||||
CIVETWEB_API int mg_get_response(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int timeout);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user