Skip to content

Commit

Permalink
Use ip-regex instead of net.isIP. Fix #125
Browse files Browse the repository at this point in the history
  • Loading branch information
gzzhanghao committed Dec 31, 2018
1 parent 7c1fdf1 commit eff9118
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
'use strict';
var net = require('net');
var urlParse = require('url').parse;
var util = require('util');
var ipRegex = require('ip-regex')({ exact: true });
var pubsuffix = require('./pubsuffix-psl');
var Store = require('./store').Store;
var MemoryCookieStore = require('./memstore').MemoryCookieStore;
Expand Down Expand Up @@ -320,7 +320,7 @@ function domainMatch(str, domStr, canonicalize) {
/* "All of the following [three] conditions hold:" (order adjusted from the RFC) */

/* "* The string is a host name (i.e., not an IP address)." */
if (net.isIP(str)) {
if (ipRegex.test(str)) {
return false;
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"vows": "^0.8.2"
},
"dependencies": {
"ip-regex": "^3.0.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
}
Expand Down

1 comment on commit eff9118

@gkwang
Copy link

@gkwang gkwang commented on eff9118 Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ip-regex@^3.0.0 supports node 8+. we should drop to 2.1.0 if we want to support node 6.

Please sign in to comment.