1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

chore: guard against inherited properties

This commit is contained in:
Ruben Bridgewater
2017-05-27 01:01:42 +02:00
parent e33a642994
commit 8cca9ccf58
4 changed files with 24 additions and 13 deletions

View File

@@ -40,10 +40,12 @@ function RedisClient (options, stream) {
const cnxOptions = {}
/* istanbul ignore next: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */
for (const tlsOption in options.tls) {
cnxOptions[tlsOption] = options.tls[tlsOption]
// Copy the tls options into the general options to make sure the address is set right
if (tlsOption === 'port' || tlsOption === 'host' || tlsOption === 'path' || tlsOption === 'family') {
options[tlsOption] = options.tls[tlsOption]
if (options.tls.hasOwnProperty(tlsOption)) {
cnxOptions[tlsOption] = options.tls[tlsOption]
// Copy the tls options into the general options to make sure the address is set right
if (tlsOption === 'port' || tlsOption === 'host' || tlsOption === 'path' || tlsOption === 'family') {
options[tlsOption] = options.tls[tlsOption]
}
}
}
if (stream) {
@@ -69,7 +71,9 @@ function RedisClient (options, stream) {
options.socketKeepalive = true
}
for (const command in options.renameCommands) {
options.renameCommands[command.toLowerCase()] = options.renameCommands[command]
if (options.renameCommands.hasOwnProperty(command)) {
options.renameCommands[command.toLowerCase()] = options.renameCommands[command]
}
}
options.returnBuffers = !!options.returnBuffers
options.detectBuffers = !!options.detectBuffers