Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/w/8.0/bugfix/S3C-1678-ipv6' into…
Browse files Browse the repository at this point in the history
… w/8.1/bugfix/S3C-1678-ipv6
  • Loading branch information
dora-korpar committed Nov 16, 2018
2 parents 13b156b + 9a00974 commit f2b39fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/network/http/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const assert = require('assert');
const dhparam = require('../../https/dh2048').dhparam;
const ciphers = require('../../https/ciphers').ciphers;
const errors = require('../../errors');
const { checkSupportIPv6 } = require('./utils');

class Server {

Expand Down Expand Up @@ -39,7 +40,7 @@ class Server {
rejectUnauthorized: true,
};
this._port = port;
this._address = '::';
this._address = checkSupportIPv6() ? '::' : '0.0.0.0';
this._server = null;
this._logger = logger;
}
Expand Down
14 changes: 12 additions & 2 deletions lib/network/http/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'; // eslint-disable-line

const os = require('os');
const errors = require('../../errors');

/**
Expand Down Expand Up @@ -104,6 +105,15 @@ function parseRange(rangeHeader, objectSize) {
return getByteRangeFromSpec(rangeSpec, objectSize);
}

module.exports = { parseRangeSpec,
function checkSupportIPv6() {
const niList = os.networkInterfaces();
return Object.keys(niList).some(network =>
niList[network].some(intfc => intfc.family === 'IPv6'));
}

module.exports = {
parseRangeSpec,
getByteRangeFromSpec,
parseRange };
parseRange,
checkSupportIPv6,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"engines": {
"node": ">=8"
},
"version": "8.1.1",
"version": "8.1.2",
"description": "Common utilities for the S3 project components",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit f2b39fb

Please sign in to comment.