File tree 2 files changed +33
-3
lines changed
src/Symfony/Component/HttpKernel
2 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -325,10 +325,13 @@ private function getMetadata($key)
325
325
*/
326
326
public function purge ($ url )
327
327
{
328
- $ http = preg_replace ('#^https# ' , 'http ' , $ url );
329
- $ https = preg_replace ('#^http# ' , 'https ' , $ url );
328
+ $ http = preg_replace ('#^https: # ' , 'http: ' , $ url );
329
+ $ https = preg_replace ('#^http: # ' , 'https: ' , $ url );
330
330
331
- return $ this ->doPurge ($ http ) || $ this ->doPurge ($ https );
331
+ $ purgedHttp = $ this ->doPurge ($ http );
332
+ $ purgedHttps = $ this ->doPurge ($ https );
333
+
334
+ return $ purgedHttp || $ purgedHttps ;
332
335
}
333
336
334
337
/**
Original file line number Diff line number Diff line change @@ -236,6 +236,33 @@ public function testLocking()
236
236
$ this ->assertFalse ($ this ->store ->isLocked ($ req ));
237
237
}
238
238
239
+ public function testPurgeHttps ()
240
+ {
241
+ $ request = Request::create ('https://example.com/foo ' );
242
+ $ this ->store ->write ($ request , new Response ('foo ' ));
243
+
244
+ $ this ->assertNotEmpty ($ this ->getStoreMetadata ($ request ));
245
+
246
+ $ this ->assertTrue ($ this ->store ->purge ('https://example.com/foo ' ));
247
+ $ this ->assertEmpty ($ this ->getStoreMetadata ($ request ));
248
+ }
249
+
250
+ public function testPurgeHttpAndHttps ()
251
+ {
252
+ $ requestHttp = Request::create ('https://example.com/foo ' );
253
+ $ this ->store ->write ($ requestHttp , new Response ('foo ' ));
254
+
255
+ $ requestHttps = Request::create ('http://example.com/foo ' );
256
+ $ this ->store ->write ($ requestHttps , new Response ('foo ' ));
257
+
258
+ $ this ->assertNotEmpty ($ this ->getStoreMetadata ($ requestHttp ));
259
+ $ this ->assertNotEmpty ($ this ->getStoreMetadata ($ requestHttps ));
260
+
261
+ $ this ->assertTrue ($ this ->store ->purge ('http://example.com/foo ' ));
262
+ $ this ->assertEmpty ($ this ->getStoreMetadata ($ requestHttp ));
263
+ $ this ->assertEmpty ($ this ->getStoreMetadata ($ requestHttps ));
264
+ }
265
+
239
266
protected function storeSimpleEntry ($ path = null , $ headers = array ())
240
267
{
241
268
if (null === $ path ) {
You can’t perform that action at this time.
0 commit comments