Bug #12615 ยป wt.patch
| src/http/Server.C | ||
|---|---|---|
|
LOG_DEBUG_S(&wt_, "Failed to resolve hostname \"" << address << "\" as IPv4: " <<
|
||
|
Wt::AsioWrapper::system_error(errc).what());
|
||
|
// Resolve IPv6
|
||
|
query = Wt::AsioWrapper::asio::ip::tcp::resolver::query(Wt::AsioWrapper::asio::ip::tcp::v6(), address, "http");
|
||
|
auto q = Wt::AsioWrapper::asio::ip::tcp::resolver::query(Wt::AsioWrapper::asio::ip::tcp::v6(), address, "http");
|
||
|
for (Wt::AsioWrapper::asio::ip::tcp::resolver::iterator it = resolver.resolve(query, errc);
|
||
|
!errc && it != end; ++it) {
|
||
|
result.push_back(it->endpoint().address());
|
||
| src/web/FileUtils.C | ||
|---|---|---|
|
#include "web/FileUtils.h"
|
||
|
#include <filesystem>
|
||
|
#include <boost/filesystem/operations.hpp>
|
||
|
#include "web/WebUtils.h"
|
||
| ... | ... | |
|
unsigned long long size(const std::string &file)
|
||
|
{
|
||
|
return (unsigned long long) boost::filesystem::file_size(file);
|
||
|
return (unsigned long long) std::filesystem::file_size(file);
|
||
|
}
|
||
|
std::string* fileToString(const std::string& fileName)
|
||
| ... | ... | |
|
std::chrono::system_clock::time_point lastWriteTime(const std::string &file)
|
||
|
{
|
||
|
return std::chrono::system_clock::from_time_t(boost::filesystem::last_write_time(file));
|
||
|
return std::chrono::system_clock::time_point{std::chrono::duration_cast<std::chrono::milliseconds>(std::filesystem::last_write_time(file).time_since_epoch())};
|
||
|
}
|
||
|
bool exists(const std::string &file)
|
||
|
{
|
||
|
boost::filesystem::path path(file);
|
||
|
return boost::filesystem::exists(path);
|
||
|
std::filesystem::path path(file);
|
||
|
return std::filesystem::exists(path);
|
||
|
}
|
||
|
bool isDirectory(const std::string &file)
|
||
|
{
|
||
|
boost::filesystem::path path(file);
|
||
|
return boost::filesystem::is_directory(path);
|
||
|
std::filesystem::path path(file);
|
||
|
return std::filesystem::is_directory(path);
|
||
|
}
|
||
|
void listFiles(const std::string &directory,
|
||
|
std::vector<std::string> &files)
|
||
|
{
|
||
|
boost::filesystem::path path(directory);
|
||
|
boost::filesystem::directory_iterator end_itr;
|
||
|
std::filesystem::path path(directory);
|
||
|
std::filesystem::directory_iterator end_itr;
|
||
|
if (!boost::filesystem::is_directory(path)) {
|
||
|
if (!std::filesystem::is_directory(path)) {
|
||
|
std::string error
|
||
|
= "listFiles: \"" + directory + "\" is not a directory";
|
||
|
LOG_ERROR(error);
|
||
|
throw WException(error);
|
||
|
}
|
||
|
for (boost::filesystem::directory_iterator i(path); i != end_itr; ++i) {
|
||
|
for (std::filesystem::directory_iterator i(path); i != end_itr; ++i) {
|
||
|
std::string f = (*i).path().string();
|
||
|
files.push_back(f);
|
||
|
}
|
||