Author: kclark
Date: Wed Oct 15 12:06:18 2008
New Revision: 704994
URL: http://svn.apache.org/viewvc?rev=704994&view=rev
Log:
rb: Support SSL and correct Content-Type in HTTPClient [THRIFT-156]
Author: Dave Engberg
Modified:
incubator/thrift/trunk/lib/rb/lib/thrift/transport/httpclient.rb
Modified: incubator/thrift/trunk/lib/rb/lib/thrift/transport/httpclient.rb
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/lib/thrift/transport/httpclient.rb?rev=704994&r1=704993&r2=704994&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/lib/thrift/transport/httpclient.rb (original)
+++ incubator/thrift/trunk/lib/rb/lib/thrift/transport/httpclient.rb Wed Oct 15
12:06:18 2008
@@ -1,6 +1,7 @@
require 'thrift/transport'
require 'net/http'
+require 'net/https'
require 'uri'
require 'stringio'
@@ -17,7 +18,9 @@
def write(buf); @outbuf << buf end
def flush
http = Net::HTTP.new @url.host, @url.port
- resp, data = http.post(@url.path, @outbuf)
+ http.use_ssl = @url.scheme == "https"
+ headers = { 'Content-Type' => 'application/x-thrift' }
+ resp, data = http.post(@url.path, @outbuf, headers)
@inbuf = StringIO.new data
@outbuf = ""
end