Coding Standards: Rename the $strHeaders variable to $headers in WP_Http_Streams::request().

This fixes a `Variable "$strHeaders" is not in valid snake_case format` WPCS warning.

Follow-up to [8516], [51825], [51929], [51940], [52960], [52961].

Props azouamauriac.
See #54728.

git-svn-id: https://develop.svn.wordpress.org/trunk@52962 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-03-20 15:48:26 +00:00
parent ced5b7d848
commit e38ea6ae31

View File

@ -211,7 +211,7 @@ class WP_Http_Streams {
$request_path = $parsed_url['path'] . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' );
}
$strHeaders = strtoupper( $parsed_args['method'] ) . ' ' . $request_path . ' HTTP/' . $parsed_args['httpversion'] . "\r\n";
$headers = strtoupper( $parsed_args['method'] ) . ' ' . $request_path . ' HTTP/' . $parsed_args['httpversion'] . "\r\n";
$include_port_in_host_header = (
( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
@ -220,34 +220,34 @@ class WP_Http_Streams {
);
if ( $include_port_in_host_header ) {
$strHeaders .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n";
$headers .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n";
} else {
$strHeaders .= 'Host: ' . $parsed_url['host'] . "\r\n";
$headers .= 'Host: ' . $parsed_url['host'] . "\r\n";
}
if ( isset( $parsed_args['user-agent'] ) ) {
$strHeaders .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n";
$headers .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n";
}
if ( is_array( $parsed_args['headers'] ) ) {
foreach ( (array) $parsed_args['headers'] as $header => $headerValue ) {
$strHeaders .= $header . ': ' . $headerValue . "\r\n";
$headers .= $header . ': ' . $headerValue . "\r\n";
}
} else {
$strHeaders .= $parsed_args['headers'];
$headers .= $parsed_args['headers'];
}
if ( $proxy->use_authentication() ) {
$strHeaders .= $proxy->authentication_header() . "\r\n";
$headers .= $proxy->authentication_header() . "\r\n";
}
$strHeaders .= "\r\n";
$headers .= "\r\n";
if ( ! is_null( $parsed_args['body'] ) ) {
$strHeaders .= $parsed_args['body'];
$headers .= $parsed_args['body'];
}
fwrite( $handle, $strHeaders );
fwrite( $handle, $headers );
if ( ! $parsed_args['blocking'] ) {
stream_set_blocking( $handle, 0 );