Class: SSE::Impl::HTTPConnectionFactory
- Inherits:
-
Object
- Object
- SSE::Impl::HTTPConnectionFactory
- Defined in:
- lib/ld-eventsource/impl/streaming_http.rb
Overview
Used internally to send the HTTP request, including the proxy dialogue if necessary.
Class Method Summary collapse
Class Method Details
.connect(uri, proxy, connect_timeout, read_timeout) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/ld-eventsource/impl/streaming_http.rb', line 79 def self.connect(uri, proxy, connect_timeout, read_timeout) if !proxy return open_socket(uri, connect_timeout) end socket = open_socket(proxy, connect_timeout) socket.write(build_proxy_request(uri, proxy)) # temporarily create a reader just for the proxy connect response proxy_reader = HTTPResponseReader.new(socket, read_timeout) if proxy_reader.status != 200 raise Errors::HTTPProxyError.new(proxy_reader.status) end # start using TLS at this point if appropriate if uri.scheme.downcase == 'https' wrap_socket_in_ssl_socket(socket) else socket end end |