Created attachment 234771 [details] usr.bin/fetch: Show correct port number in -vv output The code in libfetch only sets the port number in `-vv` output when there's a `:` before the path component. This patch sets the port number based on the URL scheme. Old behavior: ``` % fetch -vv https://www.freebsd.org/ scheme: "https" user: "" password: "" host: "www.freebsd.org" port: "0" document: "/" ---> www.freebsd.org:443 ``` New behavior: ``` % fetch -vv https://www.freebsd.org/ scheme: "https" user: "" password: "" host: "www.freebsd.org" port: "443" document: "/" ---> www.freebsd.org:443 ```
I tried this, and it does work for HTTP and HTTPS URls. But fetch supports other protocols, so a fix for this should work no matter which scheme you use. ftp for example would not be covered by this.
Created attachment 252969 [details] usr.bin/fetch: Show correct port number in -vv output PATCH v2
des probably has more of an opinion on this than I would
I disagree. It's not the URL parser's place to decide default ports. And as your own example shows, `fetch -vv` correctly displays the port it connects to regardless.