mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
* HTTP.cpp : add internal function gen_rfc1123_date()
This commit is contained in:
8
HTTP.cpp
8
HTTP.cpp
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "HTTP.h"
|
#include "HTTP.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
namespace i2p {
|
namespace i2p {
|
||||||
namespace http {
|
namespace http {
|
||||||
@@ -54,6 +55,13 @@ namespace http {
|
|||||||
return true;
|
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) {
|
bool URL::parse(const char *str, std::size_t len) {
|
||||||
std::string url(str, len ? len : strlen(str));
|
std::string url(str, len ? len : strlen(str));
|
||||||
return parse(url);
|
return parse(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user