flatten 20260225
This commit is contained in:
53
tjp/core/internet/Headers.hpp
Executable file
53
tjp/core/internet/Headers.hpp
Executable file
@@ -0,0 +1,53 @@
|
||||
// TJP COPYRIGHT HEADER
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tjp/core/string/String.h>
|
||||
#include <tjp/core/containers/Tuple.h>
|
||||
#include <tjp/core/containers/Vector.h>
|
||||
#include <tjp/core/containers/Tuple.h>
|
||||
#include <tjp/core/containers/Optional.h>
|
||||
#include <tjp/core/string/StringView.h>
|
||||
#include <tjp/core/types/Types.h>
|
||||
|
||||
#include <ctime>
|
||||
|
||||
namespace tjp::core::internet {
|
||||
|
||||
using Header = Tuple<String, String>;
|
||||
using Headers = Vector<Header>;
|
||||
|
||||
const String *getHeader(const Headers &, StringView name);
|
||||
|
||||
using ContentRange = Tuple<s64, s64, s64>;
|
||||
using Range = Tuple<s64, s64>;
|
||||
|
||||
Optional<s64> parseStatusCode(const String &);
|
||||
Optional<std::time_t> parseDate(const String &);
|
||||
Optional<s64> parseContentSize(const String &);
|
||||
Optional<ContentRange> parseContentRange(const String &);
|
||||
Optional<Range> parseRange(const String &);
|
||||
|
||||
Optional<String> getType(const Headers &);
|
||||
Optional<String> getCacheControl(const Headers &);
|
||||
Optional<String> getLocation(const Headers &);
|
||||
Optional<String> getContentLocation(const Headers &);
|
||||
Optional<String> getCookie(const Headers &);
|
||||
Optional<std::time_t> getDate(const Headers &);
|
||||
Optional<std::time_t> getLastModified(const Headers &);
|
||||
String makeDateHeader(std::time_t);
|
||||
String makeLastModifiedheader(std::time_t);
|
||||
|
||||
Optional<s64> getContentSize(const Headers &);
|
||||
Optional<ContentRange> getContentRange(const Headers &);
|
||||
String makeContentRange(ContentRange);
|
||||
String makeRange(Range);
|
||||
|
||||
Optional<s64> getCacheControlMaxAge(const String &);
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifdef TJP_CORE_HEADER_ONLY
|
||||
#include "Headers.cpp"
|
||||
#endif
|
||||
Reference in New Issue
Block a user