WordPress / wordpress-playground

Run WordPress in the browser via WebAssembly PHP
https://w.org/playground/
GNU General Public License v2.0
1.64k stars 257 forks source link

PHP Node: wp_remote_get fails with some URLs with "fsocket timed out" error #1247

Open MocioF opened 6 months ago

MocioF commented 6 months ago

To track this issue, please try this plugins https://github.com/MocioF/test-wp-playground. To test it with wp-now:

$ git clone https://github.com/MocioF/test-wp-playground.git
$ cd test-wp-playground
$ npx @wp-now/wp-now start --reset --blueprint=./assets/blueprints/blueprint.json

With these URLs: https://github.com/MocioF/test-wp-playground/blob/b3677dc27ca54db4599fb7bcbf6889463f1c6807/test-wp-playground.php#L42-L43 wp_remote_get works on a standard WordPress installation, but fails when you run it on playground.

adamziel commented 6 months ago

Thanks! Added to the project board for triaging.

adamziel commented 5 months ago

@MocioF these scripts are not shipped with Playground – we're running a minified WordPress build with define( "CONCATENATE_SCRIPTS", false ); to reduce the initial download size. The web browser downloads them from the physical server where Playground is running, not from the wasm filesystem. Does your plugin rely on such a wp_remote_get call to load-scripts.php? What's the use-case?

MocioF commented 5 months ago

Hi @adamziel, my plugin uses wp_remote_get to download external scripts it finds when it parses the DOM, to calculate their sha hashes.

adamziel commented 5 months ago

@MocioF Aha, thank you for explaining! Is it a caching plugin?

MocioF commented 5 months ago

No, it is used to create a strict CSP. So it doesn't cache files, but stores url and hashes