Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/request-compose/request/ drwxr-xr-x | |
| Viewing file: Select action/file-type:
var fs = require('fs')
var stream = require('stream')
module.exports = () => ({options, options: {headers}, body}) => new Promise((resolve) =>{
var length = Object.keys(headers)
.find((name) => name.toLowerCase() === 'content-length')
var encoding = Object.keys(headers)
.find((name) => name.toLowerCase() === 'transfer-encoding')
if (headers[length] || headers[encoding] === 'chunked') {
resolve({options, body})
return
}
var getLength = (body, length, done) => {
if (typeof body === 'string') {
done(null, Buffer.byteLength(body))
}
else if (body instanceof Buffer) {
done(null, body.length)
}
// request-multipart
else if (body && body.constructor && body.constructor.name === 'BufferListStream') {
done(null, body.length)
}
else if (body instanceof stream.Stream) {
// fs.ReadStream
if (body.hasOwnProperty('fd')) {
fs.stat(body.path, (err, stats) => done(err, stats && stats.size))
}
// http.IncomingMessage
else if (body.hasOwnProperty('httpVersion')) {
done(!body.headers['content-length'], parseInt(body.headers['content-length']))
}
// request-multipart
else if (body._items) {
;(function loop (index) {
if (index === body._items.length) {
done(null, length)
return
}
var item = body._items[index]
if (item._knownLength) {
length += parseInt(item._knownLength)
loop(++index)
}
else {
getLength(item, length, (err, len) => {
if (err) {
done(err)
return
}
length += len
loop(++index)
})
}
})(0)
}
else {
done(true)
}
}
else {
done(true)
}
}
getLength(body, 0, (err, length) => {
err
? headers['transfer-encoding'] = 'chunked'
: headers['content-length'] = length
resolve({options, body})
})
})
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0044 ]-- |