Repository navigation
Conversation
The default user agent backported from the CMS was only set by HttpFactory::getHttp(), so a client created with new Http() or a transport from getAvailableDriver() sent none, and the factory wrote the default into the caller's options, modifying an ArrayAccess object in place. Apply the default in Http::makeTransportRequest() when no userAgent option is set, without writing it back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
The default user agent
Mozilla/5.0 Joomla!/Framework, backported from the CMS in ba2a2b9, was applied inHttpFactory::getHttp()only:new Http()(or one using a transport fromgetAvailableDriver()) sent no user agent, or cURL's/PHP's, so the behaviour depended on how the client was built;$optionsit was given. With anArrayAccessobject such as aRegistryorArrayObject, the caller's object was modified in place.Http::makeTransportRequest()now uses theuserAgentoption or, if none is set, the default, without writing it back, and the factory no longer touches the options. Visible difference:(new HttpFactory())->getHttp()->getOption('userAgent')is nownullunless the option was set; the user agent that is sent is the same.The finding also suggests a non-browser user agent such as
Joomla-Framework-Http/4. That was not changed here, because the current string was chosen deliberately in the backport; it is easy to do separately if wanted.Testing Instructions
Tests/HttpUserAgentTest.php(new, mocked transport):new Http()passes the default user agent to the transport (before:null);userAgentis passed;HttpFactory::getHttp()leaves anArrayObjectof options unchanged (before:userAgentwas added).Documentation Changes Required
docs/classes/HttpFactory.md: a paragraph on the default user agent and theuserAgentoption.🤖 Generated with Claude Code