class EnClient::HTTPWithProxyClientTransport
Public Class Methods
new(url, proxy_addr = nil, proxy_port = nil)
click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 260 def initialize(url, proxy_addr = nil, proxy_port = nil) @url = URI url @headers = {'Content-Type' => 'application/x-thrift'} @outbuf = "" @proxy_addr = proxy_addr @proxy_port = proxy_port end
Public Instance Methods
add_headers(headers)
click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 272 def add_headers(headers) @headers = @headers.merge(headers) end
flush()
click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 276 def flush if @proxy_addr && @proxy_port http = Net::HTTP::Proxy(@proxy_addr, @proxy_port).new @url.host, @url.port else http = Net::HTTP.new @url.host, @url.port end if @url.scheme == "https" http.use_ssl = true http.ssl_version = "SSLv3" http.verify_mode = OpenSSL::SSL::VERIFY_NONE end #http.verify_mode = OpenSSL::SSL::VERIFY_PEER #http.verify_depth = 5 resp = http.post(@url.request_uri, @outbuf, @headers) @inbuf = StringIO.new resp.body @outbuf = "" end
open?()
click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 268 def open?; true end
read(sz)
click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 269 def read(sz); @inbuf.read sz end
write(buf)
click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 270 def write(buf); @outbuf << buf end