diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/civetweb/docs/api/mg_send_chunk.md | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/civetweb/docs/api/mg_send_chunk.md')
-rw-r--r-- | src/civetweb/docs/api/mg_send_chunk.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/civetweb/docs/api/mg_send_chunk.md b/src/civetweb/docs/api/mg_send_chunk.md new file mode 100644 index 000000000..895ffdc30 --- /dev/null +++ b/src/civetweb/docs/api/mg_send_chunk.md @@ -0,0 +1,31 @@ +# Civetweb API Reference + +### `mg_send_chunk( conn, buf, len );` + +### Parameters + +| Parameter | Type | Description | +| :--- | :--- | :--- | +|**`conn`**|`struct mg_connection *`| A pointer to the connection to be used to send data | +|**`chunk`**|`const void *`| A pointer to the blob of information to be sent | +|**`chunk_len`**|`size_t`| The amount of bytes to be sent | + +### Return Value + +| Type | Description | +| :--- | :--- | +|`int`| An integer indicating the amount of bytes sent, or failure | + +### Description + +The function `mg_send_chunk()` can be used to send a blob of arbitrary data over a connection. +Only use this function after sending a complete HTTP request or response header with "Transfer-Encoding: chunked" set. Otherwise: use `mg_write()`. +The function returns a number **>0** if data was sent, the value **0** when the connection has been closed, and **-1** in case of an error. + +### See Also + +* [`mg_write();`](mg_write.md) +* [`mg_printf();`](mg_print.md) +* [`mg_lock_connection();`](mg_lock_connection.md) +* [`mg_unlock_connection();`](mg_unlock_connection.md) + |