ne_set_request_body_buffer
Prev | neon API reference | Next

## Name

ne_set_request_body_buffer, ne_set_request_body_fd, ne_set_request_body_fd64 — include a message body with a request

## Synopsis

    #include <ne_request.h>

``void ne_set_request_body_buffer(`ne_request *req, const char *buf, size_t count`)`;`
``int ne_set_request_body_fd(`ne_request *req, int fd, off_t begin, off_t length`)`;`
``int ne_set_request_body_fd64(`ne_request *req, int fd, off64_t begin, off64_t length`)`;`

## Description

The `ne_set_request_body_buffer` function specifies that a message body should be included with the body, which is stored in the `count` bytes buffer `buf`.

The `ne_set_request_body_fd` function can be used to include a message body with a request which is read from a file descriptor. The body is read from the file descriptor `fd`, which must be a associated with a seekable file (not a pipe, socket, or FIFO). `count` bytes are read, beginning at offset `begin` (hence, passing `begin` as zero means the body is read from the beginning of the file).

If the `NE_LFS` macro is defined, then the `ne_set_request_body_fd64` function is also available, to provide large file support. This function can be used on 32-bit platforms supporting the LFS standard; the `offset` and `length` parameters can then be passed as 64-bit values. When using large files, `fd` must be opened using `open64` or by passing the `O_LARGEFILE` flag to `open`.

For all the above functions, the source of the request body must survive until the request has been dispatched; neither the memory buffer passed to `ne_set_request_body_buffer` nor the file descriptor passed to `ne_set_request_body_fd` or `ne_set_request_body_fd64` are copied internally.

## See also

ne_request_create

Prev | Up | Next
ne_set_request_expect100 | Home | ne_set_server_auth