| @@ 393-410 (lines=18) @@ | ||
| 390 | * |
|
| 391 | * @return array Test results. |
|
| 392 | */ |
|
| 393 | protected function test__outbound_http() { |
|
| 394 | $name = __FUNCTION__; |
|
| 395 | $request = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 396 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 397 | ||
| 398 | if ( 200 === (int) $code ) { |
|
| 399 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 400 | } else { |
|
| 401 | $result = self::failing_test( |
|
| 402 | array( |
|
| 403 | 'name' => $name, |
|
| 404 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTP' ), |
|
| 405 | ) |
|
| 406 | ); |
|
| 407 | } |
|
| 408 | ||
| 409 | return $result; |
|
| 410 | } |
|
| 411 | ||
| 412 | /** |
|
| 413 | * Test that the server is able to send an outbound https communication. |
|
| @@ 417-434 (lines=18) @@ | ||
| 414 | * |
|
| 415 | * @return array Test results. |
|
| 416 | */ |
|
| 417 | protected function test__outbound_https() { |
|
| 418 | $name = __FUNCTION__; |
|
| 419 | $request = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 420 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 421 | ||
| 422 | if ( 200 === (int) $code ) { |
|
| 423 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 424 | } else { |
|
| 425 | $result = self::failing_test( |
|
| 426 | array( |
|
| 427 | 'name' => $name, |
|
| 428 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTPS' ), |
|
| 429 | ) |
|
| 430 | ); |
|
| 431 | } |
|
| 432 | ||
| 433 | return $result; |
|
| 434 | } |
|
| 435 | ||
| 436 | /** |
|
| 437 | * Check for an IDC. |
|