mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Add a filter to allow custom headers to be sent via the WP HTTP IXR client: 'wp_http_ixr_client_headers'
.
Props ericmann. Fixes #24598. Built from https://develop.svn.wordpress.org/trunk@34164 git-svn-id: http://core.svn.wordpress.org/trunk@34132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
191400f9e6
commit
1b0121a841
@ -64,15 +64,27 @@ class WP_HTTP_IXR_Client extends IXR_Client {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Merge Custom headers ala #8145
|
// Merge Custom headers ala #8145
|
||||||
foreach ( $this->headers as $header => $value )
|
foreach ( $this->headers as $header => $value ) {
|
||||||
$args['headers'][$header] = $value;
|
$args['headers'][$header] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $this->timeout !== false )
|
/**
|
||||||
|
* Filter to allow custom headers to be sent
|
||||||
|
*
|
||||||
|
* @since 4.4.0
|
||||||
|
*
|
||||||
|
* @param array $headers Header collection to be sent to the XML-RPC server.
|
||||||
|
*/
|
||||||
|
$args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] );
|
||||||
|
|
||||||
|
if ( $this->timeout !== false ) {
|
||||||
$args['timeout'] = $this->timeout;
|
$args['timeout'] = $this->timeout;
|
||||||
|
}
|
||||||
|
|
||||||
// Now send the request
|
// Now send the request
|
||||||
if ( $this->debug )
|
if ( $this->debug ) {
|
||||||
echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
|
echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
$response = wp_remote_post($url, $args);
|
$response = wp_remote_post($url, $args);
|
||||||
|
|
||||||
@ -88,8 +100,9 @@ class WP_HTTP_IXR_Client extends IXR_Client {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->debug )
|
if ( $this->debug ) {
|
||||||
echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
|
echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Now parse what we've got back
|
// Now parse what we've got back
|
||||||
$this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
|
$this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34163';
|
$wp_version = '4.4-alpha-34164';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user