Created
September 14, 2010 14:25
-
-
Save sharifulin/579121 to your computer and use it in GitHub Desktop.
Is share agent?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub is_share_agent { | |
my $self = shift; | |
my $ua = $self->req->headers->user_agent; | |
my $range = $self->req->headers->header('Range'); | |
my $enc = $self->req->headers->header('Accept-Encoding'); | |
return | |
$ua =~ /facebookexternalhit/ && $range && $enc eq 'gzip' ? 'facebook' : | |
$ua eq 'Mozilla' && !$range && $enc eq 'gzip' ? 'buzz' : | |
$ua =~ /Mozilla/ && $range && !$enc ? 'vkontakte' : | |
undef | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment