gmni

a gemini line mode client
git clone https://git.clttr.info/gmni.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit dcb42a94c4db17db1da1ba98a4db2bd8b049d031
parent 4810168266adb7ca42e37a8dc628e7274066ef4e
Author: Ondřej Fiala <temp.xanomes@volny.cz>
Date:   Sun,  2 Jan 2022 04:41:00 +0100

gmnlm: add defaults to prompts

Diffstat:
Msrc/gmnlm.c | 21++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -492,7 +492,7 @@ again: fprintf(browser->tty, "The host %s is redirecting to:\n" "%s\n\n" - "[f]ollow redirect; [a]bort\n" + "[F]ollow redirect; [a]bort\n" "=> ", host, resp->meta); size_t sz = 0; @@ -502,7 +502,7 @@ again: requesting = false; break; } - if (line[1] != '\n') { + if (line[0] != '\n' && line[1] != '\n') { free(line); goto again; } @@ -513,7 +513,7 @@ again: if (c == 'a') { requesting = false; break; - } else if (c != 'f') { + } else if (c != 'f' && c != '\n') { goto again; } } else if (browser->max_redirs != REDIRS_UNLIMITED @@ -1204,7 +1204,7 @@ tofu_callback(enum tofu_error error, const char *fingerprint, "/!\\ Someone may be eavesdropping on or manipulating this connection. /!\\\n" "If you choose to proceed, you should not disclose personal information or trust " "the contents of the page.\n" - "[a]bort; trust [o]nce\n" + "[A]bort; trust [o]nce\n" "=> "); break; case TOFU_UNTRUSTED_CERT:; @@ -1220,7 +1220,7 @@ tofu_callback(enum tofu_error error, const char *fingerprint, "%s\n\n" "If you knew the fingerprint to expect in advance, verify that this matches.\n" "Otherwise, it should be safe to trust this certificate.\n\n" - "[t]rust always; trust [o]nce; [a]bort\n" + "[T]rust always; trust [o]nce; [a]bort\n" "=> ", host, fingerprint); free(host); break; @@ -1234,7 +1234,7 @@ tofu_callback(enum tofu_error error, const char *fingerprint, "%s\n\n" "If you choose to proceed, you should not disclose personal information or trust " "the contents of the page.\n" - "[a]bort; trust [o]nce; [t]rust anyway\n" + "[A]bort; trust [o]nce; [t]rust anyway\n" "=> ", fingerprint, khost->fingerprint); break; } @@ -1249,12 +1249,15 @@ tofu_callback(enum tofu_error error, const char *fingerprint, free(line); return TOFU_FAIL; } - if (line[1] != '\n') { + + char c = line[0]; + if (c == '\n') { + return error == TOFU_UNTRUSTED_CERT ? + TOFU_TRUST_ALWAYS : TOFU_FAIL; + } else if (line[1] != '\n') { free(line); continue; } - - char c = line[0]; free(line); switch (c) {