[squid-users] How to make the prefetched file cached ?

From: WestWind <zhustar_at_gmail.com>
Date: Fri, 27 Jun 2008 17:58:38 +0800

Hi,

I have been set range_offset_limit 100 MB, and maximum_object_size
100MB, then make a HTTP request to fetch a file(9MB) using php
the code:
test.php(client)
<?php
    $fp = fsockopen("file.test.com", 8080, $errno, $errstr, 30);
    if (!$fp) {
        echo "$errstr ($errno)\n";
    } else {
        $out = "GET /range-test.php HTTP/1.1\r\n";
        $out .= "Host: file1.rs.up.jp\r\n";
        $out .= "Accept: */*\r\n";
        $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.00;
Windows 98)\r\n";
        $out .= "Range: bytes=1024-7341056\r\n";
        $out .= "Connection: Close\r\n\r\n";
        fwrite($fp, $out);
        while (!feof($fp)) {
            $data .= fgets($fp, 102400);
        }
        fclose($fp);
    }

    file_put_contents('f_squid.3gp', $data);

?>

range-test.php(back-end server):
<?php
...
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
echo $data;
...

?>

I found that squid prefetch the whole file from back-end server, but
the file is not cached in cache_dir
log message from store.log:
1214388930.927 RELEASE 00 00000000 D5E9CBAE9BAE59F13704ED768E93755F
200 1214388928 -1 1245924928 text/html 9705468/7394261 GET
http://file.test.com:8080/range-test.php

when I run test.php the 2nd time, squid still fetch file from back-end server.

What's the matter ?
Received on Fri Jun 27 2008 - 09:58:53 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 27 2008 - 12:00:05 MDT