Cannot handle malformed cookies
thelastnode opened this issue · comments
Ankit Shankar commented
I'm getting an exception when using shred, on line 40:
/app/node_modules/shred/node_modules/cookiejar/cookiejar.js:72
, key=pair[1].trim().toLowerCase()
TypeError: Cannot read property '1' of null
at Cookie.parse (/app/node_modules/shred/node_modules/cookiejar/cookiejar.js:72:17)
at new Cookie (/app/node_modules/shred/node_modules/cookiejar/cookiejar.js:28:16)
at Cookie (/app/node_modules/shred/node_modules/cookiejar/cookiejar.js:32:16)
at CookieJar.setCookies (/app/node_modules/shred/node_modules/cookiejar/cookiejar.js:217:16)
at Object.<anonymous> (/app/node_modules/shred/lib/shred/response.js:40:23)
at ClientRequest.<anonymous> (/app/node_modules/shred/lib/shred/request.js:340:16)
at ClientRequest.emit (events.js:67:17)
at HTTPParser.onIncoming (http.js:1225:11)
at HTTPParser.onHeadersComplete (http.js:102:31)
at Socket.ondata (http.js:1124:24)
It's running in a script with thousands of URLs, so I couldn't tell you the URL unfortunately.
The exception occurs because the pattern the cookie is looking for isn't matched, which means the cookie must be malformed.