salesforce / tough-cookie

RFC6265 Cookies and CookieJar for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect behavior in permuteDomain where domain has a trailing dot

ruoho-sfdc opened this issue · comments

permuteDomain behaves incorrectly when called with a domain containing a trailing dot:

$ cat strange.js
const tough = require("./lib/cookie");
console.log('Permuting host.example.com.')
console.log(tough.permuteDomain("host.example.com."))
console.log('Permuting host.example.com')
console.log(tough.permuteDomain("host.example.com"))
$ node strange.js
Permuting host.example.com.
[ 'example.com', '.example.com', 'host..example.com' ]
Permuting host.example.com
[ 'example.com', 'host.example.com' ]