Permalink
Browse files

Use ip-regex instead of net.isIP. Fix #125

  • Loading branch information...
gzzhanghao committed Dec 31, 2018
1 parent 7c1fdf1 commit eff9118f3c960bc1ed378ebb5ec2e80930cd3138
Showing with 3 additions and 2 deletions.
  1. +2 −2 lib/cookie.js
  2. +1 −0 package.json
@@ -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;
@@ -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;
}

@@ -72,6 +72,7 @@
"vows": "^0.8.2"
},
"dependencies": {
"ip-regex": "^3.0.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
}

1 comment on commit eff9118

@gkwang

This comment has been minimized.

Copy link

gkwang commented on eff9118 Jan 17, 2019

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.