@nsnanocat/util 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/gRPC.mjs +66 -0
- package/getStorage.mjs +98 -0
- package/index.js +12 -0
- package/lib/app.mjs +26 -0
- package/lib/done.mjs +84 -0
- package/lib/environment.mjs +34 -0
- package/lib/index.js +5 -0
- package/lib/notification.mjs +148 -0
- package/lib/runScript.mjs +27 -0
- package/lib/time.mjs +30 -0
- package/lib/wait.mjs +10 -0
- package/package.json +40 -0
- package/polyfill/Console.mjs +109 -0
- package/polyfill/Lodash.mjs +60 -0
- package/polyfill/StatusCodes.mjs +62 -0
- package/polyfill/Storage.mjs +257 -0
- package/polyfill/fetch.mjs +176 -0
- package/polyfill/index.js +5 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { $app } from "./app.mjs";
|
|
2
|
+
import { Console } from "../polyfill/Console.mjs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 系统通知
|
|
6
|
+
*
|
|
7
|
+
* > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知
|
|
8
|
+
*
|
|
9
|
+
* 示例:
|
|
10
|
+
* $.msg(title, subtitle, body, "twitter://")
|
|
11
|
+
* $.msg(title, subtitle, body, { "open-url": "twitter://", "media-url": "https://github.githubassets.com/images/modules/open_graph/github-mark.png" })
|
|
12
|
+
* $.msg(title, subtitle, body, { "open-url": "https://bing.com", "media-url": "https://github.githubassets.com/images/modules/open_graph/github-mark.png" })
|
|
13
|
+
*
|
|
14
|
+
* @param {string} title 标题
|
|
15
|
+
* @param {string} subtitle 副标题
|
|
16
|
+
* @param {string} body 内容
|
|
17
|
+
* @param {*} mutableContent 通知扩展字段
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export function notification(title = `ℹ️ ${$app} 通知`, subtitle = "", body = "", content = {}) {
|
|
21
|
+
switch ($app) {
|
|
22
|
+
case "Surge":
|
|
23
|
+
case "Loon":
|
|
24
|
+
case "Stash":
|
|
25
|
+
case "Egern":
|
|
26
|
+
case "Shadowrocket":
|
|
27
|
+
default:
|
|
28
|
+
$notification.post(title, subtitle, body, MutableContent(content));
|
|
29
|
+
break;
|
|
30
|
+
case "Quantumult X":
|
|
31
|
+
$notify(title, subtitle, body, MutableContent(content));
|
|
32
|
+
break;
|
|
33
|
+
case "Node.js":
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
Console.info(...["==============📣系统通知📣==============", title, subtitle, body, JSON.stringify(MutableContent(content), null, 2)]);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const MutableContent = content => {
|
|
40
|
+
const mutableContent = {};
|
|
41
|
+
switch (typeof content) {
|
|
42
|
+
case undefined:
|
|
43
|
+
break;
|
|
44
|
+
case "string":
|
|
45
|
+
case "number":
|
|
46
|
+
case "boolean":
|
|
47
|
+
switch ($app) {
|
|
48
|
+
case "Surge":
|
|
49
|
+
case "Stash":
|
|
50
|
+
case "Egern":
|
|
51
|
+
default:
|
|
52
|
+
mutableContent.url = content;
|
|
53
|
+
break;
|
|
54
|
+
case "Loon":
|
|
55
|
+
case "Shadowrocket":
|
|
56
|
+
mutableContent.openUrl = content;
|
|
57
|
+
break;
|
|
58
|
+
case "Quantumult X":
|
|
59
|
+
mutableContent["open-url"] = content;
|
|
60
|
+
break;
|
|
61
|
+
case "Node.js":
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case "object": {
|
|
66
|
+
const openUrl = content.open || content["open-url"] || content.url || content.openUrl;
|
|
67
|
+
const copyUrl = content.copy || content["update-pasteboard"] || content.updatePasteboard;
|
|
68
|
+
const mediaUrl = content.media || content["media-url"] || content.mediaUrl;
|
|
69
|
+
switch ($app) {
|
|
70
|
+
case "Surge":
|
|
71
|
+
case "Stash":
|
|
72
|
+
case "Egern":
|
|
73
|
+
case "Shadowrocket":
|
|
74
|
+
default: {
|
|
75
|
+
if (openUrl) {
|
|
76
|
+
mutableContent.action = "open-url";
|
|
77
|
+
mutableContent.url = openUrl;
|
|
78
|
+
}
|
|
79
|
+
if (copyUrl) {
|
|
80
|
+
mutableContent.action = "clipboard";
|
|
81
|
+
mutableContent.text = copyUrl;
|
|
82
|
+
}
|
|
83
|
+
if (mediaUrl) {
|
|
84
|
+
switch (true) {
|
|
85
|
+
case mediaUrl.startsWith("http"): // http 开头的网络地址
|
|
86
|
+
mutableContent["media-url"] = mediaUrl;
|
|
87
|
+
break;
|
|
88
|
+
case mediaUrl.startsWith("data:"): {
|
|
89
|
+
// data 开头的 Base64 编码
|
|
90
|
+
// data:image/png;base64,iVBORw0KGgo...
|
|
91
|
+
const base64RegExp = /^data:(?<MIME>\w+\/\w+);base64,(?<Base64>.+)/;
|
|
92
|
+
const { MIME, Base64 } = mediaUrl.match(base64RegExp).groups;
|
|
93
|
+
mutableContent["media-base64"] = Base64;
|
|
94
|
+
mutableContent["media-base64-mime"] = content.mime || MIME;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
default: {
|
|
98
|
+
mutableContent["media-base64"] = mediaUrl;
|
|
99
|
+
// https://stackoverflow.com/questions/57976898/how-to-get-mime-type-from-base-64-string
|
|
100
|
+
switch (true) {
|
|
101
|
+
case mediaUrl.startsWith("CiVQREYt"):
|
|
102
|
+
case mediaUrl.startsWith("JVBERi0"):
|
|
103
|
+
mutableContent["media-base64-mime"] = "application/pdf";
|
|
104
|
+
break;
|
|
105
|
+
case mediaUrl.startsWith("R0lGODdh"):
|
|
106
|
+
case mediaUrl.startsWith("R0lGODlh"):
|
|
107
|
+
mutableContent["media-base64-mime"] = "image/gif";
|
|
108
|
+
break;
|
|
109
|
+
case mediaUrl.startsWith("iVBORw0KGgo"):
|
|
110
|
+
mutableContent["media-base64-mime"] = "image/png";
|
|
111
|
+
break;
|
|
112
|
+
case mediaUrl.startsWith("/9j/"):
|
|
113
|
+
mutableContent["media-base64-mime"] = "image/jpg";
|
|
114
|
+
break;
|
|
115
|
+
case mediaUrl.startsWith("Qk02U"):
|
|
116
|
+
mutableContent["media-base64-mime"] = "image/bmp";
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (content["auto-dismiss"]) mutableContent["auto-dismiss"] = content["auto-dismiss"];
|
|
124
|
+
if (content.sound) mutableContent.sound = content.sound;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "Loon": {
|
|
128
|
+
if (openUrl) mutableContent.openUrl = openUrl;
|
|
129
|
+
if (mediaUrl?.startsWith("http")) mutableContent.mediaUrl = mediaUrl;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case "Quantumult X": {
|
|
133
|
+
if (openUrl) mutableContent["open-url"] = openUrl;
|
|
134
|
+
if (mediaUrl?.startsWith("http")) mutableContent["media-url"] = mediaUrl;
|
|
135
|
+
if (copyUrl) mutableContent["update-pasteboard"] = copyUrl;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case "Node.js":
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
default:
|
|
144
|
+
Console.error(`不支持的通知参数类型: ${typeof content}`, "");
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
return mutableContent;
|
|
148
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Console } from "../polyfill/Console.mjs";
|
|
2
|
+
import { fetch } from "../polyfill/fetch.mjs";
|
|
3
|
+
import { Lodash as _ } from "../polyfill/Lodash.mjs";
|
|
4
|
+
import { Storage } from "../polyfill/Storage.mjs";
|
|
5
|
+
|
|
6
|
+
export async function runScript(script, runOpts) {
|
|
7
|
+
let httpapi = Storage.getItem("@chavy_boxjs_userCfgs.httpapi");
|
|
8
|
+
httpapi = httpapi?.replace?.(/\n/g, "")?.trim();
|
|
9
|
+
let httpapi_timeout = Storage.getItem("@chavy_boxjs_userCfgs.httpapi_timeout");
|
|
10
|
+
httpapi_timeout = httpapi_timeout * 1 ?? 20;
|
|
11
|
+
httpapi_timeout = runOpts?.timeout ?? httpapi_timeout;
|
|
12
|
+
const [password, address] = httpapi.split("@");
|
|
13
|
+
const request = {
|
|
14
|
+
url: `http://${address}/v1/scripting/evaluate`,
|
|
15
|
+
body: {
|
|
16
|
+
script_text: script,
|
|
17
|
+
mock_type: "cron",
|
|
18
|
+
timeout: httpapi_timeout,
|
|
19
|
+
},
|
|
20
|
+
headers: { "X-Key": password, Accept: "*/*" },
|
|
21
|
+
timeout: httpapi_timeout,
|
|
22
|
+
};
|
|
23
|
+
await fetch(request).then(
|
|
24
|
+
response => response.body,
|
|
25
|
+
error => Console.error(error),
|
|
26
|
+
);
|
|
27
|
+
}
|
package/lib/time.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* time
|
|
3
|
+
* 时间格式化
|
|
4
|
+
* [version of ISO8601]{@link https://262.ecma-international.org/5.1/#sec-15.9.1.15}
|
|
5
|
+
* 示例:time("yyyy-MM-dd qq HH:mm:ss.S") YYYY-MM-DDTHH:mm:ss.sssZ
|
|
6
|
+
* :time("yyyyMMddHHmmssS")
|
|
7
|
+
* YY:年 MM:月 dd:日 S:季 HH:时 m:分 ss:秒 sss:毫秒 Z:时区
|
|
8
|
+
* 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
|
|
9
|
+
* @param {string} format 格式化参数
|
|
10
|
+
* @param {number} ts 可选: 根据指定时间戳返回格式化日期
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export function time(format, ts) {
|
|
14
|
+
const date = ts ? new Date(ts) : new Date();
|
|
15
|
+
const Time = {
|
|
16
|
+
YY: date.getFullYear().toString().substring(3),
|
|
17
|
+
yyyy: date.getFullYear().toString(),
|
|
18
|
+
MM: (date.getMonth() + 1).toString().padStart(2, "0"),
|
|
19
|
+
dd: date.getDate().toString().padStart(2, "0"),
|
|
20
|
+
HH: date.getHours().toString().padStart(2, "0"),
|
|
21
|
+
mm: date.getMinutes().toString().padStart(2, "0"),
|
|
22
|
+
sss: date.getMilliseconds().toString().padStart(3, "0"),
|
|
23
|
+
ss: date.getSeconds().toString().padStart(2, "0"),
|
|
24
|
+
S: `${Math.floor(date.getMonth() / 3) + 1}`,
|
|
25
|
+
};
|
|
26
|
+
for (const [key, value] of Object.entries(Time)) {
|
|
27
|
+
format = format.replace(key, value);
|
|
28
|
+
}
|
|
29
|
+
return format;
|
|
30
|
+
}
|
package/lib/wait.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nsnanocat/util",
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "Pure JS's util module for well-known iOS network tools",
|
|
5
|
+
"author": "VirgilClyne <Virgil@nanocat.me>",
|
|
6
|
+
"homepage": "https://NSNanoCat.github.io/util",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"loon",
|
|
9
|
+
"quantumult",
|
|
10
|
+
"surge",
|
|
11
|
+
"shadowrocket",
|
|
12
|
+
"stash",
|
|
13
|
+
"egern"
|
|
14
|
+
],
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"bugs": "https://github.com/NSNanoCat/util/issues",
|
|
17
|
+
"main": "index.js",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"tsc:build": "npx tsc",
|
|
21
|
+
"test": "exit 0"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/NSNanoCat/util.git"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"pako": "^2.1.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"index.js",
|
|
32
|
+
"lib",
|
|
33
|
+
"polyfill",
|
|
34
|
+
"gRPC.mjs",
|
|
35
|
+
"getStorage.mjs"
|
|
36
|
+
],
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"typescript": "^5.6.3"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { $app } from "../lib/app.mjs";
|
|
2
|
+
|
|
3
|
+
export class Console {
|
|
4
|
+
static #counts = new Map([]);
|
|
5
|
+
static #groups = [];
|
|
6
|
+
static #times = new Map([]);
|
|
7
|
+
|
|
8
|
+
static clear = () => {};
|
|
9
|
+
|
|
10
|
+
static count = (label = "default") => {
|
|
11
|
+
switch (Console.#counts.has(label)) {
|
|
12
|
+
case true:
|
|
13
|
+
Console.#counts.set(label, Console.#counts.get(label) + 1);
|
|
14
|
+
break;
|
|
15
|
+
case false:
|
|
16
|
+
Console.#counts.set(label, 0);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
Console.log(`${label}: ${Console.#counts.get(label)}`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
static countReset = (label = "default") => {
|
|
23
|
+
switch (Console.#counts.has(label)) {
|
|
24
|
+
case true:
|
|
25
|
+
Console.#counts.set(label, 0);
|
|
26
|
+
Console.log(`${label}: ${Console.#counts.get(label)}`);
|
|
27
|
+
break;
|
|
28
|
+
case false:
|
|
29
|
+
Console.warn(`Counter "${label}" doesn’t exist`);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
static debug = (...msg) => {
|
|
35
|
+
msg = msg.map(m => `🅱️ ${m}`);
|
|
36
|
+
Console.log(...msg);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
static error(...msg) {
|
|
40
|
+
switch ($app) {
|
|
41
|
+
case "Surge":
|
|
42
|
+
case "Loon":
|
|
43
|
+
case "Stash":
|
|
44
|
+
case "Egern":
|
|
45
|
+
case "Shadowrocket":
|
|
46
|
+
case "Quantumult X":
|
|
47
|
+
default:
|
|
48
|
+
msg = msg.map(m => `❌ ${m}`);
|
|
49
|
+
break;
|
|
50
|
+
case "Node.js":
|
|
51
|
+
msg = msg.map(m => `❌ ${m.stack}`);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
Console.log(...msg);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static exception = (...msg) => Console.error(...msg);
|
|
58
|
+
|
|
59
|
+
static group = label => Console.#groups.unshift(label);
|
|
60
|
+
|
|
61
|
+
static groupEnd = () => Console.#groups.shift();
|
|
62
|
+
|
|
63
|
+
static info(...msg) {
|
|
64
|
+
msg = msg.map(m => `ℹ️ ${m}`);
|
|
65
|
+
Console.log(...msg);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static log = (...msg) => {
|
|
69
|
+
msg = msg.map(log => {
|
|
70
|
+
switch (typeof log) {
|
|
71
|
+
case "object":
|
|
72
|
+
log = JSON.stringify(log);
|
|
73
|
+
break;
|
|
74
|
+
case "bigint":
|
|
75
|
+
case "number":
|
|
76
|
+
case "boolean":
|
|
77
|
+
case "string":
|
|
78
|
+
log = log.toString();
|
|
79
|
+
break;
|
|
80
|
+
case "undefined":
|
|
81
|
+
default:
|
|
82
|
+
log = "";
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return log;
|
|
86
|
+
});
|
|
87
|
+
Console.#groups.forEach(group => {
|
|
88
|
+
msg = msg.map(log => ` ${log}`);
|
|
89
|
+
msg.unshift(`▼ ${group}:`);
|
|
90
|
+
});
|
|
91
|
+
msg = ["", ...msg, ""];
|
|
92
|
+
console.log(msg.join("\n"));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
static time = (label = "default") => Console.#times.set(label, Date.now());
|
|
96
|
+
|
|
97
|
+
static timeEnd = (label = "default") => Console.#times.delete(label);
|
|
98
|
+
|
|
99
|
+
static timeLog = (label = "default") => {
|
|
100
|
+
const time = Console.#times.get(label);
|
|
101
|
+
if (time) Console.log(`${label}: ${Date.now() - time}ms`);
|
|
102
|
+
else Console.warn(`Timer "${label}" doesn’t exist`);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
static warn(...msg) {
|
|
106
|
+
msg = msg.map(m => `⚠️ ${m}`);
|
|
107
|
+
Console.log(...msg);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* https://www.lodashjs.com */
|
|
2
|
+
export class Lodash {
|
|
3
|
+
static get(object = {}, path = "", defaultValue = undefined) {
|
|
4
|
+
// translate array case to dot case, then split with .
|
|
5
|
+
// a[0].b -> a.0.b -> ['a', '0', 'b']
|
|
6
|
+
if (!Array.isArray(path)) path = Lodash.toPath(path);
|
|
7
|
+
|
|
8
|
+
const result = path.reduce((previousValue, currentValue) => {
|
|
9
|
+
return Object(previousValue)[currentValue]; // null undefined get attribute will throwError, Object() can return a object
|
|
10
|
+
}, object);
|
|
11
|
+
return result === undefined ? defaultValue : result;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static set(object, path, value) {
|
|
15
|
+
if (!Array.isArray(path)) path = Lodash.toPath(path);
|
|
16
|
+
path.slice(0, -1).reduce((previousValue, currentValue, currentIndex) => (Object(previousValue[currentValue]) === previousValue[currentValue] ? previousValue[currentValue] : (previousValue[currentValue] = /^\d+$/.test(path[currentIndex + 1]) ? [] : {})), object)[path[path.length - 1]] = value;
|
|
17
|
+
return object;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static unset(object = {}, path = "") {
|
|
21
|
+
if (!Array.isArray(path)) path = Lodash.toPath(path);
|
|
22
|
+
const result = path.reduce((previousValue, currentValue, currentIndex) => {
|
|
23
|
+
if (currentIndex === path.length - 1) {
|
|
24
|
+
delete previousValue[currentValue];
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return Object(previousValue)[currentValue];
|
|
28
|
+
}, object);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static toPath(value) {
|
|
33
|
+
return value
|
|
34
|
+
.replace(/\[(\d+)\]/g, ".$1")
|
|
35
|
+
.split(".")
|
|
36
|
+
.filter(Boolean);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static escape(string) {
|
|
40
|
+
const map = {
|
|
41
|
+
"&": "&",
|
|
42
|
+
"<": "<",
|
|
43
|
+
">": ">",
|
|
44
|
+
'"': """,
|
|
45
|
+
"'": "'",
|
|
46
|
+
};
|
|
47
|
+
return string.replace(/[&<>"']/g, m => map[m]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static unescape(string) {
|
|
51
|
+
const map = {
|
|
52
|
+
"&": "&",
|
|
53
|
+
"<": "<",
|
|
54
|
+
">": ">",
|
|
55
|
+
""": '"',
|
|
56
|
+
"'": "'",
|
|
57
|
+
};
|
|
58
|
+
return string.replace(/&|<|>|"|'/g, m => map[m]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const StatusCodes = {
|
|
2
|
+
100: "HTTP/1.1 100 Continue",
|
|
3
|
+
101: "HTTP/1.1 101 Switching Protocols",
|
|
4
|
+
102: "HTTP/1.1 102 Processing",
|
|
5
|
+
103: "HTTP/1.1 103 Early Hints",
|
|
6
|
+
200: "HTTP/1.1 200 OK",
|
|
7
|
+
201: "HTTP/1.1 201 Created",
|
|
8
|
+
202: "HTTP/1.1 202 Accepted",
|
|
9
|
+
203: "HTTP/1.1 203 Non-Authoritative Information",
|
|
10
|
+
204: "HTTP/1.1 204 No Content",
|
|
11
|
+
205: "HTTP/1.1 205 Reset Content",
|
|
12
|
+
206: "HTTP/1.1 206 Partial Content",
|
|
13
|
+
207: "HTTP/1.1 207 Multi-Status",
|
|
14
|
+
208: "HTTP/1.1 208 Already Reported",
|
|
15
|
+
226: "HTTP/1.1 226 IM Used",
|
|
16
|
+
300: "HTTP/1.1 300 Multiple Choices",
|
|
17
|
+
301: "HTTP/1.1 301 Moved Permanently",
|
|
18
|
+
302: "HTTP/1.1 302 Found",
|
|
19
|
+
304: "HTTP/1.1 304 Not Modified",
|
|
20
|
+
307: "HTTP/1.1 307 Temporary Redirect",
|
|
21
|
+
308: "HTTP/1.1 308 Permanent Redirect",
|
|
22
|
+
400: "HTTP/1.1 400 Bad Request",
|
|
23
|
+
401: "HTTP/1.1 401 Unauthorized",
|
|
24
|
+
402: "HTTP/1.1 402 Payment Required",
|
|
25
|
+
403: "HTTP/1.1 403 Forbidden",
|
|
26
|
+
404: "HTTP/1.1 404 Not Found",
|
|
27
|
+
405: "HTTP/1.1 405 Method Not Allowed",
|
|
28
|
+
406: "HTTP/1.1 406 Not Acceptable",
|
|
29
|
+
407: "HTTP/1.1 407 Proxy Authentication Required",
|
|
30
|
+
408: "HTTP/1.1 408 Request Timeout",
|
|
31
|
+
409: "HTTP/1.1 409 Conflict",
|
|
32
|
+
410: "HTTP/1.1 410 Gone",
|
|
33
|
+
411: "HTTP/1.1 411 Length Required",
|
|
34
|
+
412: "HTTP/1.1 412 Precondition Failed",
|
|
35
|
+
413: "HTTP/1.1 413 Content Too Large",
|
|
36
|
+
414: "HTTP/1.1 414 URI Too Long",
|
|
37
|
+
415: "HTTP/1.1 415 Unsupported Media Type",
|
|
38
|
+
416: "HTTP/1.1 416 Range Not Satisfiable",
|
|
39
|
+
417: "HTTP/1.1 417 Expectation Failed",
|
|
40
|
+
418: "HTTP/1.1 418 I'm a teapot",
|
|
41
|
+
421: "HTTP/1.1 421 Misdirected Request",
|
|
42
|
+
422: "HTTP/1.1 422 Unprocessable Entity",
|
|
43
|
+
423: "HTTP/1.1 423 Locked",
|
|
44
|
+
424: "HTTP/1.1 424 Failed Dependency",
|
|
45
|
+
425: "HTTP/1.1 425 Too Early",
|
|
46
|
+
426: "HTTP/1.1 426 Upgrade Required",
|
|
47
|
+
428: "HTTP/1.1 428 Precondition Required",
|
|
48
|
+
429: "HTTP/1.1 429 Too Many Requests",
|
|
49
|
+
431: "HTTP/1.1 431 Request Header Fields Too Large",
|
|
50
|
+
451: "HTTP/1.1 451 Unavailable For Legal Reasons",
|
|
51
|
+
500: "HTTP/1.1 500 Internal Server Error",
|
|
52
|
+
501: "HTTP/1.1 501 Not Implemented",
|
|
53
|
+
502: "HTTP/1.1 502 Bad Gateway",
|
|
54
|
+
503: "HTTP/1.1 503 Service Unavailable",
|
|
55
|
+
504: "HTTP/1.1 504 Gateway Timeout",
|
|
56
|
+
505: "HTTP/1.1 505 HTTP Version Not Supported",
|
|
57
|
+
506: "HTTP/1.1 506 Variant Also Negotiates",
|
|
58
|
+
507: "HTTP/1.1 507 Insufficient Storage",
|
|
59
|
+
508: "HTTP/1.1 508 Loop Detected",
|
|
60
|
+
510: "HTTP/1.1 510 Not Extended",
|
|
61
|
+
511: "HTTP/1.1 511 Network Authentication Required",
|
|
62
|
+
};
|