X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_functions.c;h=5cb8a16a400c5cb5d3590c6171b838ed4e56243b;hb=d80f60f27726617061ff6b5581de02cd71b86492;hp=90350e2d23dec09c880fec6048522a0200ba5806;hpb=376bdc3230e8f6d2b8f167d4534e1dc8d0e0fc68;p=m6w6%2Fext-http diff --git a/http_functions.c b/http_functions.c index 90350e2..5cb8a16 100644 --- a/http_functions.c +++ b/http_functions.c @@ -79,7 +79,7 @@ PHP_FUNCTION(http_date) * If a port is pecified in either the url or as sperate parameter, * it will be added if it differs from te default port for HTTP(S). * - * Returns the absolute URI as string. + * Returns the absolute URI as string on success or false on failure. * * Examples: *
@@ -90,7 +90,7 @@ PHP_FUNCTION(http_date)
  */
 PHP_FUNCTION(http_build_uri)
 {
-	char *url = NULL, *proto = NULL, *host = NULL;
+	char *url = NULL, *proto = NULL, *host = NULL, *built = NULL;
 	int url_len = 0, proto_len = 0, host_len = 0;
 	long port = 0;
 
@@ -98,7 +98,10 @@ PHP_FUNCTION(http_build_uri)
 		RETURN_FALSE;
 	}
 
-	RETURN_STRING(http_absolute_uri_ex(url, url_len, proto, proto_len, host, host_len, port), 0);
+	if ((built = http_absolute_uri_ex(url, url_len, proto, proto_len, host, host_len, port))) {
+		RETURN_STRING(built, 0);
+	}
+	RETURN_FALSE;
 }
 /* }}} */
 
@@ -985,6 +988,7 @@ PHP_FUNCTION(http_match_request_header)
 			if (msg) { \
 				RETVAL_STRINGL(PHPSTR_VAL(&msg->body), PHPSTR_LEN(&msg->body), 1); \
 				http_message_free(&msg); \
+				phpstr_dtor(&response); \
 				return; \
 			} \
 		} else { \