From a207716b274fdfa746c844c96d7aeb4a46367b9d Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sat, 28 Jul 2018 11:01:02 +0200 Subject: [PATCH] Port changed --- src/client.cpp | 9 ++++++--- src/necronda-server.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 41fbe06..b717f8b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -193,8 +193,11 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col FILE *file = path.openFile(); pid_t childpid = 0; - if (!path.getNewPath().empty() && req.getMethod() != "POST") { - req.redirect(302, path.getNewPath()); + + if ((host == "necronda.net" || socket->getSocketPort() != 443) && path.getRelativeFilePath().find("/.well-known/acme-challenge/") != 0) { + req.redirect(303, "https://www.necronda.net/"); + } else if (!path.getNewPath().empty() && req.getMethod() != "POST") { + req.redirect(303, path.getNewPath()); } else { if (file == nullptr) { @@ -205,7 +208,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col if (type.find("inode/") == 0) { req.respond(403); - } else if (path.getRelativeFilePath().find("/.") != string::npos) { + } else if (path.getRelativeFilePath().find("/.") != string::npos && path.getRelativeFilePath().find("/.well-known/acme-challenge/") != 0) { req.respond(403); } else { req.setField("Content-Type", type); diff --git a/src/necronda-server.cpp b/src/necronda-server.cpp index da2ba5a..3c4fbe9 100644 --- a/src/necronda-server.cpp +++ b/src/necronda-server.cpp @@ -225,7 +225,7 @@ int main() { exit(1); } - list ports = {8080, 4443}; + list ports = {80, 443}; list servers = {}; auto it = ports.begin();