Committer: mchernyshev
LJSUP-5987: Redirection to mobile version- bugfix: redirection and set cookie in one responce.
U trunk/cgi-bin/Apache/WURFL.pm
Modified: trunk/cgi-bin/Apache/WURFL.pm =================================================================== --- trunk/cgi-bin/Apache/WURFL.pm 2010-08-19 13:51:20 UTC (rev 17160) +++ trunk/cgi-bin/Apache/WURFL.pm 2010-08-20 01:54:13 UTC (rev 17161) @@ -166,8 +166,12 @@ # set cookie to future redirections and try to redirect to mobile version. if ($cookie eq 'no' || $self->is_mobile($user_agent)) { my $new_url = $self->map2mobile(%opts); - $self->set_our_cookie('no') if $cookie ne 'no'; - LJ::Request->send_cookies() if $new_url; # send cookies right now if we request to redirect. + if ($cookie ne 'no') { + $self->set_our_cookie('no'); + + # send cookies right now if we request to redirect. + LJ::Request->send_cookies() if $new_url; + } return $new_url; } else { $self->set_our_cookie('yes') if $cookie ne 'yes';