Menu

#16 The value of cookies with spaces in them the are truncated

open
nobody
None
5
2005-08-30
2005-08-30
Brad Fox
No

When accessing a site which sets long cookies with
spaces in the value, the cookie value is truncated at
the space.

For example, on a site that tracks user logins with a
cookie with the value formated "UserFirstname
UserLastname-HashKey"

(ie: "John Doe-7f46165474d11ff5836777d85df2cdab")

PHProxy sets a cookie with the $value of "John"

Unfortunately I don't know enough PHP to figure out
where this truncation is taking place, just enough to
kludge in a weak work-around to re-set the cookie
$value just before the "setcookie" statement in
PHProxy.class.php

Obviously, this only works if you know what the cookie
value should be

ie:

// start work-around

if ($value = "John") {
$value = "John Doe-7f46165474d11ff5836777d85df2cdab";
} elseif ($value = "Jane") {
$value = "Jane Doe-3db290a6e15f1acaffefb5f58daa9d83";
}

// end work-around

setcookie(urlencode("COOKIE;$name;$domain;$path"),
$value, $expires, '', $_SERVER['HTTP_HOST']);

Discussion


Log in to post a comment.