Does WordPress have an Browser Agent?

I want to block a directory to everyone but WordPress’s internal upgrade feature (I am trying to get WordPress to do auto-updates of my premium plugin). I have it updating, but I really would like to block the directory for everyone but WordPress. Anyone know what WP’s internal User Agent is?

Solutions Collecting From Web of "Does WordPress have an Browser Agent?"

The WordPress user agent is set in the class WP_Http as

'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )

You can set it to a (secret) fixed value per filter:

add_filter( 'http_headers_useragent', 'wpse_59788_user_agent' );
function wpse_59788_user_agent()
    // to remove this filter immediately uncomment the following line
    // remove_filter( current_filter(), __FUNCTION__ );
    return 'alfgjlkgjlkgjsldkjhrkjh';

To change the user agent for a plugin upgrade only try something like this (not tested):

add_filter( 'upgrader_pre_install', 'wpse_59788_register' );
function wpse_59788_register( $dummy )
    add_filter( 'http_headers_useragent', 'wpse_59788_user_agent' );
    return $dummy;

And uncomment the self deactivation line in the first function.