Skip to content

Commit e418d7c

Browse files
committed
trurl: the set port is the same as the scheme-default, don't show
Added two test cases Fixes curl#79 Closes curl#83
1 parent 6b01184 commit e418d7c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test.pl

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"--set host=example.com --set scheme=ftp|ftp://example.com/",
2525
"--url https://curl.se/we/are.html --redirect here.html|https://curl.se/we/here.html",
2626
"--url https://curl.se/we/../are.html --set port=8080|https://curl.se:8080/are.html",
27+
"https://curl.se:22/ -s port=443|https://curl.se/",
28+
"https://curl.se:22/ -s port=443 --get {url}|https://curl.se/",
2729
"--url https://curl.se/we/are.html --get \"{path}\"|/we/are.html",
2830
"--url https://curl.se/we/are.html --get \"{port}\"|443",
2931
"--url https://curl.se/we/are.html --get \"{scheme}\"|https",

trurl.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,9 @@ static void get(struct option *op, CURLU *uh)
356356
!strncasecmp(ptr, variables[i].name, vlen)) {
357357
char *nurl;
358358
CURLUcode rc;
359-
rc = curl_url_get(uh, variables[i].part, &nurl, CURLU_DEFAULT_PORT|
359+
rc = curl_url_get(uh, variables[i].part, &nurl,
360+
CURLU_DEFAULT_PORT|
361+
CURLU_NO_DEFAULT_PORT|
360362
(urldecode?CURLU_URLDECODE:0));
361363
switch(rc) {
362364
case CURLUE_OK:
@@ -669,7 +671,7 @@ static void singleurl(struct option *o,
669671
else {
670672
/* default output is full URL */
671673
char *nurl = NULL;
672-
if(!curl_url_get(uh, CURLUPART_URL, &nurl, 0)) {
674+
if(!curl_url_get(uh, CURLUPART_URL, &nurl, CURLU_NO_DEFAULT_PORT)) {
673675
printf("%s\n", nurl);
674676
curl_free(nurl);
675677
}

0 commit comments

Comments
 (0)