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

index c5099c7f263a83086ea67d12db8bf67676f02a33..d298bbdc5fda363410bf44b9cc336762a7667143 100644

--- a/src/gmnlm.c

+++ b/src/gmnlm.c

@@ -1351,26 +1351,26 @@ if (browser->tofu_mode != TOFU_ASK) {

return browser->tofu_mode;

}

+ char *host;

+ if (curl_url_get(browser->url, CURLUPART_HOST, &host, 0) != CURLUE_OK) {

+ fprintf(stderr, "Error: invalid URL %s\n",

+ browser->plain_url);

+ return TOFU_FAIL;

+ }

static char prompt[8192];

switch (error) {

case TOFU_VALID:

assert(0); // Invariant

case TOFU_INVALID_CERT:

snprintf(prompt, sizeof(prompt),

- "The certificate offered by this server IS INVALID.\n"

+ "The certificate offered by %s IS INVALID.\n"

"/!\\ 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"

- "=> ");

+ "=> ", host);

break;

case TOFU_UNTRUSTED_CERT:;

- char *host;

- if (curl_url_get(browser->url, CURLUPART_HOST, &host, 0) != CURLUE_OK) {

- fprintf(stderr, "Error: invalid URL %s\n",

- browser->plain_url);

- return TOFU_FAIL;

- }

snprintf(prompt, sizeof(prompt),

"The certificate offered by %s is of unknown trust. "

"Its fingerprint is: \n"

@@ -1381,9 +1381,9 @@ "[T]rust always; trust [o]nce; [a]bort\n"

"=> ", host, fingerprint);

free(host);

break;

- case TOFU_FINGERPRINT_MISMATCH:

+ case TOFU_FINGERPRINT_MISMATCH:;

snprintf(prompt, sizeof(prompt),

- "The certificate offered by this server DOES NOT MATCH the one we have on file.\n"

+ "The certificate offered by %s DOES NOT MATCH the one we have on file.\n"

"/!\\ Someone may be eavesdropping on or manipulating this connection. /!\\\n"

"The unknown certificate's fingerprint is:\n"

"%s\n\n"

@@ -1392,7 +1392,7 @@ "%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"

- "=> ", fingerprint, khost->fingerprint);

+ "=> ", host, fingerprint, khost->fingerprint);

break;

}