#include <ResponseBody.hpp>
|
| | BodyInMemory (std::string const &) |
| ssize_t | read (char *buffer, size_t size) |
| | Reads a chunk of the body into the provided buffer. This is a non-blocking operation.
|
| size_t | size () const |
| | Returns the total size of the body in bytes, if known.
|
| bool | isDone () const |
| | Checks if the body source has been fully read.
|
| Public Member Functions inherited from http::IResponseBody |
| | IResponseBody () |
| virtual | ~IResponseBody () |
| virtual int | getEventSourceFd () const |
| | Retrieves the file descriptor for event-driven body sources.
|
| virtual bool | hasHeaderParsing () const |
| | Indicates if the data read from this source contains HTTP headers that need to be parsed by the server (e.g., CGI output).
|
◆ BodyInMemory()
| http::BodyInMemory::BodyInMemory |
( |
std::string const & | body | ) |
|
|
explicit |
◆ isDone()
| bool http::BodyInMemory::isDone |
( |
| ) |
const |
|
virtual |
Checks if the body source has been fully read.
- Returns
- true if the source is depleted (EOF has been reached), false otherwise.
Implements http::IResponseBody.
◆ read()
| ssize_t http::BodyInMemory::read |
( |
char * | buffer, |
|
|
size_t | size ) |
|
virtual |
Reads a chunk of the body into the provided buffer. This is a non-blocking operation.
- Parameters
-
| buffer | An output buffer to write data into. |
| size | The maximum size of the buffer. |
- Returns
- The number of bytes read ( > 0).
-
0 on End-of-File (EOF).
-
-1 on error. errno may be set (e.g., to EAGAIN/EWOULDBLOCK if the source is not ready).
Implements http::IResponseBody.
◆ size()
| size_t http::BodyInMemory::size |
( |
| ) |
const |
|
virtual |
Returns the total size of the body in bytes, if known.
- Returns
- The total content length. Returns 0 or (size_t)-1 if the size is unknown (e.g., for a streaming CGI response).
Implements http::IResponseBody.
◆ body_
| std::string http::BodyInMemory::body_ |
|
private |
◆ bytesRead_
| size_t http::BodyInMemory::bytesRead_ |
|
private |
The documentation for this class was generated from the following files: