Hello,

While preparing to upgrade our production servers, I encountered
a problem that may involve mod_proxy code.  When html code is
generated and printed by our mod_perl handler initiated directly
from the back end the output is correct.  When the same operation
is initiated via the front end proxy server the output is corrupted
by extraneous numbers.  I have set up a test scenario to isolate
the problem.  Our new server configurations include this software:

        Front End                       Back End
        ---------                       --------
        kernel-2.4.9-31                 kernel-2.4.9-31
        apache_1.3.24                   apache_1.3.24
        mod_ssl-2.8.8-1.3.24            mod_perl-1.26
        openssl-0.9.6c
        mm-1.1.3

The front end apache configuration includes:

    <VirtualHost 192.168.20.111:80>
        ServerName gelco5.yvod.com
        DocumentRoot /www/gelcompany/html

        RewriteEngine On
        RewriteLogLevel 9
        RewriteOptions 'inherit'

        RewriteRule ^/$ http://192.168.20.111:8089/ [proxy,last]

        RewriteRule ^/(.+)$ /www/gelcompany/html/$1 [last]
    </VirtualHost>

The back end apache configuration includes:

    NameVirtualHost 192.168.20.111:8089
    Listen 8089
    <VirtualHost 192.168.20.111:8089>
        ServerName gelco5.yvod.com
        DocumentRoot /www/gelcompany/html

        Alias / /www/gelcompany/modperl

        <Location />
            SetHandler perl-script
            PerlHandler YVOD::welcome
        </Location>
    </VirtualHost>

The test handler code looks like this:

    #!/usr/bin/perl -w -d
    package YVOD::welcome;
    use strict;

    sub handler{
        my $r = shift;
        $r->send_http_header('text/html');
        print qq|<html><body bgcolor="#FFFFFF">\n|;
        print "You are Welcome at ", $r->get_remote_host, "<BR><BR>\n";
        while (my ($key, $val) = each %ENV) {
            print "$key = $val<BR>\n"; }
        print "</body></html>";
        return 1;
    }
    1;

The outout source looks like this when initiated directly from the
back end (http://192.168.20.111:8089/):

    <html><body bgcolor="#FFFFFF">
    You are Welcome at 192.168.20.98<BR><BR>
    QUERY_STRING = <BR>
    HTTP_ACCEPT_LANGUAGE = en<BR>
    TZ = PST8PDT<BR>
    REMOTE_PORT = 3201<BR>
    HTTP_USER_AGENT = Mozilla/4.76 [en] (X11; U; Linux 2.2.14-5.0 i686)<BR>
    HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*<BR>
    HTTP_HOST = 192.168.20.111:8089<BR>
    GATEWAY_INTERFACE = CGI-Perl/1.1<BR>
    SCRIPT_NAME = /<BR>
    SERVER_NAME = gelco5.yvod.com<BR>
    HTTP_ACCEPT_ENCODING = gzip<BR>
    MOD_PERL = mod_perl/1.26<BR>
    HTTP_ACCEPT_CHARSET = iso-8859-1,*,utf-8<BR>
    HTTP_COOKIE = YVOD_SESSION_ID=2e4046b477f9374f<BR>
    SCRIPT_FILENAME = /www/gelcompany/modperl<BR>
    PATH = /bin:/usr/bin<BR>
    SERVER_ADDR = 192.168.20.111<BR>
    MOD_PERL_TRACE = all<BR>
    SERVER_PROTOCOL = HTTP/1.0<BR>
    HTTP_CONNECTION = Keep-Alive<BR>
    SERVER_SIGNATURE = <ADDRESS>Apache/1.3.24 Server at gelco5.yvod.com Port
8089</ADDRESS>
    <BR>
    SERVER_SOFTWARE = Apache/1.3.24 (Unix) mod_perl/1.26<BR>
    SERVER_ADMIN = [EMAIL PROTECTED]<BR>
    REMOTE_ADDR = 192.168.20.98<BR>
    DOCUMENT_ROOT = /www/gelcompany/html<BR>
    REQUEST_URI = /<BR>
    REQUEST_METHOD = GET<BR>
    SERVER_PORT = 8089<BR>
    </body></html>

The outout source looks like this when initiated via the front end
proxy server (http://gelco5.yvod.com/):

    49a
    <html><body bgcolor="#FFFFFF">
    You are Welcome at 192.168.20.111<BR><BR>
    QUERY_STRING = <BR>
    HTTP_ACCEPT_LANGUAGE = en<BR>
    TZ = PST8PDT<BR>
    REMOTE_PORT = 2462<BR>
    HTTP_USER_AGENT = Mozilla/4.76 [en] (X11; U; Linux 2.2.14-5.0 i686)<BR>
    HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*<BR>
    HTTP_HOST = 192.168.20.111:8089<BR>
    GATEWAY_INTERFACE = CGI-Perl/1.1<BR>
    SCRIPT_NAME = /<BR>
    SERVER_NAME = gelco5.yvod.com<BR>
    HTTP_ACCEPT_ENCODING = gzip<BR>
    MOD_PERL = mod_perl/1.26<BR>
    HTTP_ACCEPT_CHARSET = iso-8859-1,*,utf-8<BR>
    HTTP_VIA = 1.0 gelco5.yvod.com (Apache/1.3.24)<BR>
    SCRIPT_FILENAME = /www/gelcompany/modperl<BR>
    PATH = /bin:/usr/bin<BR>
    HTTP_X_FORWARDED_FOR = 192.168.20.96<BR>
    SERVER_ADDR = 192.168.20.111<BR>
    MOD_PERL_TRACE = all<BR>
    SERVER_PROTOCOL = HTTP/1.1<BR>
    HTTP_CONNECTION = close<BR>
    SERVER_SIGNATURE = <ADDRESS>Apache/1.3.24 Server at gelco5.yvod.com Port
8089</ADDRESS>
    <BR>
    SERVER_SOFTWARE = Apache/1.3.24 (Unix) mod_perl/1.26<BR>
    SERVER_ADMIN = [EMAIL PROTECTED]<BR>
    REMOTE_ADDR = 192.168.20.111<BR>
    DOCUMENT_ROOT = /www/gelcompany/html<BR>
    REQUEST_URI = /<BR>
    REQUEST_METHOD = GET<BR>
    SERVER_PORT = 8089<BR>
    </body></html>
    0

In the second case, there is about a 15 second delay before the '0'
prints at the bottom of the display and 'Document Done.' is indicated.
The number that prints at the beginning changes depending upon the
content (it may be a length value), but the number at the end is
always '0'.  Also, the following messages are written to error_log:

    [Fri May  3 03:42:39 2002] [debug] proxy_cache.c(1026):
      Request for http://192.168.20.111:8089/, pragma_req=no-cache, ims=0
    [Fri May  3 03:42:39 2002] [debug] proxy_util.c(1401):
      File /opt1/httpd_docs/proxy/A/a/R/8dpIO_pSaxiSOa1CyWg not found
    [Fri May  3 03:42:39 2002] [debug] proxy_cache.c(1280):
      Local copy not present or expired. Declining.
    [Fri May  3 03:42:49 2002] [debug] proxy_cache.c(1391):
      Response is not cacheable,
        unlinking /opt1/httpd_docs/proxy/A/a/R/8dpIO_pSaxiSOa1CyWg
    [Fri May  3 03:42:49 2002] [debug] proxy_http.c(583):
      Content-Type: text/html

Although I've abbreviated it for testing, the basic configuration
is the same as I've been using in production for over two years,
but it's quite possible that the source of the problem is in the
configuration.  It's also possible that the problem has nothing to
do with mod_proxy - it could be related to Apache::PRINT.  If you
can provide any help I would be very grateful as I've been pounding
at this for several days now.  And if there is any other info I can
get for you please let me know.

Thanks, Michael...
-- 
Michael E. Lewis         YVOD, LLC / Comprehend.Com    Phone: 510-655-3974
[EMAIL PROTECTED]    5816 Ocean View Drive         Cell:  510-435-3180
[EMAIL PROTECTED]         Oakland, CA  94618-1535       Fax:   419-781-9206

Reply via email to