!******************************************************************************!
! Tests httpserv runs as an https server. This is the client macro to test.
!
! This requires:
! 1) The server will have run %test_httpserv_insecure_https.mm or %test_httpserv_secure_https.mm
! 2) p12 cert that is signed by the same rootCA on both the local and remote sever
! 3) SSLUtilities.properties with the cert signed for the rootCA loaded
!    the keystore with the rootCA added to it.
! @bug      NXM-3313 insecure SSL
! @author:  Kevin Esterheld
! @since    NeXtMidas 3.9.0
!******************************************************************************!
startmacro
  switch DEBUG      debug      GET DEF=false SDEF=true
  switch VERBOSE    verbose    GET DEF=false SDEF=true
  switch REMOTEHOST remotehost GET DEF="localhost"
  switch TESTNSS    testnss    GET DEF=false SDEF=true

  say "^{reg.main.name}: Running with nss - ^{testnss}\n"

  ! Check if testing with nss
  if testnss then
    res propsFile "SSLUtilitiesNSS.properties"
  else
    res propsFile "SSLUtilitiesHTTPSERV.properties"
  endif

  ! This will load ssl
  if debug then
    say "^{reg.main.name}: Running SSLCONFIGURE PROPSFILE=^{propsFile}..."
  endif
  SSLCONFIGURE PROPSFILE=^{propsFile}

  files/nameonly/list=webfileslist aux="https://^{remotehost}:2222/mydir/"
  assert/text="^reg.main.name: LISTING files from HTTPSERV directory" webfileslist.length GT 0
  assert/text="^reg.main.name: LISTING files from HTTPSERV directory contains testfile" "test_files_junk1.tmp" SUBS webfileslist
endmacro