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