Re: advice needed: mod_perl reverse proxy

[prev] [thread] [next] [Date index for 2005/05/04]

From: allan
Subject: Re: advice needed: mod_perl reverse proxy
Date: 12:29 on 04 May 2005
hi i don't get it. the below filter does output the content alright it 
seems, but the setting of the header *value* is incorrect. (?)
so the $f->print statement prints correct output
but the calcualtion length(output) is incorrect (since it evaluates 
length of this exact string "<html><head></head><body></body></html>\n" 
)
why is that and how to fix this ??

many thanks
./allan

# Apache/2.0.54 (Win32) mod_ssl/2.0.53 OpenSSL/0.9.7f proxy_html/2.4 
mod_perl/1.999.22-dev Perl/v5.8.6 configured

# this is the actual 11 bytes of content on URL:
# hello world

# $ get localhost
# hello world


# $ head localhost
# ...
# Server: Microsoft-IIS/6.0
# Content-Length: 40
# Content-Type: text/html; charset=utf-8
# ...


# excerpt of code
my $context;
unless ($f->ctx) {
	$r->headers_out->unset( "Content-Length" );
}

$context ||= $f->ctx;
my $content_length = 0;
my $str = "";

while ($f->read(my $buffer, 1024)) {
	$buffer = $context->{extra} . $buffer if $context->{extra};
	if (($context->{extra}) = $buffer =~ m/(<[^>]*)$/) {
		$buffer = substr($buffer, 0, - length($context->{extra}));
	}
	$str .= $buffer;
}

if ($f->seen_eos) {
	if ( $context->{extra} ) {
		$str .= $context->{extra};
	}
}

else {
	$f->ctx($context);
}



$str = Rewrite::replace_links ( $str );
# at this point $str equals: <html><head></head><body></body></html>

$content_length += length( $str );

# set header
$r->err_headers_out->set('Content-Length', $content_length );

$f->print( $str );
# at this point $str equals: all 42KB of correct html


(message missing)

advice needed: mod_perl reverse proxy
allan juul 19:18 on 20 Apr 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 20:24 on 20 Apr 2005

Re: advice needed: mod_perl reverse proxy
allan juul 20:53 on 20 Apr 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 22:08 on 20 Apr 2005

Re: advice needed: mod_perl reverse proxy
allan juul 20:22 on 30 Apr 2005

compile mod_perl with Apache::DBI support
jiesheng zhang 05:07 on 02 May 2005

Re: compile mod_perl with Apache::DBI support
Stas Bekman 06:43 on 02 May 2005

Re: compile mod_perl with Apache::DBI support
jiesheng zhang 12:10 on 02 May 2005

Re: compile mod_perl with Apache::DBI support
Perrin Harkins 14:48 on 02 May 2005

Re: compile mod_perl with Apache::DBI support
jiesheng zhang 16:21 on 02 May 2005

Re: compile mod_perl with Apache::DBI support
Perrin Harkins 16:22 on 02 May 2005

Re: compile mod_perl with Apache::DBI support
jiesheng zhang 16:46 on 02 May 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 06:48 on 02 May 2005

Re: advice needed: mod_perl reverse proxy
Devin Murphy 20:25 on 20 Apr 2005

Re: advice needed: mod_perl reverse proxy
Dominique Quatravaux 08:38 on 21 Apr 2005

Re: advice needed: mod_perl reverse proxy
Alex Greg 09:08 on 21 Apr 2005

Re: compile mod_perl with Apache::DBI support
Michael Peters 17:02 on 02 May 2005

Re: advice needed: mod_perl reverse proxy
allan juul 18:42 on 03 May 2005

Re: advice needed: mod_perl reverse proxy
Jeff Ambrosino 20:12 on 03 May 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 22:40 on 03 May 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 01:56 on 10 May 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 16:43 on 10 May 2005

Re: advice needed: mod_perl reverse proxy
allan 12:29 on 04 May 2005

Re: advice needed: mod_perl reverse proxy
Stas Bekman 01:59 on 10 May 2005

Generated at 06:56 on 17 May 2005 by mariachi v0.52