neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

After buying the eagle book I built a module that will parse any incomming request from a browser, then send a frame set html page with the correct html document in a specific frame. From browsers on my linux box everything works find. From the two Windows clients I've test both Mozilla and IE6, at random times, fail to load some of the images referenced in the html code. This only occurs when using URLs that point to that module, even for the same module on different servers. Normal browsing does not have this problem. Does anyone know what might be causing this?

Module:

package Apache::Content; use strict; use Apache::Constants qw(:common); use Apache::URI(); use Apache::File(); sub handler { my $r = shift; my ($page, $adtitle, $fh); #get the document root of the #requested URL my $document_root = $r->document_root; my $uri = $r->uri; #pars url to get form name and adtitle if ($uri =~ m/\/content\/([^-]+)-([^-]+)/){ $page = $1; $adtitle = $2; } $r->content_type('text/html'); $r->send_http_header; my $path = $r->filename; $path =~ s/(.*?)[^\/]+$/$1/; #open index frameset unless ($fh = Apache::File->new($path."index.html")){ $r->log_error("Can't open index.html: $!"); return SERVER_ERROR; } while (<$fh>){ #change main window from home.html to the page #requested #if url contained vgfrom then pass to #vgform module (Vgform.pm) if ($page =~ m/vgform/io){ s/src="?\/home\.html"?/src=\/$page-$adtitle/io; }else{ s/src="?\/home\.html"?/src=\/$page/io; } $r->print($_); } return OK; } 1;

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Modperl and Windows Clients
by valdez (Monsignor) on Dec 02, 2002 at 15:59 UTC

    Probably you are serving images through your handler... a simple solution is:

    sub handler { my $request = shift; if (($request->content_type() ne 'text/html')) { return DECLINED; } ...

    Or simply disable your handler via configuration:

    <Location /location/of/images> Options ... SetHandler default </Location>

    There is also an error in your logic: you shouldn't send HTTP headers when you return SERVER_ERROR.

    Ciao, Valerio

Re: Modperl and Windows Clients
by perrin (Chancellor) on Dec 02, 2002 at 16:03 UTC
    Your question is a little unclear. Does this module generate or modify the HTML with the image tags in it, and have you confirmed that the image tags are correct? Does it handle requests for images? It doesn't look like it does.

    If the module itself isn't sending bad HTML and doesn't handle image requests, then it can't be responsible for the problem. Usually this kind of random failure has to do with browser bugs related to pipelining or keep-alive connections. Check general apache resources for possible config changes that might help.