| @@ 278-295 (lines=18) @@ | ||
| 275 | * |
|
| 276 | * @return array Test results. |
|
| 277 | */ |
|
| 278 | protected function test__outbound_http() { |
|
| 279 | $name = __FUNCTION__; |
|
| 280 | $request = wp_remote_get( preg_replace( '/^https:/', 'http:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 281 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 282 | ||
| 283 | if ( 200 === intval( $code ) ) { |
|
| 284 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 285 | } else { |
|
| 286 | $result = self::failing_test( |
|
| 287 | array( |
|
| 288 | 'name' => $name, |
|
| 289 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTP' ), |
|
| 290 | ) |
|
| 291 | ); |
|
| 292 | } |
|
| 293 | ||
| 294 | return $result; |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * Test that the server is able to send an outbound https communication. |
|
| @@ 302-319 (lines=18) @@ | ||
| 299 | * |
|
| 300 | * @return array Test results. |
|
| 301 | */ |
|
| 302 | protected function test__outbound_https() { |
|
| 303 | $name = __FUNCTION__; |
|
| 304 | $request = wp_remote_get( preg_replace( '/^http:/', 'https:', JETPACK__API_BASE ) . 'test/1/' ); |
|
| 305 | $code = wp_remote_retrieve_response_code( $request ); |
|
| 306 | ||
| 307 | if ( 200 === intval( $code ) ) { |
|
| 308 | $result = self::passing_test( array( 'name' => $name ) ); |
|
| 309 | } else { |
|
| 310 | $result = self::failing_test( |
|
| 311 | array( |
|
| 312 | 'name' => $name, |
|
| 313 | 'short_description' => $this->helper_enable_outbound_requests( 'HTTPS' ), |
|
| 314 | ) |
|
| 315 | ); |
|
| 316 | } |
|
| 317 | ||
| 318 | return $result; |
|
| 319 | } |
|
| 320 | ||
| 321 | /** |
|
| 322 | * Check for an IDC. |
|