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
ETagthat will be used when converting toresponse.
-
inline auto content_type() const noexcept -> const mime::mime_view&#
Get
Content-Typethat will be used when converting toresponse.
-
inline void set_content_type(mime::mime_view mime) noexcept#
Set the
Content-Typeheader that will be used when converting toresponse.
-
inline auto content_disposition() const noexcept -> const std::string&#
Get
Content-Dispositionthat 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_fileobject.
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-Dispositionheaders for theresponsewill 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-Sinceheaders from therequestwill be handled automatically, andContent-Type/Content-Dispositionheaders for theresponsewill be obtained from the provided file extension.
-
inline auto etag() const noexcept -> const http::header::entity_tag&#