Re: Prefetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Krist van Besien" <krist.vanbesien@xxxxxxxxx> writes:

[...]

> What I now want to do, is have apache (or something else) look at the
> content of the response that comes from the backend, and _prefetch_
> all the images that are linked in it, so that when the request for the
> images comes they are already cached.
>
> Any ideas, modules or products that could help here?

That's an interesting idea.  I have written mod_perl code to modify a
Web page on the way through, to rewrite links to a new location.  It
went something like this in httpd.conf:

    <FilesMatch "\.(html?|js)$">
      PerlModule Apache::SiteMoved
      PerlModule Apache::Filter
      SetHandler perl-script
      PerlSetVar Filter On
      PerlHandler Apache::SiteMoved
    </FilesMatch>

and like this in lib/perl5/Apache/SiteMoved.pm:

    package Apache::SiteMoved;
    
    use Apache::Constants qw(:common :response);
    
    sub handler
    {
        my $r = shift;
    
        $r = $r->filter_register();
        $r->deterministic(1);
    
        my ($fh, $status) = $r->filter_input(); # Get status information
        return $status unless $status == OK;
        while (<$fh>)
        {
            s/(?:www\.)?old-site-name\.(?:com|net|org)/www.new-site-name.com/g;
            print;
        }
        return $status;
    }

If you could hook up a filter like this in the proxy, it could parse
the HTML, find IMG SRC commands, then fork off to a background process
to get them and put them in the cache (the easiest way would be to
just send requests for them to the Web server).

Hope that helps get you started,

-----Scott.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux