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

[HttpKernel] Remove _path from query parameters when fragment is a subrequest #17595

Merged
merged 1 commit into from Mar 3, 2016

Conversation

Projects
None yet
5 participants
@cmenning
Copy link
Contributor

commented Jan 28, 2016

Q A
Bug fix? Yes
New feature? No
BC breaks? No
Deprecations? No
Tests pass? Yes
Fixed tickets
License MIT
Doc PR

Prior to 2.3.29, all requests to the ESI fragment path ("/_fragment" by default) would have the "_path" query parameter removed. This held true whether an external proxy (such as Varnish) handled the request as true ESI, or whether the Symfony kernel was mocking ESI behavior and inlining the subrequest.

Once the "_controller" check was added in 2.3.29, the "_path" query parameter was only removed on master requests (such as those coming from an external proxy) and not subrequests, leading to differing behavior in production and development settings.

@stof

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

We need a test reproducing this.

@stof

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

And this seems the wrong fix IMO. the right fix would be to avoid generating _path in the query string when setting a controller directly

@cmenning

This comment has been minimized.

Copy link
Contributor Author

commented Jan 28, 2016

The alternative would be patching \Symfony\Component\HttpKernel\Fragment\RoutableFragmentRenderer::generateFragmentUri to not append the "_path" to the generated URI, but I'm not sure what other impact that would have downstream when handling the subrequest.

@cmenning

This comment has been minimized.

Copy link
Contributor Author

commented Jan 28, 2016

The more I look at it, the more I think this is the appropriate fix. "_path" is in the query string specifically for the FragmentListener to parse; once it's been parsed, it's removed from the ParameterBag.

It makes sense to remove it when finished with the listener, whether we use it or not, in order to keep behavior consistent.

Suppressing "_path" during generation has a higher likelihood of side effects, and would make the generation code more complex: generateFragmentUri() then has to know whether the URI is intended to be consumed by a genuine ESI/Hinclude request, or whether it's being inlined.

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 2, 2016

@cmenning Will you be able to add a test?

@cmenning cmenning force-pushed the novatex:fragment-path branch from 3fc89bc to 25965d1 Mar 2, 2016

@cmenning

This comment has been minimized.

Copy link
Contributor Author

commented Mar 2, 2016

@fabpot Tests added.

@cmenning cmenning force-pushed the novatex:fragment-path branch from 25965d1 to 545c822 Mar 2, 2016

Remove _path from query parameters when fragment is a subrequest and …
…request attributes are already set

Added tests for _path removal in FragmentListener

@cmenning cmenning force-pushed the novatex:fragment-path branch from 545c822 to c374420 Mar 2, 2016

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 2, 2016

👍

@stof

This comment has been minimized.

Copy link
Member

commented Mar 3, 2016

👍

Status: reviewed

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 3, 2016

Thank you @cmenning.

@fabpot fabpot merged commit c374420 into symfony:2.3 Mar 3, 2016

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 Mar 3, 2016

bug #17595 [HttpKernel] Remove _path from query parameters when fragm…
…ent is a subrequest (cmenning)

This PR was merged into the 2.3 branch.

Discussion
----------

[HttpKernel] Remove _path from query parameters when fragment is a subrequest

| Q             | A
| ------------- | ---
| Bug fix?      | Yes
| New feature?  | No
| BC breaks?    | No
| Deprecations? | No
| Tests pass?   | Yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Prior to 2.3.29, all requests to the ESI fragment path ("/_fragment" by default) would have the "_path" query parameter removed. This held true whether an external proxy (such as Varnish) handled the request as true ESI, or whether the Symfony kernel was mocking ESI behavior and inlining the subrequest.

Once the "_controller" check was added in 2.3.29, the "_path" query parameter was only removed on master requests (such as those coming from an external proxy) and not subrequests, leading to differing behavior in production and development settings.

Commits
-------

c374420 Remove _path from query parameters when fragment is a subrequest and request attributes are already set Added tests for _path removal in FragmentListener

@cmenning cmenning deleted the novatex:fragment-path branch Mar 3, 2016

@fabpot fabpot referenced this pull request Mar 13, 2016

Merged

Release v2.3.39 #18153

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.