From: Michael Wallner Date: Mon, 26 Dec 2005 19:44:58 +0000 (+0000) Subject: - avoid NULL urls X-Git-Tag: RELEASE_0_21_0~28 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=8543c31ed65fb9cd3d92a109172d24dcc7acf70a - avoid NULL urls - fix tests --- diff --git a/http_request_api.c b/http_request_api.c index f6ee54e..d96c180 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -222,7 +222,7 @@ PHP_HTTP_API http_request *_http_request_init_ex(http_request *request, CURL *ch memset(r, 0, sizeof(http_request)); r->ch = ch; - r->url = (url && *url) ? estrdup(url) : NULL; + r->url = (url) ? http_absolute_url(url) : NULL; r->meth = (meth > 0) ? meth : HTTP_GET; phpstr_init(&r->conv.request); diff --git a/tests/HttpRequestPool_005.phpt b/tests/HttpRequestPool_005.phpt index 1978267..79c3b0d 100644 --- a/tests/HttpRequestPool_005.phpt +++ b/tests/HttpRequestPool_005.phpt @@ -22,26 +22,11 @@ try { } catch (HttpRequestPoolException $x) { var_dump(count($x->exceptionStack)); } - -try { - $p = new HttpRequestPool(new HttpRequest); -} catch (HttpRequestPoolException $x) { - var_dump(count($x->exceptionStack)); -} - -try { - $p = new HttpRequestPool(new HttpRequest, new HttpRequest); -} catch (HttpRequestPoolException $x) { - var_dump(count($x->exceptionStack)); -} - echo "Done\n"; ?> --EXPECTF-- %sTEST int(2) int(4) -int(1) -int(2) Done diff --git a/tests/exceptions.phpt b/tests/exceptions.phpt index 61a7620..1febe33 100644 --- a/tests/exceptions.phpt +++ b/tests/exceptions.phpt @@ -34,15 +34,6 @@ foreach ($e as $i => $c) { printf("%2d: %s\n", $i, get_class($x)); } } -if (http_support(HTTP_SUPPORT_REQUESTS)) { - try { - $tmp = http_get(null); - } catch (HttpRequestException $x) { - printf("%s (%d)\n", $x->getMessage(), $x->getCode()); - } -} else { - echo "URL using bad/illegal format or missing URL; No URL set!\n ((null)) (8)\n"; -} echo "Done\n"; ?> --EXPECTF-- @@ -59,6 +50,4 @@ echo "Done\n"; 10: HttpSocketException 11: HttpResponseException 12: HttpUrlException -URL using bad/illegal format or missing URL; No URL set! - ((null)) (8) Done diff --git a/tests/ut_HttpUtil.phpt b/tests/ut_HttpUtil.phpt index 3c5f70a..6bf6e2e 100644 --- a/tests/ut_HttpUtil.phpt +++ b/tests/ut_HttpUtil.phpt @@ -100,7 +100,7 @@ class HttpUtilTest extends PHPUnit2_Framework_TestCase function test_zlib() { if ($support = http_support(HTTP_SUPPORT_ENCODINGS)) { - $this->assertEquals(file_get_contents(__FILE__), http_gzdecode(http_gzencode(file_get_contents(__FILE__)))); + $this->assertEquals(file_get_contents(__FILE__), http_inflate(http_deflate(file_get_contents(__FILE__), HTTP_DEFLATE_TYPE_GZIP))); $this->assertEquals(file_get_contents(__FILE__), http_inflate(http_deflate(file_get_contents(__FILE__)))); } else { $this->assertFalse($support);