+
+ # If the client sent an existing cookie as X-Cookie, but didn't
+ # set Cookie, copy the former to the latter.
+ my $hi = $f->r->headers_in;
+ $cookie = $hi->get('Cookie');
+ if (!defined $cookie || $cookie eq "") {
+ $cookie = $hi->get('X-Cookie');
+ warn "copying X-Cookie '$cookie' to Cookie";
+ $hi->set('Cookie', $cookie);
+ }