Seafire-Protocol/seafire/protocol/rfc7232/if-unmodified-since.hxx
2025-03-07 22:15:49 +01:00

39 lines
921 B
C++

#ifndef seafire__protocol__rfc7232__if_unmodified_since_hxx_
#define seafire__protocol__rfc7232__if_unmodified_since_hxx_
#include <seafire/protocol/rfc7232/entity-tag.hxx>
#include <optional>
#include <string>
#include <system_error>
#include <vector>
namespace seafire::protocol::rfc7232
{
struct if_unmodified_since_t
{
using alias_type = std::chrono::system_clock::time_point;
static constexpr const char name[] = "if-unmodified-since";
static std::string
to_string(std::chrono::system_clock::time_point const& point_in_time)
{
return format_http_date(point_in_time);
}
static std::optional<std::chrono::system_clock::time_point>
try_parse(std::vector<std::string> const& strings, std::error_code& ec)
{
if (strings.empty())
return {};
return try_parse_http_date(strings.front());
}
};
} // namespace seafire::protocol::rfc7232
#endif