gem.awk

A gemini client in POSIX awk
git clone git://git.vgx.fr/gem.awk
Log | Files | Refs

commit 93c7bc4aa91e03637492ce1446b3093769bda9d2
parent d86989b17e1d3029c6ee83978543ce326509b90f
Author: Léo Villeveygoux <l@vgx.fr>
Date:   Thu,  4 Jun 2020 03:42:19 +0200

Don't show openssl's stderr on connexion success

Fix error lines being displayed on self-signed certificates.

Diffstat:
Mgem.awk | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gem.awk b/gem.awk @@ -45,7 +45,7 @@ function print_text(connexion_cmd) { function connexion_open(url, domain, port) { if (!port) port = 1965 - connexion_cmd="echo '" url "' | openssl s_client -crlf -quiet -verify_quiet -connect '" domain ":" port "'" + connexion_cmd="echo '" url "' | openssl s_client -crlf -quiet -verify_quiet -connect '" domain ":" port "' 2>/dev/null" connexion_cmd | getline } @@ -64,7 +64,13 @@ function gemini_url_open(url) { connexion_open(url, domain, port) - if (/^2./) { + if (! $0) { + close(connexion_cmd) + sub(/null$/, "stdout", connexion_cmd) + sub(/-quiet -verify_quiet/, "", connexion_cmd) + print "\033[1mOpenSSL connexion error:\033[0m" + system(connexion_cmd) + } else if (/^2./) { CURRENT_URL=url if (!$2 || $2 ~ /text\/gemini/) parse_gemini(connexion_cmd)