From 539e8fb6df0a47661625947c30a5cbe3eabcc442 Mon Sep 17 00:00:00 2001 From: Ryan Cox Date: Mon, 17 Jun 2024 12:04:01 -0600 Subject: [PATCH] Correct formatting for 'X-Forwarded-For' --- src/NativeSender.php | 4 ++-- tests/XForwardedForTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NativeSender.php b/src/NativeSender.php index fe1f2d0..9d1c143 100644 --- a/src/NativeSender.php +++ b/src/NativeSender.php @@ -83,8 +83,8 @@ private function buildRequest(Request $smartyRequest) if ($smartyRequest->getReferer() != null) curl_setopt($ch, CURLOPT_REFERER, $smartyRequest->getReferer()); if ($this->ip != null) { - curl_setopt($ch, CURLOPT_HTTPHEADER, array("X_FORWARDED_FOR: $this->ip")); - $smartyRequest->setHeader('X_FORWARDED_FOR', $this->ip); + curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Forwarded-For: $this->ip")); + $smartyRequest->setHeader('X-Forwarded-For', $this->ip); } return $ch; diff --git a/tests/XForwardedForTest.php b/tests/XForwardedForTest.php index 8b4c0e4..39b6ced 100644 --- a/tests/XForwardedForTest.php +++ b/tests/XForwardedForTest.php @@ -23,7 +23,7 @@ public function testNativeSetOnQuery() { $sender->send($request); - $this->assertEquals("0.0.0.0", $request->getHeaders()["X_FORWARDED_FOR"]); + $this->assertEquals("0.0.0.0", $request->getHeaders()["X-Forwarded-For"]); } public function testNativeNotSet() { @@ -34,6 +34,6 @@ public function testNativeNotSet() { $sender->send($request); $headers = $request->getHeaders(); - $this->assertEquals(false, array_key_exists("X_FORWARDED_FOR", $headers)); + $this->assertEquals(false, array_key_exists("X-Forwarded-For", $headers)); } } \ No newline at end of file