libfilezilla 0.59.0
A cross-platform C++ library for asynchronous and networked applications
Loading...
Searching...
No Matches
response Class Reference

A single HTTP response received by the client. More...

#include <libfilezilla/http/client_response.hpp>

Inheritance diagram for response:
Collaboration diagram for response:

Public Types

enum  flags : unsigned { flag_got_code = 0x01 , flag_got_header = 0x02 , flag_got_body = 0x04 , flag_no_body = 0x08 }

Public Member Functions

bool got_code () const
bool got_header () const
bool got_body () const
bool no_body () const
bool success () const
bool is_redirect () const
bool code_prohobits_body () const
 Some HTTP responses cannot possibly have a body.
virtual bool reset ()
Public Member Functions inherited from with_headers
std::optional< uint64_t > get_content_length () const
void set_content_length (uint64_t l)
 Sets Content-Lenght. Also clears Transfer-Encoding.
void set_chunked_encoding ()
 Sets Transfer-Encoding to chunked. Also clears Content-Length.
bool chunked_encoding () const
 Whether chunked encoding is used.
void set_content_type (std::string content_type)
std::string get_header (std::string const &key) const
bool keep_alive () const

Public Attributes

unsigned int code_ {}
std::string reason_
unsigned int flags_ {}
std::function< continuation(std::shared_ptr< request_response_interface > const &)> on_header_
 Called once the complete header has been received.
std::unique_ptr< fz::writer_base > writer_
 Writer isn't used if !success(), failure responses always go into body_.
fz::buffer body_
 Holds error body and success body if there is no writer.
size_t max_body_size_ {16 * 1024 * 1024}
 Only if body_ is used. Has no effect if writers are used.
Public Attributes inherited from with_headers
headers headers_

Detailed Description

A single HTTP response received by the client.

Has a callback to process the header before the response body is read.

Member Data Documentation

◆ on_header_

std::function<continuation(std::shared_ptr<request_response_interface> const&)> on_header_

Called once the complete header has been received.

Can be used to for example set up the writer_

Return one of: next: All is well done: When you are not interested in the request body, but continue, e.g. with next request error: Abort processing wait: not yet ready. Once ready, call next() on the client.


The documentation for this class was generated from the following file: