table of contents
| NE_READ_RESPONSE_TO_(3) | neon API reference | NE_READ_RESPONSE_TO_(3) |
NAME¶
ne_read_response_to_fd, ne_read_response_to_buffer - read a response body
SYNOPSIS¶
#include <ne_request.h>
int ne_read_response_to_fd(ne_request *req, int fd);
int ne_read_response_to_buffer(ne_request *req, char *data, size_t *buflen);
DESCRIPTION¶
To read an HTTP response body the functions ne_read_response_to_fd and ne_read_response_to_buffer can be used. These functions are wrappers for ne_read_response_block and must be called only after ne_begin_request has been called successfully for the request.
The ne_read_response_to_fd function writes the response body content to the file descriptor passed as the fd parameter.
The ne_read_response_to_buffer function writes the response body content to the buffer passed as the buf parameter, which has length passed via the *buflen parameter. On success, the *buflen is updated with the number of bytes written to the buffer.
After the response body has been read successfully, ne_end_request must be called. If a failure occurs while reading the response body, the connection must be closed using ne_close_connection.
RETURN VALUE¶
Both functions return zero on success, or an NE_* error code on failure. The ne_read_response_to_buffer function returns NE_FAILED if the response message length is larger than the buffer length.
HISTORY¶
ne_read_response_to_buffer is available in neon 0.36.0 and later.
SEE ALSO¶
ne_request_create, ne_set_error
COPYRIGHT¶
Copyright © 2001-2025 Joe Orton
| 28 November 2025 | neon 0.0.0-dev |