Skip to content

Commit

Permalink
fix: ensure tests are working
Browse files Browse the repository at this point in the history
  • Loading branch information
andyburke authored Dec 13, 2022
1 parent e0d9c55 commit ccb012d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cookiejar.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@

var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;
Cookie.prototype.parse = function parse(str, request_domain, request_path) {
if ( str.length > 32768 ) {
console.warn("Cookie too long for parsing (>32768 characters)");
return;
}

if (this instanceof Cookie) {
if ( str.length > 32768 ) {
console.warn("Cookie too long for parsing (>32768 characters)");
return;
}

var parts = str.split(";").filter(function (value) {
return !!value;
});
Expand Down
2 changes: 1 addition & 1 deletion tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ assert.deepEqual(cookie, new Cookie("a=1;domain=.test.com;path=/"));

// ensure cookies that are too long are not parsed to avoid any issues with DoS inputs
var too_long_cookie = new Cookie( "foo=" + "blah".repeat( 10000 ) );
assert.equal(too_long_cookie, undefined);
assert.equal(too_long_cookie?.name, null);

// Test request_path and request_domain
test_jar2.setCookie(new Cookie("sub=4;path=/", "test.com"));
Expand Down

2 comments on commit ccb012d

@wilkusss777
Copy link

Choose a reason for hiding this comment

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

smooolax

@andyburke
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm confused, what is this trying to solve or avoid?

Please sign in to comment.