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.rb91
1 files changed, 1 insertions, 90 deletions
diff --git a/lib/webrick/https.rb b/lib/webrick/https.rb
index 4826654d3a..dd9d178618 100644
--- a/lib/webrick/https.rb
+++ b/lib/webrick/https.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: false
#
# https.rb -- SSL/TLS enhancement for HTTPServer
#
@@ -10,35 +9,14 @@
# $IPR: https.rb,v 1.15 2003/07/22 19:20:42 gotoyuzo Exp $
require 'webrick/ssl'
-require 'webrick/httpserver'
module WEBrick
module Config
HTTP.update(SSL)
end
- ##
- #--
- # Adds SSL functionality to WEBrick::HTTPRequest
-
class HTTPRequest
-
- ##
- # HTTP request SSL cipher
-
- attr_reader :cipher
-
- ##
- # HTTP request server certificate
-
- attr_reader :server_cert
-
- ##
- # HTTP request client certificate
-
- attr_reader :client_cert
-
- # :stopdoc:
+ attr_reader :cipher, :server_cert, :client_cert
alias orig_parse parse
@@ -60,7 +38,6 @@ module WEBrick
end
return orig_parse_uri(str)
end
- private :parse_uri
alias orig_meta_vars meta_vars
@@ -82,71 +59,5 @@ module WEBrick
end
meta
end
-
- # :startdoc:
- end
-
- ##
- #--
- # Fake WEBrick::HTTPRequest for lookup_server
-
- class SNIRequest
-
- ##
- # The SNI hostname
-
- attr_reader :host
-
- ##
- # The socket address of the server
-
- attr_reader :addr
-
- ##
- # The port this request is for
-
- attr_reader :port
-
- ##
- # Creates a new SNIRequest.
-
- def initialize(sslsocket, hostname)
- @host = hostname
- @addr = sslsocket.addr
- @port = @addr[1]
- end
- end
-
-
- ##
- #--
- # Adds SSL functionality to WEBrick::HTTPServer
-
- class HTTPServer < ::WEBrick::GenericServer
- ##
- # ServerNameIndication callback
-
- def ssl_servername_callback(sslsocket, hostname = nil)
- req = SNIRequest.new(sslsocket, hostname)
- server = lookup_server(req)
- server ? server.ssl_context : nil
- end
-
- # :stopdoc:
-
- ##
- # Check whether +server+ is also SSL server.
- # Also +server+'s SSL context will be created.
-
- alias orig_virtual_host virtual_host
-
- def virtual_host(server)
- if @config[:SSLEnable] && !server.ssl_context
- raise ArgumentError, "virtual host must set SSLEnable to true"
- end
- orig_virtual_host(server)
- end
-
- # :startdoc:
end
end