Hello tech@,
Given that ftp already deals with HTTP 307, I think we can teach it to
deal with HTTP 308 too. HTTP 308 is to HTTP 301 what HTTP 307 is to HTTP
302: Permanently Moved, but doesn't allow to change the HTTP verb.
Definition of HTTP 308 can be found in RFC 7538.
oolong$ ftp -Mo /dev/null http://h.lgv5.net/c/308
Trying 78.47.117.79...
Requesting http://h.lgv5.net/c/308
ftp: Error retrieving http://h.lgv5.net/c/308: 308 Permanent Redirect
oolong$ ./ftp -Mo /dev/null http://h.lgv5.net/c/308
Trying 78.47.117.79...
Requesting http://h.lgv5.net/c/308
Redirected to http://h.lgv5.net/c/200
Trying 78.47.117.79...
Requesting http://h.lgv5.net/c/200
480 bytes received in 0.00 seconds (4.66 MB/s)
Cheers!
-Lucas
Index: fetch.c
===================================================================
RCS file: /home/cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.198
diff -u -p -r1.198 fetch.c
--- fetch.c 18 Oct 2020 20:35:18 -0000 1.198
+++ fetch.c 24 Dec 2020 14:03:03 -0000
@@ -843,6 +843,7 @@ noslash:
case 302: /* Found */
case 303: /* See Other */
case 307: /* Temporary Redirect */
+ case 308: /* Permanent Redirect */
isredirect++;
if (redirect_loop++ > 10) {
warnx("Too many redirections requested");