Skip to content

Instantly share code, notes, and snippets.

@cosimo
Created August 25, 2011 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosimo/1171761 to your computer and use it in GitHub Desktop.
Save cosimo/1171761 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/Cookie.pm b/lib/Mojo/Cookie.pm
index 6a67e42..ed42fe5 100644
--- a/lib/Mojo/Cookie.pm
+++ b/lib/Mojo/Cookie.pm
@@ -22,6 +22,7 @@ my $NAME_RE = qr/
/x;
my $SEPARATOR_RE = qr/^\s*\;\s*/;
my $VALUE_RE = qr/^([^\;\,]+)\s*/;
+my $VALUE_NOCOMMA_RE = qr/^([^\;]+)\s*/;
# "My Homer is not a communist.
# He may be a liar, a pig, an idiot, a communist,
@@ -44,7 +45,15 @@ sub _tokenize {
if ($name =~ /expires/i && $string =~ s/$EXPIRES_RE//o) { $value = $1 }
# Value
- elsif ($string =~ s/$VALUE_RE//o) { $value = $1 }
+
+ # Salesforce uses cookie values containing commas
+ elsif ($name =~ /^__kt[isvt]$/ && $string =~ s/$VALUE_NOCOMMA_RE//o) {
+ $value = $1
+ }
+
+ elsif ($string =~ s/$VALUE_RE//o) {
+ $value = $1
+ }
# Token
push @token, [$name, $value];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment