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

[HttpClient] Fix Copy as curl with base uri #46665

Merged
merged 1 commit into from
Jun 19, 2022

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Jun 13, 2022

Q A
Branch? 6.1
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #46583 (comment)
License MIT
Doc PR -

Fixes Copy as curl when base_uri is used.

$url = self::mergeQueryString($trace['url'], $trace['options']['query'] ?? [], true);
$url = implode('', self::resolveUrl(
self::parseUrl($trace['url'], $trace['options']['query'] ?? []),
isset($trace['options']['base_uri']) ? self::parseUrl($trace['options']['base_uri']) : null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should parse $debug instead because options won't always contain the base_uri, when default options are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas The problem is that $debug doesn't contain information about which protocol was used in the request, we would still need to get that from $trace['uri'] or $trace['options']['base_uri'] if the former is relative. I'll look into it some more just to be sure I didn't miss anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HypeMC HypeMC force-pushed the copy-as-curl-with-base-uri branch 3 times, most recently from b5c272e to 84fc01e Compare June 18, 2022 22:46
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I went with an updated implementation that leverages an original_url info)

@nicolas-grekas
Copy link
Member

Thank you @HypeMC.

@nicolas-grekas nicolas-grekas merged commit 6b44dc6 into symfony:6.1 Jun 19, 2022
@HypeMC HypeMC deleted the copy-as-curl-with-base-uri branch June 19, 2022 22:02
@fabpot fabpot mentioned this pull request Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants