#include <ResponseBody.hpp>
|
| | BodyFromCgi (int pipeFd, bool hasHeaderParsing) |
| | ~BodyFromCgi () |
| 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.
|
| int | getEventSourceFd () const |
| | Retrieves the file descriptor for event-driven body sources.
|
| 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).
|
| Public Member Functions inherited from http::IResponseBody |
| | IResponseBody () |
| virtual | ~IResponseBody () |
◆ BodyFromCgi() [1/2]
| http::BodyFromCgi::BodyFromCgi |
( |
int | pipeFd, |
|
|
bool | hasHeaderParsing ) |
◆ ~BodyFromCgi()
| http::BodyFromCgi::~BodyFromCgi |
( |
| ) |
|
◆ BodyFromCgi() [2/2]
| http::BodyFromCgi::BodyFromCgi |
( |
| ) |
|
|
private |
◆ getEventSourceFd()
| int http::BodyFromCgi::getEventSourceFd |
( |
| ) |
const |
|
virtual |
Retrieves the file descriptor for event-driven body sources.
This method is used by the Reactor to determine if the response body source requires monitoring via the event loop (epoll).
- Returns
- A non-negative file descriptor (fd >= 0) if the source is "active" (e.g., a CGI pipe) and must be watched for read events.
-
-1 if the source is "passive" (e.g., in-memory data or a standard file) and does not require epoll monitoring.
Reimplemented from http::IResponseBody.
◆ hasHeaderParsing()
| bool http::BodyFromCgi::hasHeaderParsing |
( |
| ) |
const |
|
virtual |
Indicates if the data read from this source contains HTTP headers that need to be parsed by the server (e.g., CGI output).
- Returns
- true if the Reactor should buffer and parse headers before streaming.
-
false if the data is the raw body (default).
Reimplemented from http::IResponseBody.
◆ isDone()
| bool http::BodyFromCgi::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::BodyFromCgi::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::BodyFromCgi::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.
◆ fd_
| int http::BodyFromCgi::fd_ |
|
private |
◆ hasHeaderParsing_
| bool http::BodyFromCgi::hasHeaderParsing_ |
|
private |
◆ isDone_
| bool http::BodyFromCgi::isDone_ |
|
private |
The documentation for this class was generated from the following files: