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

[WebProfilerBundle] Improved cookie traffic #20567

Merged
merged 1 commit into from Mar 22, 2017
Merged

[WebProfilerBundle] Improved cookie traffic #20567

merged 1 commit into from Mar 22, 2017

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Nov 19, 2016

Q A
Branch? "master"
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets comma-separated list of tickets fixed by the PR, if any
License MIT
Doc PR reference to the documentation PR, if any

image

Relates to #20569 in terms of getting all the cookies.

@ogizanagi
Copy link
Member

Shouldn't the header bag part (the bug fix) be in a separated PR targeting older branches ?

@ro0NL
Copy link
Contributor Author

ro0NL commented Nov 19, 2016

And of course this is one of those files that is different in all branches (bag.html.twig), making it hard to merge this approach upstream (as we would need to modify headerbag.html.twig as well)...

Ie. the bug is fixed by a new feature :)


{% block body %}
{% for key in bag.keys|sort %}
{% for value in bag.get(key, [], false) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

On the request panel, what about keeping one line by header but exposing the value as an array if needed instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Considered it :) however what i like about this, it shows headers more or less the same as the HTTP message itself.

This goes for all HeaderBag's btw, as we cannot call bag.get(key, [], false) on a ParamaterBag (hence the new template file).

@nicolas-grekas
Copy link
Member

Displaying multiple HTTP headers should be fixed in #20595.

@ro0NL
Copy link
Contributor Author

ro0NL commented Nov 22, 2016

Do you think the cookie panel is viable? I tend to like it (cookies shown as data objects that is).

I can update the PR to only include that.. so multiple header fixes goes with #20595 ?

@ro0NL ro0NL changed the title [WebProfilerBundle] Display multiple HTTP headers + improved cookie traffic [WebProfilerBundle] Improved cookie traffic Nov 22, 2016
@nicolas-grekas nicolas-grekas added this to the 3.x milestone Dec 6, 2016
$cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
}
if (count($cookies) > 0) {
$responseHeaders['Set-Cookie'] = $cookies;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabpot now #20569 is merged, we should not forget to update this.. i kinda did ;-) and it will cause duplicate headers i guess.

Copy link
Contributor Author

@ro0NL ro0NL Dec 18, 2016

Choose a reason for hiding this comment

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

And perhaps fixup 2.7 first with #20599

fabpot added a commit that referenced this pull request Dec 22, 2016
This PR was merged into the 3.3-dev branch.

Discussion
----------

[HttpKernel] Continuation of #20569

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20567 (comment)
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Forgotten in #20569 and makes #20567 truly a feature only.

Before

![image](https://cloud.githubusercontent.com/assets/1047696/21361738/971e4f8e-c6e5-11e6-8b08-8a5f8ab4f1f0.png)

After

![image](https://cloud.githubusercontent.com/assets/1047696/21361752/a6dc5380-c6e5-11e6-9f18-3bc3d7db94be.png)

Commits
-------

e1616b3 [HttpKernel] Continuation of #20569
@ro0NL
Copy link
Contributor Author

ro0NL commented Dec 22, 2016

@javiereguiluz now all the cookie hassle is fixed.. WDYT? (bug label can be removed)

@fabpot
Copy link
Member

fabpot commented Mar 1, 2017

@javiereguiluz Can you review this PR? Is it ok for you?

@javiereguiluz javiereguiluz self-assigned this Mar 1, 2017
@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

@ro0NL Can this one be merged?

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 22, 2017

@fabpot for me yes :) rebased and updated. Waiting for travis.

@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

@ro0NL Apparently, that breaks the tests.

<h3 class="tab-title">Cookies</h3>

<div class="tab-content">
<h3>Cookies Received</h3>
Copy link
Member

Choose a reason for hiding this comment

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

Just asking: would the following changes make this easier to understand?

Instead of Cookies Received -> Request Cookies and
instead of Cookies Created -> Response Cookies

Copy link
Contributor Author

@ro0NL ro0NL Mar 22, 2017

Choose a reason for hiding this comment

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

No strong opinion.. i think i've tried to avoid those terms because of the Request | Response tabs already on the left (which also shows the cookies as raw headers). This is more the makeup version :)

But maybe you're right...

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 @javiereguiluz is right.

Copy link
Member

Choose a reason for hiding this comment

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

The problem is that if I read "Cookies Received" I may wonder: "received by my server" (request cookies) or "received by the user [from our server]" (response cookies)

And the same for "Cookies Created" -> "created by the user and sent to us" ... "or created by the server and sent to the client" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated :)

@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 22, 2017

Yeah im looking at it. Problem is asserting collected response cookies, due the var cloning thingy. It now happens at root level (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php#L145) making it nearly impossible to mock.

For now i added only an additional instance of assertion, basically what we do for other public methods.

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

👍 I left a minor comment about a possible rewording ... but the rest looks OK to me. Thanks @ro0NL

@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

Thank you @ro0NL.

@fabpot fabpot merged commit 171c6d1 into symfony:master Mar 22, 2017
fabpot added a commit that referenced this pull request Mar 22, 2017
This PR was merged into the 3.3-dev branch.

Discussion
----------

[WebProfilerBundle] Improved cookie traffic

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

![image](https://cloud.githubusercontent.com/assets/1047696/20455635/a033a814-ae60-11e6-8500-e60146f4619e.png)

Relates to #20569 in terms of getting _all_ the cookies.

Commits
-------

171c6d1 [WebProfilerBundle] Improved cookie traffic
@ro0NL ro0NL deleted the wdt/cookies branch March 22, 2017 21:37
@nicolas-grekas nicolas-grekas modified the milestones: 3.x, 3.3 Mar 24, 2017
@nicolas-grekas nicolas-grekas moved this from WIP to DONE in Profiler panels Apr 3, 2017
@fabpot fabpot mentioned this pull request May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants