summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-09-19 10:19:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-09-19 10:19:21 +0200
commitf83d0d32f07b71319f7232e25a599773b89bfb16 (patch)
treed0d6351b1679f564f224aaaabfd6adb4088598b2
parentc0d0ae533b48a028b9561233ecff583a72612ec1 (diff)
downloadcurl-f83d0d32f07b71319f7232e25a599773b89bfb16.tar.gz
urlapi: 'scheme' is always true
-rw-r--r--lib/urlapi.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c
index 7244f4b31..6cec7e4ed 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -1075,24 +1075,23 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what,
else
return CURLUE_NO_SCHEME;
- if(scheme) {
- h = Curl_builtin_scheme(scheme);
- if(!port && (flags & CURLU_DEFAULT_PORT)) {
- /* there's no stored port number, but asked to deliver
- a default one for the scheme */
- if(h) {
- msnprintf(portbuf, sizeof(portbuf), "%ld", h->defport);
- port = portbuf;
- }
- }
- else if(port) {
- /* there is a stored port number, but asked to inhibit if it matches
- the default one for the scheme */
- if(h && (h->defport == u->portnum) &&
- (flags & CURLU_NO_DEFAULT_PORT))
- port = NULL;
+ h = Curl_builtin_scheme(scheme);
+ if(!port && (flags & CURLU_DEFAULT_PORT)) {
+ /* there's no stored port number, but asked to deliver
+ a default one for the scheme */
+ if(h) {
+ msnprintf(portbuf, sizeof(portbuf), "%ld", h->defport);
+ port = portbuf;
}
}
+ else if(port) {
+ /* there is a stored port number, but asked to inhibit if it matches
+ the default one for the scheme */
+ if(h && (h->defport == u->portnum) &&
+ (flags & CURLU_NO_DEFAULT_PORT))
+ port = NULL;
+ }
+
if(h && !(h->flags & PROTOPT_URLOPTIONS))
options = NULL;