[
https://issues.apache.org/jira/browse/THRIFT-156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639931#action_12639931
]
Kevin Clark commented on THRIFT-156:
------------------------------------
Looks fine to me, I'm going to push. Anyone know how to get Dave set up as a
contributor so I can assign to him and he can get credit in the tracker?
> Patch to Ruby HTTPClient to support SSL and to send correct Thrift
> Content-Type header
> --------------------------------------------------------------------------------------
>
> Key: THRIFT-156
> URL: https://issues.apache.org/jira/browse/THRIFT-156
> Project: Thrift
> Issue Type: Bug
> Components: Library (Ruby)
> Reporter: Dave Engberg
> Attachments: httpclient.rb.diff
>
>
> The Ruby HTTPClient class fails if you provide an https: URL, and it does not
> set the same HTTP Content-Type header as the other language libraries.
> This small patch addresses these two issues:
> Index: lib/rb/lib/thrift/transport/httpclient.rb
> ===================================================================
> --- lib/rb/lib/thrift/transport/httpclient.rb (revision 701711)
> +++ lib/rb/lib/thrift/transport/httpclient.rb (working copy)
> @@ -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
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.