From 82791aa32ee6421d05467b799ae756c30ca4c59c Mon Sep 17 00:00:00 2001 From: Nijiko Yonskai Date: Thu, 16 May 2013 15:05:06 -0600 Subject: [PATCH] Support port colon, fixes #8 :) --- lib/Unirest/Unirest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php index db59943..5b12841 100644 --- a/lib/Unirest/Unirest.php +++ b/lib/Unirest/Unirest.php @@ -133,6 +133,10 @@ class Unirest // Encode and build query based on RFC 1738 $query = '?'.http_build_query($query_parsed); } + + // Handle port seperator + if ($port && $port[0] != ":") + $port = ":" . $port; // Return the completed URL $result = $scheme . $host . $port . $path . $query; @@ -182,4 +186,4 @@ function is_hex($hex) { if (empty($hex)) { $hex = 0; }; $dec = hexdec($hex); return ($hex == dechex($dec)); -} \ No newline at end of file +}