| @@ 277-294 (lines=18) @@ | ||
| 274 | * |
|
| 275 | * @return array Test results. |
|
| 276 | */ |
|
| 277 | protected function test__outbound_http() { |
|
| 278 | $name = __FUNCTION__; |
|
| 279 | $request = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 280 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 281 | ||
| 282 | if ( 200 === intval( $code ) ) { |
|
| 283 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 284 | } else { |
|
| 285 | $result = self::failing_test( |
|
| 286 | array( |
|
| 287 | 'name' => $name, |
|
| 288 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTP' ), |
|
| 289 | ) |
|
| 290 | ); |
|
| 291 | } |
|
| 292 | ||
| 293 | return $result; |
|
| 294 | } |
|
| 295 | ||
| 296 | /** |
|
| 297 | * Test that the server is able to send an outbound https communication. |
|
| @@ 301-318 (lines=18) @@ | ||
| 298 | * |
|
| 299 | * @return array Test results. |
|
| 300 | */ |
|
| 301 | protected function test__outbound_https() { |
|
| 302 | $name = __FUNCTION__; |
|
| 303 | $request = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 304 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 305 | ||
| 306 | if ( 200 === intval( $code ) ) { |
|
| 307 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 308 | } else { |
|
| 309 | $result = self::failing_test( |
|
| 310 | array( |
|
| 311 | 'name' => $name, |
|
| 312 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTPS' ), |
|
| 313 | ) |
|
| 314 | ); |
|
| 315 | } |
|
| 316 | ||
| 317 | return $result; |
|
| 318 | } |
|
| 319 | ||
| 320 | /** |
|
| 321 | * Check for an IDC. |
|