+ # Call function to get the final path and filename for the downloaded file.
+ my $dl_rulesfile = &_get_dl_rulesfile($provider);
+
+ # Check if the rulesfile already exits, because it has been downloaded in the past.
+ #
+ # In this case we are requesting the server if the remote file has been changed or not.
+ # This will be done by sending the modification time in a special HTTP header.
+ if (-f $dl_rulesfile) {
+ # Call stat on the file.
+ my $stat = stat($dl_rulesfile);
+
+ # Omit the mtime of the existing file.
+ my $mtime = $stat->mtime;
+
+ # Convert the timestamp into right format.
+ my $http_date = time2str($mtime);
+
+ # Add the If-Modified-Since header to the request to ask the server if the
+ # file has been modified.
+ $request->header( 'If-Modified-Since' => "$http_date" );
+ }
+