79-test_http.t 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #! /usr/bin/env perl
  2. # Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use OpenSSL::Test qw/:DEFAULT srctop_file/;
  9. use OpenSSL::Test::Utils;
  10. setup("test_http");
  11. plan skip_all => "HTTP protocol is not supported by this OpenSSL build"
  12. if disabled('http');
  13. plan skip_all => "not supported by no-sock build" if disabled('sock');
  14. plan tests => 2;
  15. SKIP: {
  16. skip "sockets disabled", 1 if disabled("sock");
  17. skip "OCSP disabled", 1 if disabled("ocsp");
  18. skip "HTTP disabled", 1 if disabled("http");
  19. my $cmd = [qw{openssl ocsp -index any -port 0}];
  20. my @output = run(app($cmd), capture => 1);
  21. $output[0] =~ s/\r\n/\n/g;
  22. ok($output[0] =~ /^ACCEPT (0.0.0.0|\[::\]):(\d+?) PID=(\d+)$/
  23. && $2 >= 1024 && $3 > 0,
  24. "HTTP server auto-selects and reports local port >= 1024 and pid > 0");
  25. }
  26. ok(run(test(["http_test", srctop_file("test", "certs", "ca-cert.pem")])));