DDG

 view release on metacpan or  search on metacpan

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

	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";
	}

	if($uses_echo_module || $content_type_javascript) {
		# This is a workaround that deals with endpoints that don't support callback functions.
		# So endpoints that don't support callback functions return a content-type of 'application/json'
		# because what they're returning is not meant to be executed in the first place.
		# Setting content-type to application/javascript for those endpoints solves blocking due to
		# mime type mismatches.
		$cfg .= "\tmore_set_headers 'Content-Type: application/javascript; charset=utf-8';\n";
	}

	$cfg .= "\techo_before_body '$callback(';\n" if $wrap_jsonp_callback;
	$cfg .= "\techo_before_body '$callback".qq|("';\n| if $wrap_string_callback;

	my $upstream;
	if( $spice_name ) {
		$upstream = '$'.$spice_name.'_upstream';



( run in 0.590 second using v1.01-cache-2.11-cpan-524268b4103 )