]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/docs/api/mg_download.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / 3rdparty / civetweb / docs / api / mg_download.md
1 # Civetweb API Reference
2
3 ### `mg_download( host, port, use_ssl, error_buffer, error_buffer_size, fmt, ... );`
4
5 ### Parameters
6
7 | Parameter | Type | Description |
8 | :--- | :--- | :--- |
9 |**`host`**|`const char *`|The hostname or IP address of the server|
10 |**`port`**|`int`|The port number on the server|
11 |**`use_ssl`**|`int`|Use SSL if this value is not equal zero|
12 |**`error_buffer`**|`char *`|Buffer to store an error message|
13 |**`error_buffer_size`**|`size_t`|Size of the error message buffer including the terminating NUL|
14 |**`fmt`**|`const char *`|Format string specifying the remote command to execute|
15 |**`...`**|*various*|Parameters used in the format string|
16
17 ### Return Value
18
19 | Type | Description |
20 | :--- | :--- |
21 |`struct mg_connection *`|A pointer to the connection structure if successful and NULL otherwise|
22
23 ### Description
24
25 The `mg_download()` function is used to download data from a remote webserver. The server address can either be specified as a hostname or IP address and SSL can be used if needed. If the function succeeds, a pointer is returned to a connection structure. The connection must be closed with a call to the [`mg_close_connection()`](mg_close_connection.md) function.
26
27 The format string is a format string from the `printf()` series of functions to specify the remote command. An example to get the main index page from Google is the following call:
28
29 `conn = mg_download( "google.com", 80, 0, ebuf, sizeof(ebuf),
30 "%s", "GET / HTTP/1.0\r\nHost: google.com\r\n\r\n" );`
31
32 Please note that although Civetweb supports both IPv4 and IPv6 communication that IPv6 addressing is only available if it was enabled at compile time. When running an application it is possible to check if IPv6 support has been compiled in by using the [`mg_check_feature()`](md_check_feature.md) function with the parameter `USE_IPV6`.
33
34 ### See Also
35
36 * [`mg_check_feature();`](mg_check_feature.md)
37 * [`mg_close_connection();`](mg_close_connection.md)