Created
November 1, 2013 00:04
-
-
Save DASPRiD/7259196 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 81d9e159d2bd5bffbf573a9c502e96be9df9311a Mon Sep 17 00:00:00 2001 | |
From: Ben Scholzen <[email protected]> | |
Date: Fri, 1 Nov 2013 01:03:12 +0100 | |
Subject: [PATCH] Add chunk decoding (hard-coded for now, should be | |
header-dependent) | |
--- | |
src/Sslurp/MozillaCertData.php | 18 +++++++++++++++++- | |
1 file changed, 17 insertions(+), 1 deletion(-) | |
diff --git a/src/Sslurp/MozillaCertData.php b/src/Sslurp/MozillaCertData.php | |
index a297a43..b9053c7 100644 | |
--- a/src/Sslurp/MozillaCertData.php | |
+++ b/src/Sslurp/MozillaCertData.php | |
@@ -123,7 +123,23 @@ class MozillaCertData extends AbstractCaRootData | |
'file an issue at https://github.com/EvanDotPro/Sslurp/issues'); | |
} | |
- return $this->getResponseBody($response); | |
+ return $this->decodeChunkedString($this->getResponseBody($response)); | |
+ } | |
+ | |
+ protected function decodeChunkedString($string) | |
+ { | |
+ $result = ''; | |
+ $currentPos = 0; | |
+ $stringLength = strlen($string); | |
+ | |
+ while ($currentPos < $stringLength) { | |
+ $position = strpos($string, "\r\n", $currentPos); | |
+ $length = hexdec(substr($string, $currentPos, $position - $currentPos)); | |
+ $result .= substr($string, $position + 2, $length); | |
+ $currentPos = $position + 2; | |
+ } | |
+ | |
+ return $result; | |
} | |
protected function getResponseBody($string) | |
-- | |
1.7.9.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment