App-HTTP_Proxy_IMP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

- better debugging 
- accept replacements of empty buffers
- stability improvements
- make IMP_MAX_IN_ANALYZER configurable
0.941 2013-02-08
- restored functionality, that plugin might rewrite URL to 
  internal://orig_url and than create the response itself
- fix content decoding (gzip..) if it is upfront known, that
  the body will not change. In this case the client will get
  the origiganl encoded content, but the analyzer gets the
  decoded content
0.94 2013-02-07
- major rewrite of Request.pm and IMP.pm:
  - don't use InspectChain any longer in Request,
  - decode content only if inspection of content is required
  - defer sending request header as long as content-length is not known
0.931 2013-01-23
- stability improvements on connection errors
- improvements to FakeResponse for URIs ending with '/'
0.93 2013-01-22
- add FakeResponse plugin to hijack requests and send alternate response 

lib/App/HTTP_Proxy_IMP/IMP.pm  view on Meta::CPAN

	    $self->{pass_encoded}[1] = 1;

	    my $pass = $self->{pass}[1];
	    if ( $pass and defined $orig_clen and ( 
		$pass == IMP_MAXOFFSET or 
		$pass >= $orig_clen + $orig_hlen )) {
		# no need to decode body
		$self->{decode}{IMP_DATA_HTTPRQ_CONTENT+0}[1] = undef;
	    }
	} else {
	    # content is encoded and inspection wants to see decoded stuff,
	    # which we then will forward too 
	    # but decoding might change length
	    $clen = undef;
	    # the content will be delivered decoded
	    delete $xhdr->{fields}{'content-encoding'}
	}
    }
    if ( defined $clen ) {
	$xhdr->{fields}{'content-length'} = [ $clen ];
	$xhdr->{content_length} = $clen;
    }

    callback:
    $callback->(@cb_args,$hdr,$xhdr);

lib/App/HTTP_Proxy_IMP/IMP.pm  view on Meta::CPAN

    my $encoded_data;
    if ( my $decode = $self->{decode}{$type+0}[$dir] ) {
	# set up decoder if not set up yet
	if ( ! ref($decode)) {
	    # create function to decode content
	    $self->{decode}{$type+0}[$dir] = $decode = _create_decoder($decode)
		|| return $self->{request}->fatal(
		"cannot decode content-encoding $decode");
	}

	# offsets relates to original stream, but we put the decoded stream
	# into ibuf. And offset>0 means, that we have a gap in the input,
	# which is not allowed, when decoding a stream.
	die "cannot use content decoder with gap in data" if $offset;

	$encoded_data = $data if $self->{pass_encoded}[$dir];
	defined( $data = $decode->($data) )
	    or return $self->{request}->fatal("decoding content failed");
    }

    if ( $offset ) {



( run in 0.587 second using v1.01-cache-2.11-cpan-26ccb49234f )