Thank you everyone for your thoughts and help.  :-)

Geoffrey Young wrote:
> $r->no_cache(1) ...

That's the kind of answer I was hoping for.  RTFM "perldoc Apache" looks
encouraging.  Implement it (see CVS diff below).  Nope -- IE still displays the
same image every time.  :-(


Let's do some trouble shooting with wget, to see if we can isolate it to the
server or the client:

[EMAIL PROTECTED]:~$ wget http://192.168.254.3/random/picture
--16:13:43--  http://192.168.254.3/random/picture
           => `picture'
Connecting to 192.168.254.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26,720 [image/jpeg]

100%[====================================>] 26,720        --.--K/s

16:13:43 (6.37 MB/s) - `picture' saved [26720/26720]


[EMAIL PROTECTED]:~$ wget http://192.168.254.3/random/picture
--16:14:20--  http://192.168.254.3/random/picture
           => `picture.1'
Connecting to 192.168.254.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20,831 [image/jpeg]

100%[====================================>] 20,831        --.--K/s

16:14:21 (6.62 MB/s) - `picture.1' saved [20831/20831]


Looking at the Apache log on the server:

[EMAIL PROTECTED]:~# tail -n 15 /var/log/apache-perl/error.log  | grep redirect
[Fri Jul  1 16:13:16 2005] [error] Apache::RandomPicture::handler
(/home/dpchrist/eagle-book/lib/perl/Apache/RandomPicture.pm 117): redirecting to
'/images/2075_2.jpg'
[Fri Jul  1 16:13:53 2005] [error] Apache::RandomPicture::handler
(/home/dpchrist/eagle-book/lib/perl/Apache/RandomPicture.pm 117): redirecting to
'/images/2075_4.jpg'


Apache should have sent 2075_2.jpg and 2075_4.jpg.  Check their sizes:

[EMAIL PROTECTED]:~# ll /home/dpchrist/eagle-book/images/2075_[24]*
-rw-r--r--  1 dpchrist dpchrist 26720 Jun  3  2003 /home/dpchrist/eagle-book/ima
ges/2075_2.jpg
-rw-r--r--  1 dpchrist dpchrist 20831 Jun  3  2003 /home/dpchrist/eagle-book/ima
ges/2075_4.jpg


Sent files have identical sizes as disk files Apache said it sent.


Do some more digging -- use wget's -s (save-headers) option to see the headers:

[EMAIL PROTECTED]:~$ wget -s http://192.168.254.3/random/picture
--16:37:21--  http://192.168.254.3/random/picture
           => `picture.2'
Connecting to 192.168.254.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20,831 [image/jpeg]

100%[====================================>] 20,831        --.--K/s

16:37:21 (9.93 MB/s) - `picture.2' saved [20831/20831]

[EMAIL PROTECTED]:~$ head -n 12 picture.2
HTTP/1.1 200 OK
Date: Fri, 01 Jul 2005 23:36:53 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_perl/1.29
Last-Modified: Wed, 04 Jun 2003 06:53:10 GMT
ETag: "1064b-515f-3edd9756;42c4b3fd"
Accept-Ranges: bytes
Content-Length: 20831
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: image/jpeg
Expires: Fri, 01 Jul 2005 23:36:53 GMT


The "Expires" field seems to be set to the time the document was fetched
(matches the "Date" field).  Try again:

[EMAIL PROTECTED]:~$ wget -s -nv http://192.168.254.3/random/picture
16:41:15 URL:http://192.168.254.3/random/picture [20831/20831] -> "picture.3"
[1]
[EMAIL PROTECTED]:~$ head -n 12 picture.3
HTTP/1.1 200 OK
Date: Fri, 01 Jul 2005 23:40:47 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_perl/1.29
Last-Modified: Wed, 04 Jun 2003 06:53:10 GMT
ETag: "1064b-515f-3edd9756;42c4b3fd"
Accept-Ranges: bytes
Content-Length: 20831
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: image/jpeg
Expires: Fri, 01 Jul 2005 23:40:47 GMT


Apache is setting the "Expires" header to the current time each time.  Is IE
ignoring it, or does not understand GMT (?).


Add ".jpg" extensions to the first two files and look at them -- yes, they're
2075_2.jpg and 2075_4.jpg.


Double-check IE settings via Tools -> Internet Options:

1.  Security -> Medium.

2.  Privacy -> Medium.

3.  Advanced -> Restore Defaults.


Shut down client computer.  Gracefully restart server.  Boot client.  Try again.
Same problem.


Fetch /random/picture a couple of times (same image).  Gracefully restart
server.  Try again.  Same problem.


Put the subr->run() implementation back in place.  Gracefully restart server.
Try again.  Now it works.


I think I've given this dead horse a thorough beating -- I think IE 6.0 is the
problem.


The Apache work-around would seem to be $subr->run().


David
--

<CVSENV>[EMAIL PROTECTED]:~/eagle-book/lib/perl/Apache$ cvs -q diff -r 1.3 
RandomPicture.pm
Index: RandomPicture.pm
===================================================================
RCS file: /cvs/dpchrist/eagle-book/lib/perl/Apache/RandomPicture.pm,v
retrieving revision 1.3
retrieving revision 1.5
diff -r1.3 -r1.5
2c2
< # $Id: RandomPicture.pm,v 1.3 2005/06/30 03:52:18 dpchrist Exp $
---
> # $Id: RandomPicture.pm,v 1.5 2005/07/01 23:03:27 dpchrist Exp $
114a115,118
>       $r->no_cache(1);
>       $r->log_error(sprintf("%s (%s %s): ",
>           (caller(0))[3], __FILE__, __LINE__),
>           "redirecting to '$lucky_one'");

Reply via email to