Apache2-WURFLFilter
view release on metacpan or search on metacpan
WURFLFilter 2.04
Deprecated parameter Log4WurflNoDeviceDetect, the strange parameter is logged into error_log as warning type
Deprecated parameter DirWebPatch, now if LoadWebPatch is true and PatchWurflNetDownload is false the Apache Mobile FIlter load the web_browsers_patch.xml file into MOBILE_HOME parameter
Deprecated parameter ConvertImage this parameter has not sense.
Deprecated parameter WebAppConvertImages this parameter has not sense.
Deprecated parameter DetectAccuracy this parameter causes the decrease of filter performance.
Deprecated parameter RedirectTranscoder this parameter has not sense.
Complete with more info the POD
WURFLFilter 2.03
Added Parameter CookieCacheSystem to enable cookie cache mechanism.
Cache cookie system
Clear code
WURFLFilter 2.02
I leaved (in the same day) the cookie system, and I'm using pnote
WURFLFilter 2.01
WURFLFilter pass the dimension of screen size to ImageRenderFilter by cookie system
WURFLFilter 2.00
WURFLFilter 1.31
After talking with Gianugo R. it's possible to configure the filter into httpd.conf file
Added Parameter XML_CONFIG to set where to read WURFLFilter configuration (to set in httpd.conf)
Added Parameter CapabilityList the same of the old attribute "capability" in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter XHTMLUrl the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter WMLUrl the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter CHTMLUrl the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter MobileVersionUrl the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter IntelliSwitch the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter FullBrowserUrl the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter CookieSet the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter PassQueryStringSet the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter ShowDefaultVariable the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter WurflNetDownload the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter DownloadWurflURL the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter DownloadZipFile the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter ConvertImage the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter ResizeImageDirectory the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter WebAppConvertImages the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter WebAppDirectory the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
Added Parameter ConvertOnlyImages the same of the old attribute with the same name in WURFLFilterConfig.configure (to set in httpd.conf)
requires:
Apache2::Connection: 0
Apache2::Const: 0
Apache2::Filter: 0
Apache2::RequestRec: 0
Apache2::RequestUtil: 0
Apache2::SubRequest: 0
APR::Table: 0
Cache::FileBackend: 0
Cache::Memcached: 0
CGI::Cookie: 0
File::Copy: 0
Image::Resize: 0
IO::Uncompress::Unzip: 0
LWP::Simple: 0
no_index:
directory:
- t
- inc
generated_by: ExtUtils::MakeMaker version 6.48
meta-spec:
Makefile.PL view on Meta::CPAN
NAME => 'Apache2::WURFLFilter',
VERSION_FROM => 'lib/Apache2/WURFLFilter.pm',
DISTNAME => "Apache2-WURFLFilter",
dist => {COMPRESS => 'gzip', SUFFIX => 'gz'},
PREREQ_PM => {
'Apache2::Filter' => 0,
'Apache2::RequestRec' => 0,
'Apache2::RequestUtil' => 0,
'Apache2::SubRequest' => 0,
'Apache2::Connection' => 0,
'CGI::Cookie' => 0,
'APR::Table' => 0,
'Apache2::Const' => 0,
'Image::Resize' => 0,
'LWP::Simple' => 0,
'File::Copy' => 0,
'IO::Uncompress::Unzip' => 0,
'Cache::Memcached' => 0,
'Cache::FileBackend' => 0
},
AUTHOR => 'Idel Fuschini (idel@idelfuschini.it)'
Knowledge about Apache configuration
Library I have used:
Apache2::Filter
Apache2::RequestRec
Apache2::RequestUtil
Apache2::Connection
Apache2::Log
CGI::Cookie
APR::Table
LWP::Simple
Image::Resize
Apache2::Const
IO::Uncompress::Unzip
File::Copy
Cache::FileBackend
INSTALLATION
You need to install and configure Apache 2.x
1) perl Makefile.PL
2) sudo make install
3) open the file conf/httpd.conf and add this few commands:
#
#Apache Mobile Filter parameter
#
PerlSetEnv MOBILE_HOME <home path of AMF>
PerlSetEnv CookieCacheSystem <for persist the data (normaly /tmp)>
#
#configure to activate Apache Mobile filter
#
PerlModule Apache2::WURFLFilter
PerlTransHandler +Apache2::WURFLFilter
# This is indicate to the filter were are stored the high definition images
PerlSetEnv ResizeImageDirectory /transform
lib/Apache2/AMFCommonLib.pm view on Meta::CPAN
} else {
$ind=$ind+1;
$ArrayUAparse{$ind}="$ArrayUAparse{$ind-1} $pair";
}
}
}
return %ArrayUAparse;
}
sub readCookie {
my $self = shift;
my $cookie_search;
if (@_) {
$cookie_search = shift;
}
my $param_tofound;
my $string_tofound;
my $value="";
my $id_return="";
my @pairs = split(/;/, $cookie_search);
lib/Apache2/ImageRenderFilter.pm view on Meta::CPAN
my $docroot = $f->r->document_root();
my $id="";
my $method="";
my $location;
my $width_toSearch;
my $type_redirect="internal";
my $return_value=Apache2::Const::DECLINED;
my $dummy="";
my $variabile2="";
my %ArrayCapFound;
my $controlCookie;
my $query_img="";
my %ArrayQuery;
my $var;
my $cookie = $f->r->headers_in->{Cookie} || '';
my $width=1000;
my $height=1000;
my $image2="";
$content_type=lc($content_type);
if ($f->r->pnotes('max_image_width')) {
$width=$f->r->pnotes('max_image_width')
}
if ($f->r->pnotes('max_image_height')) {
$height=$f->r->pnotes('max_image_height');
}
lib/Apache2/WURFLFilter.pm view on Meta::CPAN
}
if ($ENV{PatchWurflNetDownload}) {
$patchwurflnetdownload=$ENV{PatchWurflNetDownload};
$CommonLib->printLog("PatchWurflNetDownload is: $patchwurflnetdownload");
}
if ($ENV{PatchWurflUrl}) {
$patchwurflurl=$ENV{PatchWurflUrl};
$CommonLib->printLog("PatchWurflUrl is: $patchwurflurl");
}
if ($ENV{CookieCacheSystem}) {
$cookiecachesystem=$ENV{CookieCacheSystem};
$CommonLib->printLog("CookieCacheSystem is: $cookiecachesystem");
}
$CommonLib->printLog("Finish loading parameter");
$CommonLib->printLog("---------------------------------------------------------------------------");
if ($wurflnetdownload eq "true") {
$CommonLib->printLog("Start process downloading WURFL.xml from $downloadwurflurl");
$CommonLib->printLog ("Test the URL");
my ($content_type, $document_length, $modified_time, $expires, $server) = head($downloadwurflurl);
if ($content_type eq "") {
lib/Apache2/WURFLFilter.pm view on Meta::CPAN
my $query_string=$f->args;
my $docroot = $f->document_root();
my $id="";
my $location="none";
my $width_toSearch;
my $type_redirect="internal";
my $return_value;
my $dummy="";
my $variabile2="";
my %ArrayCapFound;
my $controlCookie;
my $query_img="";
$ArrayCapFound{is_transcoder}='false';
my %ArrayQuery;
my $var;
my $mobile=0;
if ($x_user_agent) {
$f->log->warn("Warn probably transcoder: $x_user_agent");
$user_agent=$x_user_agent;
}
if ($user_agent =~ m/Blackberry/i) {
$user_agent=substr($user_agent,index($user_agent,'BlackBerry'));
$mobile=1;
}
if ($user_agent =~ m/UP.link/i ) {
$user_agent=substr($user_agent,0,index($user_agent,'UP.Link') - 1);
$mobile=1;
}
my $cookie = $f->headers_in->{Cookie} || '';
$id=$CommonLib->readCookie($cookie);
if ($cacheSystem->restore( 'wurfl-ua', $user_agent )) {
#
# cookie is not empty so I try to read in memory cache on my httpd cache
#
$id=$cacheSystem->restore( 'wurfl-ua', $user_agent );
if ($cacheSystem->restore( 'wurfl-id', $id )) {
#
# I'm here only for old device
#
my @pairs = split(/&/, $cacheSystem->restore( 'wurfl-id', $id ));
lib/Apache2/WURFLFilter.pm view on Meta::CPAN
foreach $capability2 (sort keys %ArrayCapFound) {
$variabile2="$variabile2$capability2=$ArrayCapFound{$capability2}&";
my $upper=uc($capability2);
$f->subprocess_env("AMF_$upper" => $ArrayCapFound{$capability2});
}
$variabile2="id=$id&$variabile2";
$f->subprocess_env("AMF_ID" => $id);
$cacheSystem->store( 'wurfl-id', $id, $variabile2 );
$cacheSystem->store( 'wurfl-ua', $user_agent, $id);
if ($cookiecachesystem eq "true") {
$f->err_headers_out->set('Set-Cookie' => "amf=$id; path=/;");
}
}
$f->pnotes('width' => $ArrayCapFound{max_image_width});
$f->pnotes('height' => $ArrayCapFound{max_image_height});
$f->pnotes('device_claims_web_support' => $ArrayCapFound{device_claims_web_support});
$f->pnotes('is_wireless_device' => $ArrayCapFound{is_wireless_device});
$f->pnotes('is_transcoder' => $ArrayCapFound{is_transcoder});
} else {
#
# unknown device
#
$cacheSystem->store( 'wurfl-ua', $user_agent, "device_not_found");
if ($cookiecachesystem eq "true") {
$f->err_headers_out->set('Set-Cookie' => "amf=device_not_found; path=/;");
}
}
}
$f->subprocess_env("AMF_VER" => $VERSION);
$f->subprocess_env("AMF_WURFLVER" => $WURFLVersion);
return Apache2::Const::DECLINED;
}
1;
__END__
lib/Apache2/WURFLFilter.pm view on Meta::CPAN
=item C<PerlSetEnv PatchWurflNetDownload true>
=item C<PerlSetEnv PatchWurflUrl http://wurfl.sourceforge.net/web_browsers_patch.xml>
=item C<PerlSetEnv MobileVersionUrl /cgi-bin/perl.html> ** (default is "none" that mean the filter pass through)
=item C<PerlSetEnv FullBrowserUrl http://www.google.com> ** (default is "none" that mean the filter pass through)
=item C<PerlSetEnv RedirectTranscoderUrl /transcoderpage.html> (default is "none" that mean the filter pass through)
=item C<PerlSetEnv CookieCacheSystem true> (default is false, but for production mode is suggested to set in true)
=item C<PerlModule Apache2::WURFLFilter>
=item C<PerlTransHandler +Apache2::WURFLFilter>
=back
* the field separator of each capability you want to consider in your mobile site is ",". Important you now can set ALL (default value) if you want that the filter managed all wurfl capabilities
**if you put a relative url (for example "/path") the filter done an internal redirect, if you put a url redirect with protocol (for example "http:") the filter done a classic redirect
( run in 1.855 second using v1.01-cache-2.11-cpan-6aa56a78535 )