Skip to content

Commit

Permalink
Loosen loose cookie parser. Closes #1112
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed Oct 25, 2013
1 parent de17571 commit 08945ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var internals = {

// 1: name 2: quoted value 3: value
internals.strictRx = /\s*([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:(?:"([^\x00-\x20\"\,\;\\\x7F]*)")|([^\x00-\x20\"\,\;\\\x7F]*))(?:(?:;|(?:\s*\,)\s*)|$)/g;
internals.looseRx = /\s*([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:(?:"([^\"]*)")|([^\;]*))(?:(?:;|(?:\s*\,)\s*)|$)/g;
internals.looseRx = /\s*([^=\s]+)\s*=\s*(?:(?:"([^\"]*)")|([^\;]*))(?:(?:;|(?:\s*\,)\s*)|$)/g;


// Read and parse body
Expand Down
2 changes: 1 addition & 1 deletion test/unit/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('State', function () {

var loose = Hapi.utils.clone(Defaults.server.state);
loose.cookies.strictHeader = false;
pass('a="1; b="2"; c=3', { a: '"1', b: '2', c: '3' }, loose);
pass('a="1; b="2"; c=3; d[1]=4', { a: '"1', b: '2', c: '3', 'd[1]': '4' }, loose);

var fail = function (header, settings, definitions, result) {

Expand Down

0 comments on commit 08945ea

Please sign in to comment.