DDG

 view release on metacpan or  search on metacpan

lib/DDG/Rewrite.pm  view on Meta::CPAN

		$cfg .= "\tproxy_set_body '" . $self->post_body . "';\n";

		# This block sets the proxy cache key from the spice name and the combined
		# set of captured GET parameters. The 'map' builds a hash of these capture
		# parameters as keys to ensure each one occurs only once. We can then pull these
		# out consistently by calling 'sort keys' on the returned hash and 'join' turns
		# the sorted keys into a single string.
		# e.g. post_body '{"method":"$2","query":"$1","cleaned_query":"$1"}'
		# Would give a $cache_keys value of '$1$2'
		my $cache_keys = join '', sort keys %{ {
			map { $_ => 1 } ( $self->post_body =~ m/\$[0-9]+/g )
		} };
		$cfg .= "\tproxy_cache_key spice_${spice_name}_$cache_keys;\n"
	}

	if($uses_echo_module) {
		# we need to make sure we have plain text coming back until we have a way
		# to unilaterally gunzip responses from the upstream since the echo module
		# will intersperse plaintext with gzip which results in encoding errors.
		# https://github.com/agentzh/echo-nginx-module/issues/30
		$cfg .= "\tproxy_set_header Accept-Encoding '';\n";



( run in 0.233 second using v1.01-cache-2.11-cpan-b61123c0432 )