Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] Fixed bug with purging of HTTPS URLs #22079

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

Closed
wants to merge 2 commits into from

Conversation

ausi
Copy link
Contributor

@ausi ausi commented Mar 20, 2017

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

I found two bugs in HttpCache\Store::purge() with HTTPS URLs:

  1. ->purge('https://example.com/') only purges the http version not the https one.
  2. If a cache entry exists for both http and https, only the http version gets purged, the https version stays in the cache.

I think this issues were introduced with #21582.

This pull request fixes both issues and adds tests for them.

@fabpot
Copy link
Member

fabpot commented Mar 20, 2017

LGTM.

$purgedHttp = $this->doPurge($http);
$purgedHttps = $this->doPurge($https);

return $purgedHttp || $purgedHttps;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why changing this? The old version was better IMO as it doesn't execute the second purge if the one is properly done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was the problem. Both versions of the cache entry – http AND https – should get purged. Before this change only the http version was purged.

Copy link
Contributor

@Nek- Nek- Mar 20, 2017

Choose a reason for hiding this comment

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

My bad. I was disturbed by the : change in the regex..

$this->assertTrue($this->store->purge('http://example.com/foo'));
$this->assertEmpty($this->getStoreMetadata($requestHttp));
$this->assertEmpty($this->getStoreMetadata($requestHttps));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I wrong or the non-regression test is missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by non-regression test? I added two tests, one for each bug described in the initial issue comment.

@fabpot
Copy link
Member

fabpot commented Mar 21, 2017

Thank you @ausi.

fabpot added a commit that referenced this pull request Mar 21, 2017
This PR was squashed before being merged into the 2.7 branch (closes #22079).

Discussion
----------

[HttpKernel] Fixed bug with purging of HTTPS URLs

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

I found two bugs in `HttpCache\Store::purge()` with HTTPS URLs:

1. `->purge('https://example.com/')` only purges the `http` version not the `https` one.
2. If a cache entry exists for both `http` and `https`, only the `http` version gets purged, the `https` version stays in the cache.

I think this issues were introduced with #21582.

This pull request fixes both issues and adds tests for them.

Commits
-------

f509150 [HttpKernel] Fixed bug with purging of HTTPS URLs
@fabpot fabpot closed this Mar 21, 2017
This was referenced Apr 4, 2017
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.

4 participants