Apache/2.2.9 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0

Is there something special I need to do to allow keep-alive responses
for HTTP 1.0 requests?

If I setup a simple httpd.conf with a DocumentRoot and a simple
mod_perl handler I get keep-alive connections as I expect with HTTP
1.1, but with 1.0 I only get keep-alive connections with the static
content.

The issue is I have Perlbal in front of mod_perl and it always sends a
1.0 header to the back end so the mod_perl requests are not kept
alive.


Here's an example:

    $ cat httpd.conf

    <IfModule !mod_perl.c>
        LoadModule perl_module  /usr/lib/apache2/modules/mod_perl.so
    </IfModule>
    <IfModule !mod_mime.c>
        LoadModule mime_module  /usr/lib/apache2/modules/mod_mime.so
    </IfModule>

    ErrorLog    httpd_test.log
    PidFile     httpd_test.pid
    TypesConfig /etc/mime.types
    ServerName  localhost
    Listen      127.0.0.1:10000

    KeepAlive On
    KeepAliveTimeout 20000
    MaxKeepAliveRequests 0
    DocumentRoot /var/www

    <Perl>
        package Foo;
        use Apache2::RequestIO   ();
        use Apache2::RequestRec  ();

        sub handler {
            my $r = shift;
            $r->print( 'This is content' );
            $r->status( 200 );
            $r->content_type( 'text/plain' );
            $r->rflush;
            return Apache2::Const::OK;
        }
    </Perl>


    <Location /foo>
        SetHandler modperl
        PerlResponseHandler Foo
    </Location>



Start the server:

    $ /usr/sbin/apache2 -d $HOME -f httpd.conf -k start


Fetch static content with HTTP 1.0 and get a keep-alive connection.

    $ telnet localhost 10000
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    GET /index.html HTTP/1.0
    Host: localhost:10000
    Keep-Alive: 300
    Connection: keep-alive


    HTTP/1.1 200 OK
    Date: Mon, 08 Dec 2008 18:48:38 GMT
    Server: Apache/2.2.9 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0
    Last-Modified: Sun, 17 Aug 2008 02:33:33 GMT
    ETag: "e0049-2d-4549eae51b940"
    Accept-Ranges: bytes
    Content-Length: 45
    Keep-Alive: timeout=20000
    Connection: Keep-Alive
    Content-Type: text/html

    <html><body><h1>It works!</h1></body></html>


Fetch mod_perl response with 1.0 and no keep-alive connection:

    $ telnet localhost 10000
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    GET /foo HTTP/1.0
    Host: localhost:10000
    Keep-Alive: 300
    Connection: keep-alive

    HTTP/1.1 200 OK
    Date: Mon, 08 Dec 2008 18:49:26 GMT
    Server: Apache/2.2.9 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0
    Connection: close
    Content-Type: text/plain


Fetch mod_perl with http 1.1 and do get the keep-alive connection.

    $ telnet localhost 10000
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    GET /foo HTTP/1.1
    Host: localhost:10000
    Keep-Alive: 300
    Connection: keep-alive

    HTTP/1.1 200 OK
    Date: Mon, 08 Dec 2008 18:50:23 GMT
    Server: Apache/2.2.9 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0
    Keep-Alive: timeout=20000
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/plain

    f
    This is content
    0




-- 
Bill Moseley
[EMAIL PROTECTED]
Sent from my iMutt

Reply via email to