secure.es.tst 565 B

123456789101112131415161718192021222324
  1. /*
  2. secure.tst - Test SECURE ability
  3. */
  4. const HTTP = tget('TM_HTTP') || "127.0.0.1:8080"
  5. const HTTPS = tget('TM_HTTPS') || "127.0.0.1:4443"
  6. let http: Http = new Http
  7. if (thas("ME_SSL")) {
  8. // Will be denied and redirect to https
  9. http.get(HTTP + "/secure/index.html")
  10. ttrue(http.status == 302)
  11. http.close()
  12. // Will be admitted
  13. http.verify = false
  14. http.get(HTTPS + "/secure/index.html")
  15. ttrue(http.status == 200)
  16. ttrue(http.response.contains("Hello secure world"))
  17. http.close()
  18. } else {
  19. tskip("SSL not enabled")
  20. }