* HTTP.cpp : add internal function gen_rfc1123_date()

This commit is contained in:
hagen 2016-05-24 00:00:00 +00:00
parent a461f462d2
commit 70e9d85a75

View File

@ -8,6 +8,7 @@
#include "HTTP.h"
#include <algorithm>
#include <ctime>
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);