On Wed, Nov 09, 2022 at 08:51:21AM -0700, Todd C. Miller wrote:
> On Wed, 09 Nov 2022 15:46:06 +0000, Florian Obser wrote:
>
> > 200 might be a bit short for an URL, no?
>
> Perhaps stravis(3) is a better choice then?
>
Like this?
--
:wq Claudio
Index: fetch.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.211
diff -u -p -r1.211 fetch.c
--- fetch.c 9 Nov 2022 16:29:58 -0000 1.211
+++ fetch.c 9 Nov 2022 16:33:01 -0000
@@ -950,8 +950,13 @@ noslash:
loctail = strchr(redirurl, '#');
if (loctail != NULL)
*loctail = '\0';
- if (verbose)
- fprintf(ttyout, "Redirected to %s\n", redirurl);
+ if (verbose) {
+ char *visbuf;
+ if (stravis(&visbuf, redirurl, VIS_SAFE) == -1)
+ err(1, "Cannot vis redirect URL");
+ fprintf(ttyout, "Redirected to %s\n", visbuf);
+ free(visbuf);
+ }
ftp_close(&fin, &tls, &fd);
rval = url_get(redirurl, proxyenv, savefile, lastfile);
free(redirurl);