Skip to content
Browse files

removed deprected way to declared trusted proxies

  • Loading branch information...
1 parent 5ff6006 commit c28f1b0926d0b7713c1645607ad3822af89ea95d @fabpot fabpot committed Mar 1, 2013
View
1 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -56,7 +56,6 @@ public function getConfigTreeBuilder()
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests.")
->defaultTrue()
->end()
- ->scalarNode('trust_proxy_headers')->defaultFalse()->end() // @deprecated, to be removed in 2.3
->arrayNode('trusted_proxies')
->beforeNormalization()
->ifTrue(function($v) { return !is_array($v) && !is_null($v); })
View
4 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -69,10 +69,6 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('kernel.http_method_override', $config['http_method_override']);
$container->setParameter('kernel.trusted_proxies', $config['trusted_proxies']);
-
- // @deprecated, to be removed in 2.3
- $container->setParameter('kernel.trust_proxy_headers', $config['trust_proxy_headers']);
-
$container->setParameter('kernel.default_locale', $config['default_locale']);
if (!empty($config['test'])) {
View
2 src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
@@ -43,8 +43,6 @@ public function boot()
{
if ($trustedProxies = $this->container->getParameter('kernel.trusted_proxies')) {
Request::setTrustedProxies($trustedProxies);
- } elseif ($this->container->getParameter('kernel.trust_proxy_headers')) {
- Request::trustProxyData(); // @deprecated, to be removed in 2.3
}
if ($this->container->getParameter('kernel.http_method_override')) {
View
1 src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
@@ -25,7 +25,6 @@
<!-- charset is deprecated and will be removed in 2.2 -->
<xsd:attribute name="charset" type="xsd:string" />
<xsd:attribute name="http-method-override" type="xsd:boolean" />
- <xsd:attribute name="trust-proxy-headers" type="xsd:string" />
<xsd:attribute name="trusted-proxies" type="xsd:string" />
<xsd:attribute name="ide" type="xsd:string" />
<xsd:attribute name="secret" type="xsd:string" />
View
2 src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
@@ -6,7 +6,7 @@
<parameters>
<parameter key="event_dispatcher.class">Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher</parameter>
- <parameter key="http_kernel.class">Symfony\Bundle\FrameworkBundle\HttpKernel</parameter>
+ <parameter key="http_kernel.class">Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel</parameter>
<parameter key="filesystem.class">Symfony\Component\Filesystem\Filesystem</parameter>
<parameter key="cache_warmer.class">Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate</parameter>
<parameter key="cache_clearer.class">Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer</parameter>
View
1 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -89,7 +89,6 @@ protected static function getBundleDefaultConfig()
return array(
'charset' => null,
'http_method_override' => true,
- 'trust_proxy_headers' => false,
'trusted_proxies' => array(),
'ide' => null,
'default_locale' => 'en',
View
1 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
@@ -5,7 +5,6 @@
'default_locale' => 'fr',
'form' => null,
'http_method_override' => false,
- 'trust_proxy_headers' => true,
'trusted_proxies' => array('127.0.0.1', '10.0.0.1'),
'csrf_protection' => array(
'enabled' => true,
View
2 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
@@ -6,7 +6,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
- <framework:config secret="s3cr3t" ide="file%%link%%format" default-locale="fr" trust-proxy-headers="true" trusted-proxies="127.0.0.1, 10.0.0.1" http-method-override="false">
+ <framework:config secret="s3cr3t" ide="file%%link%%format" default-locale="fr" trusted-proxies="127.0.0.1, 10.0.0.1" http-method-override="false">
<framework:csrf-protection enabled="true" field-name="_csrf" />
<framework:form />
<framework:esi enabled="true" />
View
1 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
@@ -3,7 +3,6 @@ framework:
default_locale: fr
form: ~
http_method_override: false
- trust_proxy_headers: true
trusted_proxies: ['127.0.0.1', '10.0.0.1']
csrf_protection:
enabled: true
View
1 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -37,7 +37,6 @@ public function testProxies()
{
$container = $this->createContainerFromFile('full');
- $this->assertTrue($container->getParameter('kernel.trust_proxy_headers'));
$this->assertEquals(array('127.0.0.1', '10.0.0.1'), $container->getParameter('kernel.trusted_proxies'));
}
View
25 src/Symfony/Component/HttpFoundation/Request.php
@@ -465,18 +465,6 @@ public function overrideGlobals()
}
/**
- * Trusts $_SERVER entries coming from proxies.
- *
- * @deprecated Deprecated since version 2.0, to be removed in 2.3. Use setTrustedProxies instead.
- */
- public static function trustProxyData()
- {
- trigger_error('trustProxyData() is deprecated since version 2.0 and will be removed in 2.3. Use setTrustedProxies() instead.', E_USER_DEPRECATED);
-
- self::$trustProxy = true;
- }
-
- /**
* Sets a list of trusted proxies.
*
* You should only list the reverse proxies that you manage directly.
@@ -528,19 +516,6 @@ public static function setTrustedHeaderName($key, $value)
}
/**
- * Returns true if $_SERVER entries coming from proxies are trusted,
- * false otherwise.
- *
- * @return boolean
- *
- * @deprecated Deprecated since version 2.2, to be removed in 2.3. Use getTrustedProxies instead.
- */
- public static function isProxyTrusted()
- {
- return self::$trustProxy;
- }
-
- /**
* Normalizes a query string.
*
* It builds a normalized query string, where keys/value pairs are alphabetized,
View
24 src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -764,12 +764,7 @@ public function testGetClientIp($expected, $proxy, $remoteAddr, $httpForwardedFo
}
$request->initialize(array(), array(), array(), array(), array(), $server);
- if ($proxy) {
- set_error_handler(array($this, "deprecationErrorHandler"));
- $this->startTrustingProxyData();
- restore_error_handler();
- }
- $this->assertEquals($expected, $request->getClientIp($proxy));
+ $this->assertEquals($expected, $request->getClientIp());
Request::setTrustedProxies(array());
}
@@ -884,8 +879,6 @@ public function testCreateFromGlobals($method)
public function testOverrideGlobals()
{
- set_error_handler(array($this, "deprecationErrorHandler"));
-
$request = new Request();
$request->initialize(array('foo' => 'bar'));
@@ -903,7 +896,6 @@ public function testOverrideGlobals()
$this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
- $this->startTrustingProxyData();
$request->headers->set('X_FORWARDED_PROTO', 'https');
Request::setTrustedProxies(array('1.1.1.1'));
@@ -1208,11 +1200,6 @@ public function testIsMethod()
$this->assertFalse($request->isMethod('post'));
}
- private function startTrustingProxyData()
- {
- Request::trustProxyData();
- }
-
/**
* @dataProvider getBaseUrlData
*/
@@ -1342,15 +1329,6 @@ public function testTrustedProxies()
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
- // trusted proxy via deprecated trustProxyData()
- set_error_handler(array($this, "deprecationErrorHandler"));
- Request::trustProxyData();
- $this->assertEquals('2.2.2.2', $request->getClientIp());
- $this->assertEquals('real.example.com', $request->getHost());
- $this->assertEquals(443, $request->getPort());
- $this->assertTrue($request->isSecure());
- restore_error_handler();
-
// disabling proxy trusting
Request::setTrustedProxies(array());
$this->assertEquals('3.3.3.3', $request->getClientIp());

0 comments on commit c28f1b0

Please sign in to comment.
Something went wrong with that request. Please try again.