You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

https_spec.rb 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. module CryptCheck::Tls
  2. describe Https do
  3. def server(*args, **kargs, &block)
  4. tls_serv *args, **kargs, &block
  5. end
  6. def plain_server(*args, **kargs, &block)
  7. plain_serv *args, **kargs, &block
  8. end
  9. def analyze(*args)
  10. Https.analyze *args
  11. end
  12. # include_examples :analysis
  13. #
  14. # describe '#hsts?' do
  15. # it 'has no hsts' do
  16. # grades = server host: '127.0.0.1' do
  17. # analyze '127.0.0.1', 5000
  18. # end
  19. #
  20. # _, server = expect_grade grades, '127.0.0.1', '127.0.0.1', 5000, :ipv4
  21. # expect(server.hsts?).to be false
  22. # end
  23. #
  24. # it 'has hsts' do
  25. # process = proc do |socket|
  26. # socket.print [
  27. # 'HTTP/1.1 200 OK',
  28. # 'Strict-transport-security: max-age=31536000; includeSubdomains; preload',
  29. # 'Content-Type: text/plain',
  30. # 'Content-Length: 0',
  31. # 'Connection: close'
  32. # ].join "\r\n"
  33. # end
  34. #
  35. # grades = server host: '127.0.0.1', process: process do
  36. # analyze '127.0.0.1', 5000
  37. # end
  38. #
  39. # _, server = expect_grade grades, '127.0.0.1', '127.0.0.1', 5000, :ipv4
  40. # expect(server.hsts?).to be true
  41. # end
  42. # end
  43. #
  44. # describe '#hsts_long?' do
  45. # it 'has no hsts' do
  46. # grades = server host: '127.0.0.1' do
  47. # analyze '127.0.0.1', 5000
  48. # end
  49. #
  50. # _, server = expect_grade grades, '127.0.0.1', '127.0.0.1', 5000, :ipv4
  51. # expect(server.hsts_long?).to be false
  52. # end
  53. #
  54. # it 'has hsts but not long' do
  55. # process = proc do |socket|
  56. # socket.print [
  57. # 'HTTP/1.1 200 OK',
  58. # "Strict-transport-security: max-age=#{Https::Server::LONG_HSTS-1}; includeSubdomains; preload",
  59. # 'Content-Type: text/plain',
  60. # 'Content-Length: 0',
  61. # 'Connection: close'
  62. # ].join "\r\n"
  63. # end
  64. #
  65. # grades = server host: '127.0.0.1', process: process do
  66. # analyze '127.0.0.1', 5000
  67. # end
  68. #
  69. # _, server = expect_grade grades, '127.0.0.1', '127.0.0.1', 5000, :ipv4
  70. # expect(server.hsts_long?).to be false
  71. # end
  72. #
  73. # it 'has long hsts' do
  74. # process = proc do |socket|
  75. # socket.print [
  76. # 'HTTP/1.1 200 OK',
  77. # "Strict-transport-security: max-age=#{Https::Server::LONG_HSTS}; includeSubdomains; preload",
  78. # 'Content-Type: text/plain',
  79. # 'Content-Length: 0',
  80. # 'Connection: close'
  81. # ].join "\r\n"
  82. # end
  83. #
  84. # grades = server host: '127.0.0.1', process: process do
  85. # analyze '127.0.0.1', 5000
  86. # end
  87. #
  88. # _, server = expect_grade grades, '127.0.0.1', '127.0.0.1', 5000, :ipv4
  89. # expect(server.hsts_long?).to be true
  90. # end
  91. # end
  92. end
  93. end