diff --git a/src/gmnic.c b/src/gmnic.c

index 4ddcb1d83bf03fba67fd2231c81c38c6e38b2136..3fcfa059fe344aa4dc96bd90c4f313a4b6e755cd 100644

--- a/src/gmnic.c

+++ b/src/gmnic.c

@@ -34,7 +34,7 @@ INPUT_SUPPRESS,

};

enum input_mode input_mode = INPUT_READ;

FILE *input_source = stdin;

- bool linefeed = true;

+ bool follow_redirects = false, linefeed = true;

int c;

while ((c = getopt(argc, argv, "46C:d:D:hlLiIN")) != -1) {

@@ -72,7 +72,7 @@ case 'l':

linefeed = false;

break;

case 'L':

- assert(0); // TODO: Follow redirects

+ follow_redirects = true;

break;

case 'i':

header_mode = SHOW_HEADERS;

@@ -142,7 +142,16 @@ free(url);

url = new_url;

goto next;

case 3: // REDIRECT

- assert(0); // TODO

+ free(url);

+ url = strdup(resp.meta);

+ if (!follow_redirects) {

+ if (header_mode == OMIT_HEADERS) {

+ fprintf(stderr, "REDIRECT: %d %s\n",

+ resp.status, resp.meta);

+ }

+ exit = true;

+ }

+ goto next;

case 6: // CLIENT CERTIFICATE REQUIRED

assert(0); // TODO

case 4: // TEMPORARY FAILURE