summaryrefslogtreecommitdiff
path: root/lib/webrick/https.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/webrick/https.rb')
-rw-r--r--lib/webrick/https.rb30
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/webrick/https.rb b/lib/webrick/https.rb
index 81b65ce803..73875d7326 100644
--- a/lib/webrick/https.rb
+++ b/lib/webrick/https.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
#
# https.rb -- SSL/TLS enhancement for HTTPServer
#
@@ -15,8 +16,28 @@ module WEBrick
HTTP.update(SSL)
end
+ ##
+ #--
+ # Adds SSL functionality to WEBrick::HTTPRequest
+
class HTTPRequest
- attr_reader :cipher, :server_cert, :client_cert
+
+ ##
+ # HTTP request SSL cipher
+
+ attr_reader :cipher
+
+ ##
+ # HTTP request server certificate
+
+ attr_reader :server_cert
+
+ ##
+ # HTTP request client certificate
+
+ attr_reader :client_cert
+
+ # :stopdoc:
alias orig_parse parse
@@ -33,17 +54,18 @@ module WEBrick
alias orig_parse_uri parse_uri
def parse_uri(str, scheme="https")
- if @server_cert
+ if server_cert
return orig_parse_uri(str, scheme)
end
return orig_parse_uri(str)
end
+ private :parse_uri
alias orig_meta_vars meta_vars
def meta_vars
meta = orig_meta_vars
- if @server_cert
+ if server_cert
meta["HTTPS"] = "on"
meta["SSL_SERVER_CERT"] = @server_cert.to_pem
meta["SSL_CLIENT_CERT"] = @client_cert ? @client_cert.to_pem : ""
@@ -59,5 +81,7 @@ module WEBrick
end
meta
end
+
+ # :startdoc:
end
end