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