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