maph 1.0.0 High-Performance Memory-Mapped Key-Value Database with O(1) Lookups

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
httplib::Response Struct Reference

`#include <httplib.h>`

Collaboration diagram for httplib::Response:

## Public Member Functions
bool | has_header (const std::string &key) const
std::string | get_header_value (const std::string &key, const char *def="", size_t id=0) const
size_t | get_header_value_u64 (const std::string &key, size_t def=0, size_t id=0) const
size_t | get_header_value_count (const std::string &key) const
void | set_header (const std::string &key, const std::string &val)
bool | has_trailer (const std::string &key) const
std::string | get_trailer_value (const std::string &key, size_t id=0) const
size_t | get_trailer_value_count (const std::string &key) const
void | set_redirect (const std::string &url, int status=StatusCode::Found_302)
void | set_content (const char *s, size_t n, const std::string &content_type)
void | set_content (const std::string &s, const std::string &content_type)
void | set_content (std::string &&s, const std::string &content_type)
void | set_content_provider (size_t length, const std::string &content_type, ContentProvider provider, ContentProviderResourceReleaser resource_releaser=nullptr)
void | set_content_provider (const std::string &content_type, ContentProviderWithoutLength provider, ContentProviderResourceReleaser resource_releaser=nullptr)
void | set_chunked_content_provider (const std::string &content_type, ContentProviderWithoutLength provider, ContentProviderResourceReleaser resource_releaser=nullptr)
void | set_file_content (const std::string &path, const std::string &content_type)
void | set_file_content (const std::string &path)
| Response ()=default
| Response (const Response &)=default
Response & | operator= (const Response &)=default
| Response (Response &&)=default
Response & | operator= (Response &&)=default
| ~Response ()

## Public Attributes
std::string | version
int | status = -1
std::string | reason
Headers | headers
Headers | trailers
std::string | body
std::string | location
size_t | content_length_ = 0
ContentProvider | content_provider_
ContentProviderResourceReleaser | content_provider_resource_releaser_
bool | is_chunked_content_provider_ = false
bool | content_provider_success_ = false
std::string | file_content_path_
std::string | file_content_content_type_

## Detailed Description

Definition at line 777 of file httplib.h.

## Constructor & Destructor Documentation

## ◆ Response() [1/3]

httplib::Response::Response | ( |  | ) |
| default

## ◆ Response() [2/3]

httplib::Response::Response | ( | const Response & |  | ) |
| default

## ◆ Response() [3/3]

httplib::Response::Response | ( | Response && |  | ) |
| default

## ◆ ~Response()

httplib::Response::~Response | ( |  | ) |
| inline

Definition at line 824 of file httplib.h.

References content_provider_resource_releaser_, and content_provider_success_.

## Member Function Documentation

## ◆ get_header_value()

std::string httplib::Response::get_header_value | ( | const std::string & | key,
|  | const char * | def = `""`,
|  | size_t | id = `0`
| ) |  | const
| inline

Definition at line 6857 of file httplib.h.

## ◆ get_header_value_count()

size_t httplib::Response::get_header_value_count | ( | const std::string & | key | ) | const
| inline

Definition at line 6863 of file httplib.h.

## ◆ get_header_value_u64()

size_t httplib::Response::get_header_value_u64 | ( | const std::string & | key,
|  | size_t | def = `0`,
|  | size_t | id = `0`
| ) |  | const
| inline

Definition at line 2084 of file httplib.h.

References headers.

Referenced by httplib::ClientImpl::process_request().

Here is the caller graph for this function:

## ◆ get_trailer_value()

std::string httplib::Response::get_trailer_value | ( | const std::string & | key,
|  | size_t | id = `0`
| ) |  | const
| inline

Definition at line 6879 of file httplib.h.

## ◆ get_trailer_value_count()

size_t httplib::Response::get_trailer_value_count | ( | const std::string & | key | ) | const
| inline

Definition at line 6888 of file httplib.h.

## ◆ has_header()

bool httplib::Response::has_header | ( | const std::string & | key | ) | const
| inline

Definition at line 6853 of file httplib.h.

Referenced by httplib::ClientImpl::process_request().

Here is the caller graph for this function:

## ◆ has_trailer()

bool httplib::Response::has_trailer | ( | const std::string & | key | ) | const
| inline

Definition at line 6875 of file httplib.h.

## ◆ operator=() [1/2]

Response & httplib::Response::operator= | ( | const Response & |  | ) |
| default

## ◆ operator=() [2/2]

Response & httplib::Response::operator= | ( | Response && |  | ) |
| default

## ◆ set_chunked_content_provider()

void httplib::Response::set_chunked_content_provider | ( | const std::string & | content_type,
|  | ContentProviderWithoutLength | provider,
|  | ContentProviderResourceReleaser | resource_releaser = `nullptr`
| ) |  |
| inline

Definition at line 6947 of file httplib.h.

## ◆ set_content() [1/3]

void httplib::Response::set_content | ( | const char * | s,
|  | size_t | n,
|  | const std::string & | content_type
| ) |  |
| inline

Definition at line 6904 of file httplib.h.

Referenced by main().

Here is the caller graph for this function:

## ◆ set_content() [2/3]

void httplib::Response::set_content | ( | const std::string & | s,
|  | const std::string & | content_type
| ) |  |
| inline

Definition at line 6913 of file httplib.h.

## ◆ set_content() [3/3]

void httplib::Response::set_content | ( | std::string && | s,
|  | const std::string & | content_type
| ) |  |
| inline

Definition at line 6918 of file httplib.h.

## ◆ set_content_provider() [1/2]

void httplib::Response::set_content_provider | ( | const std::string & | content_type,
|  | ContentProviderWithoutLength | provider,
|  | ContentProviderResourceReleaser | resource_releaser = `nullptr`
| ) |  |
| inline

Definition at line 6937 of file httplib.h.

## ◆ set_content_provider() [2/2]

void httplib::Response::set_content_provider | ( | size_t | length,
|  | const std::string & | content_type,
|  | ContentProvider | provider,
|  | ContentProviderResourceReleaser | resource_releaser = `nullptr`
| ) |  |
| inline

Definition at line 6927 of file httplib.h.

Referenced by httplib::Server::process_request().

Here is the caller graph for this function:

## ◆ set_file_content() [1/2]

void httplib::Response::set_file_content | ( | const std::string & | path | ) |
| inline

Definition at line 6963 of file httplib.h.

## ◆ set_file_content() [2/2]

void httplib::Response::set_file_content | ( | const std::string & | path,
|  | const std::string & | content_type
| ) |  |
| inline

Definition at line 6957 of file httplib.h.

## ◆ set_header()

void httplib::Response::set_header | ( | const std::string & | key,
|  | const std::string & | val
| ) |  |
| inline

Definition at line 6868 of file httplib.h.

Referenced by main(), and httplib::Server::process_request().

Here is the caller graph for this function:

## ◆ set_redirect()

void httplib::Response::set_redirect | ( | const std::string & | url,
|  | int | status = `StatusCode::Found_302`
| ) |  |
| inline

Definition at line 6893 of file httplib.h.

## Member Data Documentation

## ◆ body

std::string httplib::Response::body

Definition at line 783 of file httplib.h.

Referenced by httplib::Server::process_request(), and httplib::ClientImpl::process_request().

## ◆ content_length_

size_t httplib::Response::content_length_ = 0

Definition at line 831 of file httplib.h.

Referenced by httplib::Server::process_request().

## ◆ content_provider_

ContentProvider httplib::Response::content_provider_

Definition at line 832 of file httplib.h.

Referenced by httplib::Server::process_request().

## ◆ content_provider_resource_releaser_

ContentProviderResourceReleaser httplib::Response::content_provider_resource_releaser_

Definition at line 833 of file httplib.h.

Referenced by ~Response().

## ◆ content_provider_success_

bool httplib::Response::content_provider_success_ = false

Definition at line 835 of file httplib.h.

Referenced by ~Response().

## ◆ file_content_content_type_

std::string httplib::Response::file_content_content_type_

Definition at line 837 of file httplib.h.

Referenced by httplib::Server::process_request().

## ◆ file_content_path_

std::string httplib::Response::file_content_path_

Definition at line 836 of file httplib.h.

Referenced by httplib::Server::process_request().

## ◆ headers

Headers httplib::Response::headers

Definition at line 781 of file httplib.h.

Referenced by get_header_value_u64(), httplib::Server::process_request(), and httplib::ClientImpl::process_request().

## ◆ is_chunked_content_provider_

bool httplib::Response::is_chunked_content_provider_ = false

Definition at line 834 of file httplib.h.

## ◆ location

std::string httplib::Response::location

Definition at line 784 of file httplib.h.

## ◆ reason

std::string httplib::Response::reason

Definition at line 780 of file httplib.h.

## ◆ status

int httplib::Response::status = -1

Definition at line 779 of file httplib.h.

Referenced by main(), httplib::Server::process_request(), and httplib::ClientImpl::process_request().

## ◆ trailers

Headers httplib::Response::trailers

Definition at line 782 of file httplib.h.

## ◆ version

std::string httplib::Response::version

Definition at line 778 of file httplib.h.

Referenced by httplib::Server::process_request().

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

- integrations/rest_api/httplib.h