From 009191a35e8f4d15aa366083cf8b79994a311065 Mon Sep 17 00:00:00 2001 From: dpavlin Date: Tue, 24 Nov 2009 21:47:20 +0100 Subject: [PATCH] don't replace pdf with text link --- proxy.pl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/proxy.pl b/proxy.pl index 1df91a4..a25481c 100755 --- a/proxy.pl +++ b/proxy.pl @@ -149,18 +149,18 @@ $proxy->push_filter( my ( $self, $message ) = @_; # for information, saorge $saved = 0; }, - filter => sub { - my ( $self, $dataref, $message, $protocol, $buffer ) = @_; - $$dataref = $saved++ ? "" - : sprintf '

Saving PDF file. Go back

', - $message->request->header('referer'); - } +# filter => sub { +# my ( $self, $dataref, $message, $protocol, $buffer ) = @_; +# $$dataref = $saved++ ? "" +# : sprintf '

Saving PDF file. Go back

', +# $message->request->header('referer'); +# } ), # change the response Content-Type response => HTTP::Proxy::HeaderFilter::simple->new( sub { my ( $self, $headers, $response ) = @_; - $headers->content_type('text/html'); +# $headers->content_type('text/html'); } ), ); @@ -176,7 +176,9 @@ warn "XXX ", $headers->header('x-forwarded-for'), ' ', $message->uri, "\n"; my $host = $message->uri->host; return unless $host eq $proxy->host; - $info->{debug} = not $info->{debug} if $message->uri->query =~ m{debug}; + if ( my $q = $message->uri->query ) { + $info->{debug} = not $info->{debug} if $q =~ m{debug}; + } warn "## ", dump( $headers, $message ) if $info->{debug}; my $host_port = $proxy->host . ':' . $proxy->port; -- 2.20.1