| @@ 321-338 (lines=18) @@ | ||
| 318 | * |
|
| 319 | * @return array Test results. |
|
| 320 | */ |
|
| 321 | protected function test__outbound_http() { |
|
| 322 | $name = __FUNCTION__; |
|
| 323 | $request = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 324 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 325 | ||
| 326 | if ( 200 === intval( $code ) ) { |
|
| 327 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 328 | } else { |
|
| 329 | $result = self::failing_test( |
|
| 330 | array( |
|
| 331 | 'name' => $name, |
|
| 332 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTP' ), |
|
| 333 | ) |
|
| 334 | ); |
|
| 335 | } |
|
| 336 | ||
| 337 | return $result; |
|
| 338 | } |
|
| 339 | ||
| 340 | /** |
|
| 341 | * Test that the server is able to send an outbound https communication. |
|
| @@ 345-362 (lines=18) @@ | ||
| 342 | * |
|
| 343 | * @return array Test results. |
|
| 344 | */ |
|
| 345 | protected function test__outbound_https() { |
|
| 346 | $name = __FUNCTION__; |
|
| 347 | $request = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 348 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 349 | ||
| 350 | if ( 200 === intval( $code ) ) { |
|
| 351 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 352 | } else { |
|
| 353 | $result = self::failing_test( |
|
| 354 | array( |
|
| 355 | 'name' => $name, |
|
| 356 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTPS' ), |
|
| 357 | ) |
|
| 358 | ); |
|
| 359 | } |
|
| 360 | ||
| 361 | return $result; |
|
| 362 | } |
|
| 363 | ||
| 364 | /** |
|
| 365 | * Check for an IDC. |
|