limit proxy request size
This commit is contained in:
@@ -1292,9 +1292,15 @@ async function doHTTPProxy(socket, request_headers) {
|
|||||||
}
|
}
|
||||||
const req = proxy_agent.request(options, function (res) {
|
const req = proxy_agent.request(options, function (res) {
|
||||||
var data = [];
|
var data = [];
|
||||||
|
var total_data = 0;
|
||||||
|
|
||||||
res.on('data', d => {
|
res.on('data', d => {
|
||||||
data.push(d);
|
data.push(d);
|
||||||
|
total_data += d.length;
|
||||||
|
if (total_data > 1024 * parseFloat(minisrv_config.services[request_type].max_response_size || 16)) {
|
||||||
|
console.warn(` * Response data exceeded ${minisrv_config.services[request_type].max_response_size || 16}MB limit, destroying...`);
|
||||||
|
res.destroy();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
res.on('error', function (err) {
|
res.on('error', function (err) {
|
||||||
|
|||||||
@@ -349,7 +349,8 @@
|
|||||||
"external_proxy_is_socks": false, // use a socks proxy
|
"external_proxy_is_socks": false, // use a socks proxy
|
||||||
"external_proxy_host": "127.0.0.1", // IP address or hostname of proxy
|
"external_proxy_host": "127.0.0.1", // IP address or hostname of proxy
|
||||||
"external_proxy_port": 1080, // Port of proxy
|
"external_proxy_port": 1080, // Port of proxy
|
||||||
"flags": "0x00000001"
|
"flags": "0x00000001",
|
||||||
|
"max_response_size": 16 // Megabytes
|
||||||
},
|
},
|
||||||
"https": {
|
"https": {
|
||||||
"port": 1650,
|
"port": 1650,
|
||||||
@@ -358,7 +359,8 @@
|
|||||||
"external_proxy_is_socks": false, // use a socks proxy
|
"external_proxy_is_socks": false, // use a socks proxy
|
||||||
"external_proxy_host": "127.0.0.1", // IP address or hostname of proxy
|
"external_proxy_host": "127.0.0.1", // IP address or hostname of proxy
|
||||||
"external_proxy_port": 1080, // Port of proxy
|
"external_proxy_port": 1080, // Port of proxy
|
||||||
"flags": "0x00000001"
|
"flags": "0x00000001",
|
||||||
|
"max_response_size": 16 // Megabytes
|
||||||
},
|
},
|
||||||
"proto": {
|
"proto": {
|
||||||
"port": 1650,
|
"port": 1650,
|
||||||
@@ -369,7 +371,8 @@
|
|||||||
"external_proxy_host": "wayback.protoweb.org",
|
"external_proxy_host": "wayback.protoweb.org",
|
||||||
"external_proxy_port": 7851,
|
"external_proxy_port": 7851,
|
||||||
"external_proxy_is_http1": true,
|
"external_proxy_is_http1": true,
|
||||||
"flags": "0x00000001"
|
"flags": "0x00000001",
|
||||||
|
"max_response_size": 16 // Megabytes
|
||||||
},
|
},
|
||||||
"wtv-passport": {
|
"wtv-passport": {
|
||||||
// wtv-passport (for messenger)
|
// wtv-passport (for messenger)
|
||||||
|
|||||||
Reference in New Issue
Block a user