| @@ 377-394 (lines=18) @@ | ||
| 374 | * |
|
| 375 | * @return array Test results. |
|
| 376 | */ |
|
| 377 | protected function test__outbound_http() { |
|
| 378 | $name = __FUNCTION__; |
|
| 379 | $request = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 380 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 381 | ||
| 382 | if ( 200 === intval( $code ) ) { |
|
| 383 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 384 | } else { |
|
| 385 | $result = self::failing_test( |
|
| 386 | array( |
|
| 387 | 'name' => $name, |
|
| 388 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTP' ), |
|
| 389 | ) |
|
| 390 | ); |
|
| 391 | } |
|
| 392 | ||
| 393 | return $result; |
|
| 394 | } |
|
| 395 | ||
| 396 | /** |
|
| 397 | * Test that the server is able to send an outbound https communication. |
|
| @@ 401-418 (lines=18) @@ | ||
| 398 | * |
|
| 399 | * @return array Test results. |
|
| 400 | */ |
|
| 401 | protected function test__outbound_https() { |
|
| 402 | $name = __FUNCTION__; |
|
| 403 | $request = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 404 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 405 | ||
| 406 | if ( 200 === intval( $code ) ) { |
|
| 407 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 408 | } else { |
|
| 409 | $result = self::failing_test( |
|
| 410 | array( |
|
| 411 | 'name' => $name, |
|
| 412 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTPS' ), |
|
| 413 | ) |
|
| 414 | ); |
|
| 415 | } |
|
| 416 | ||
| 417 | return $result; |
|
| 418 | } |
|
| 419 | ||
| 420 | /** |
|
| 421 | * Check for an IDC. |
|