|
@@ -5,6 +5,7 @@
|
|
#pragma once
|
|
#pragma once
|
|
|
|
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
+#include <map>
|
|
#include "utils/utils.h"
|
|
#include "utils/utils.h"
|
|
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
@@ -12,8 +13,22 @@ using namespace xc::utils;
|
|
|
|
|
|
namespace xc::conf {
|
|
namespace xc::conf {
|
|
const int clientSocketTimeoutSeconds = 3;
|
|
const int clientSocketTimeoutSeconds = 3;
|
|
|
|
+ const int taskProcessTimeoutSeconds = 1;
|
|
const int mtu = 1536;
|
|
const int mtu = 1536;
|
|
|
|
|
|
|
|
+ const map<string, string> fileExtensionToMimeTypes = {
|
|
|
|
+ { ".html", "text/html" },
|
|
|
|
+ { ".htm", "text/html" },
|
|
|
|
+ { ".js", "text/javascript" },
|
|
|
|
+ { ".xcnb", "text/xc-notebook" },
|
|
|
|
+ { ".ccdproj", "application/c-code-develop-project" },
|
|
|
|
+ { ".png", "image/png" },
|
|
|
|
+ { ".jpg", "image/jpeg" },
|
|
|
|
+ { ".jpeg", "image/jpeg" },
|
|
|
|
+ { ".tiff", "image/tiff" },
|
|
|
|
+ { "default", "application/octet-stream" },
|
|
|
|
+ };
|
|
|
|
+
|
|
const IncompleteFileResponseData errorPage(FileResponseData(500, "html/error.html", "text/html"));
|
|
const IncompleteFileResponseData errorPage(FileResponseData(500, "html/error.html", "text/html"));
|
|
|
|
|
|
const auto errorPage400 = errorPage.applyReplacements(400, {
|
|
const auto errorPage400 = errorPage.applyReplacements(400, {
|
|
@@ -30,4 +45,9 @@ namespace xc::conf {
|
|
Replacement("errorMessage", "服务器内部错误,可能是服务器访问量过大,请稍后重试"),
|
|
Replacement("errorMessage", "服务器内部错误,可能是服务器访问量过大,请稍后重试"),
|
|
Replacement("errorCode", "500")
|
|
Replacement("errorCode", "500")
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ const auto errorPageTimeout = errorPage.applyReplacements(550, {
|
|
|
|
+ Replacement("errorMessage", "服务器任务处理已超时,可能服务器访问量过大,请稍后重试"),
|
|
|
|
+ Replacement("errorCode", "550")
|
|
|
|
+ });
|
|
}
|
|
}
|