Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter Requests library to use the Fetch handler. #1048

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Feb 23, 2024

What is this PR doing?

As the 'http_api_transports' filter is deprecated and no longer actively used, this filters the Requests library to always use the Fetch transport.

What problem is it solving?

When the kitchen sink is enabled (ie. streams extension) Requests is using that for HTTP requests, rather than using the Fetch transport (and does not automatically fallback to it).

How is the problem addressed?

Filters the Requests internals to always use the transport.

Testing Instructions

  1. Load with kitchen sink
  2. Observe failing requests, and no attempt to use Fetch
  3. Apply Patch
  4. Load with kitchen sink
  5. Observe requests succeed (or fail with CORS issues via fetch).

Fixes #1047

@adamziel
Copy link
Collaborator

Surfacing this comment: #1047 (comment)

@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Aspect] Networking labels Mar 13, 2024
@adamziel adamziel force-pushed the fix/1047-with-kitchensink-enabled branch from 873bcb2 to 6b7462a Compare April 16, 2024 20:19
@adamziel
Copy link
Collaborator

I rebased and adjusted this PR, we should stop seeing the console warnings about the http_api_transports filter in wp-admin.

@adamziel adamziel merged commit 6718533 into trunk Apr 16, 2024
5 checks passed
@adamziel adamziel deleted the fix/1047-with-kitchensink-enabled branch April 16, 2024 20:35
brandonpayton pushed a commit that referenced this pull request Jun 17, 2024
…-sink extension bundle. (#1504)

Fixes #1494 

In #1048 I introduced a regression of #819, in that `wp_http_supports( [
'ssl' ] )` no longer returned truthful without the kitchen-sink
extension bundle loaded.

This partially reverts #1048 by keeping the filters for Requests, but
reinstating the deprecated WP_HTTP filters.

It's worth noting, that this is not a direct revert, as it forces the
Fetch/Dummy handlers instead of simply adding them as an option. This is
to match the Requests filter behaviour.

To test this, the following blueprint should land you on a plugin
install page without any errors visible:

https://playground.wordpress.net/#{%22phpExtensionBundles%22:[%22light%22],%22features%22:{%22networking%22:true},%22landingPage%22:%22/wp-admin/plugin-install.php%22,%22steps%22:[{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22}]}
```
{
  "phpExtensionBundles": [
    "light"
  ],
  "features": {
    "networking": true
  },
  "landingPage": "/wp-admin/plugin-install.php",
  "steps": [
    {
      "step": "login",
      "username": "admin",
      "password": "password"
    }
  ]
}
```
bgrgicak pushed a commit that referenced this pull request Jun 20, 2024
…-sink extension bundle. (#1504)

Fixes #1494 

In #1048 I introduced a regression of #819, in that `wp_http_supports( [
'ssl' ] )` no longer returned truthful without the kitchen-sink
extension bundle loaded.

This partially reverts #1048 by keeping the filters for Requests, but
reinstating the deprecated WP_HTTP filters.

It's worth noting, that this is not a direct revert, as it forces the
Fetch/Dummy handlers instead of simply adding them as an option. This is
to match the Requests filter behaviour.

To test this, the following blueprint should land you on a plugin
install page without any errors visible:

https://playground.wordpress.net/#{%22phpExtensionBundles%22:[%22light%22],%22features%22:{%22networking%22:true},%22landingPage%22:%22/wp-admin/plugin-install.php%22,%22steps%22:[{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22}]}
```
{
  "phpExtensionBundles": [
    "light"
  ],
  "features": {
    "networking": true
  },
  "landingPage": "/wp-admin/plugin-install.php",
  "steps": [
    {
      "step": "login",
      "username": "admin",
      "password": "password"
    }
  ]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Networking [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Network access error stream_socket_client() ssl://... Host is unreachable
2 participants