Fw: Re: [ANN] Specification update

Alex // nytpu alex at nytpu.com
Mon Nov 15 15:29:19 GMT 2021
Luckily it's pretty easy to test this with openssl's s_client, it'll say
"closed" at the end if the connection was closed properly:

  printf "gemini://nytpu.com/about.gmi\r\n" |
    openssl s_client -ign_eof -connect nytpu.com:1965

outputs:

  depth=0 O = nytpu, CN = nytpu.com
  verify error:num=18:self signed certificate
  [...handshake and cert info...]
  20 text/gemini; lang=en-US
  [...the actual response body (if success response code)...]
  [...end-of-connection info...]
  closed

Here's a handy little shell function where you give it a URI and it'll
check if it's closed properly or not:

  test_close_notify() {
    hostname="$(printf "$1" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')"
    output="$(printf "%s\r\n" "$1" |
      openssl s_client -ign_eof -connect "${hostname}:1965" 2>&1 |
      tail -n1 | tr -d '\n')"
    if [ "${output}" = "closed" ]; then
      printf "close_notify for '%s' properly recieved.\n" "$1" >&2
    else
      printf "close_notify for '%s' not received!\n" "$1" >&2
    fi
  }

~nytpu

-- 
Alex // nytpu
alex@nytpu.com
gpg --locate-external-key alex@nytpu.com


Archive home | About this archive