// If we are streaming to a file but no filename was given drop it in the WP temp dir
// and pick its name using the basename of the $url.
if ( $parsed_args['stream'
] ) { if ( empty( $parsed_args['filename'
] ) ) { $parsed_args['filename'
] =
get_temp_dir() .
basename( $url );
} // Force some settings if we are streaming to a file and check for existence
// and perms of destination directory.
$parsed_args['blocking'
] = true;
if ( !
wp_is_writable( dirname( $parsed_args['filename'
] ) ) ) { $response =
new WP_Error( 'http_request_failed',
__( 'Destination directory for file streaming does not exist or is not writable.'
) );
/** This action is documented in wp-includes/class-wp-http.php */
do_action( 'http_api_debug',
$response, 'response', 'WpOrg\Requests\Requests',
$parsed_args,
$url );
return $response;
} } if ( is_null( $parsed_args['headers'
] ) ) { $parsed_args['headers'
] = array
();
}