Skip to content

Instantly share code, notes, and snippets.

@incrize
Created November 15, 2018 10:34
Show Gist options
  • Save incrize/afa73c98348ea82ab3bdb4469e29f371 to your computer and use it in GitHub Desktop.
Save incrize/afa73c98348ea82ab3bdb4469e29f371 to your computer and use it in GitHub Desktop.
1-22726
---
app/Tygh/Http.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/Tygh/Http.php b/app/Tygh/Http.php
index a2e764a2a1..b9e37e8e67 100644
--- a/app/Tygh/Http.php
+++ b/app/Tygh/Http.php
@@ -172,7 +172,7 @@ public static function getHeaders()
public static function getStatus()
{
$headers = self::getHeaders();
- if (preg_match("/HTTP\/\d\.\d (\d+)/", $headers, $m)) {
+ if (preg_match("/HTTP\/\d\.?\d? (\d+)/", $headers, $m)) {
return intval($m[1]);
}
@@ -321,12 +321,14 @@ private static function _getSettings()
/**
* Parse response contents to split headers
+ *
* @param string $content response contents
+ *
* @return string contents without headers
*/
private static function _parseContent($content)
{
- while (strpos(ltrim($content), 'HTTP/1') === 0) {
+ while (strpos(ltrim($content), 'HTTP/') === 0) {
list(self::$_headers, $content) = preg_split("/(\r?\n){2}/", $content, 2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment