diff --git a/HTTP.cpp b/HTTP.cpp index f74e9429..6747c35b 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -8,6 +8,7 @@ #include "HTTP.h" #include +#include namespace i2p { namespace http { @@ -54,6 +55,13 @@ namespace http { return true; } + void gen_rfc1123_date(std::string & out) { + std::time_t now = std::time(nullptr); + char buf[128]; + std::strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S GMT", std::gmtime(&now)); + out = buf; + } + bool URL::parse(const char *str, std::size_t len) { std::string url(str, len ? len : strlen(str)); return parse(url);