class static_file
#
-
class static_file#
Provides a wrapper for handling static file response.
Public Functions
-
inline auto etag() const noexcept -> const http::header::entity_tag&#
Get
ETag
that will be used when converting toresponse
.
-
inline auto content_type() const noexcept -> const mime::mime_view&#
Get
Content-Type
that will be used when converting toresponse
.
-
inline void set_content_type(mime::mime_view mime) noexcept#
Set the
Content-Type
header that will be used when converting toresponse
.
-
inline auto content_disposition() const noexcept -> const std::string&#
Get
Content-Disposition
that will be used when converting toresponse
.
-
inline auto file() const noexcept -> const stream_file&#
Get the reference to the underlying
stream_file
.
-
inline auto file() noexcept -> stream_file&#
Get the reference to the underlying
stream_file
.
-
inline auto release() -> stream_file#
Release the underlying
stream_file
object.
Public Static Functions
-
static inline auto open(const executor_type &ex, const std::string &path) -> expected<static_file, std::error_code>#
Open file with read-only permission.
- DESCRIPTION
Open file with read-only permission.
Content-Type
/Content-Disposition
headers for theresponse
will be obtained from the provided file extension.
-
static inline auto open(const executor_type &ex, const std::string &path, const request &req) -> expected<static_file, std::error_code>#
Open file with read-only permission.
- DESCRIPTION
Open file with read-only permission.
Range
/If-None-Match
/If-Modified-Since
headers from therequest
will be handled automatically, andContent-Type
/Content-Disposition
headers for theresponse
will be obtained from the provided file extension.
-
inline auto etag() const noexcept -> const http::header::entity_tag&#