Browse Source

* HTTP.cpp : add internal function gen_rfc1123_date()

pull/503/head
hagen 9 years ago
parent
commit
70e9d85a75
  1. 8
      HTTP.cpp

8
HTTP.cpp

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
#include "HTTP.h"
#include <algorithm>
#include <ctime>
namespace i2p {
namespace http {
@ -54,6 +55,13 @@ 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);

Loading…
Cancel
Save