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

[Routing] fix absolute url generation when scheme is not known #32000

Merged
merged 1 commit into from Jun 13, 2019

Conversation

Projects
None yet
4 participants
@Tobion
Copy link
Member

commented Jun 12, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #25491
License MIT
Doc PR

This fixes two edge cases in the url generator:

  1. when the context scheme is not known (empty) generating an absolute url would return an invalid url starting with ://host/path. #25491 handled the case when the host is unknown which makes sense. but the way it was done, created this new problem.
  2. non-http(s) urls do not require a host. e.g. typical file:///path urls. url generator is fixed to be in line with rfc3986
}
public function testDefaultHostIsUsedWhenContextHostIsEmptyAndSchemeIsNot()

This comment has been minimized.

Copy link
@Tobion

Tobion Jun 12, 2019

Author Member

that test was the same as the one above because a RequestContext has a default scheme. I changed it slightly to handle a different case.

@Tobion Tobion force-pushed the Tobion:url-generator-wihout-scheme branch from 4fc4817 to 8e04222 Jun 12, 2019

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Jun 12, 2019

@fabpot

fabpot approved these changes Jun 13, 2019

@fabpot

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

Thank you @Tobion.

@fabpot fabpot merged commit 8e04222 into symfony:3.4 Jun 13, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Jun 13, 2019

bug #32000 [Routing] fix absolute url generation when scheme is not k…
…nown (Tobion)

This PR was merged into the 3.4 branch.

Discussion
----------

[Routing] fix absolute url generation when scheme is not known

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #25491
| License       | MIT
| Doc PR        |

This fixes two edge cases in the url generator:
1. when the context scheme is not known (empty) generating an absolute url would return an invalid url starting with `://host/path`. #25491 handled the case when the host is unknown which makes sense. but the way it was done, created this new problem.
2. non-http(s) urls do not require a host. e.g. typical `file:///path` urls. url generator is fixed to be in line with rfc3986

Commits
-------

8e04222 [Routing] fix absolute url generation when scheme is not known

@Tobion Tobion deleted the Tobion:url-generator-wihout-scheme branch Jun 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.