Add guzzle as depencency and deprecate HttpRequest
Updated by Christian Kuhn over 5 years ago
First: I want guzzle, too!
But imho, this area needs a full re-work and this patch does not go far enough.Situation:
At the moment we have 4 (!) ways to fetch remote content:
- getUrl with curl
- getUrl with fsock
- getUrl with file_get_contents
- http2 with a slim core "fassade" that is extending http2.
Additionally we have a series of configuration options that are half deprecated within typo3_conf_vars. Furthermore getUrl() is also able to retrieve local files.Technical debts:
- getUrl: fetching local files and getting remote content are 2 different things, getUrl hides that, but imho a controller should know and steer this. so hiding these 2 concerns is not a good idea. core could help with a helper to find out if a given string is a local page number, a local file or an external ressource, maybe more. So in general i'd like to have getUrl() deprecated!
- http2: the "fassade" still exposes all http2 details while it should probably hide for instance the configuration setters to consumers.
- current pending patch with guzzle creates a direct dependency from a controller to guzzle without a fassade. there is not even a way to transfer configuration options from core to initialize guzzle options.
- there is no sane default configuration / detection done.
If we start fixing this mess with guzzle, I'd require to have some core support that fixes all of the above stuff and does not just add something. I want the technical debt to be solved once and for all, in detail:
- Have a stable API to fetch remote content that does not change if we substitute the implementation with something else.
- Have a proper detection of settings within install tool.
- Do not expose the whole guzzle API to the outside but only things that make sense for consumers, and clearly state what is not exposed. Goal is here to have a package in the core that is properly pre-configured. If extensions need more, they still may use guzzle directly, but then they're on their own.
- Separate remote fetching from local ressources, help extensions to find out which type of a resource they are handling so they can steer further stuff.
- Get rid of getUrl()
In general I'd like to finally have a proper modeling for this stuff in the core and a solution path of things that need to be done instead of cowboy hacking guzzle into the system now. The above are just some ideas, I'd love to have some feedback / more detailed discussion and will help with finding a solution path if someone wants to do something like that.