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