Sha256: 1c4cd8aeda7484d5ccc7c17d56e4476869bb6c5fd9adb4e84e3b58decfedb315

Contents?: true

Size: 688 Bytes

Versions: 3

Compression:

Stored size: 688 Bytes

Contents

# -- coding: utf-8

require "rubygems"

class KyotoTycoon
  class Tsvrpc
    class Nethttp
      def initialize(host, port)
        @host = host
        @port = port
        @http ||= ::Net::HTTP.new(@host, @port)
      end

      def request(path, params, colenc)
        query = KyotoTycoon::Tsvrpc.build_query(params, colenc)
        req = Net::HTTP::Post.new(path)
        if query.length > 0
          req.body = query
          req['Content-Length'] = query.size
        end
        req['Content-Type'] = "text/tab-separated-values; colenc=#{colenc}"
        req['Connection'] = "close"
        res = @http.request(req)
        [res.code.to_i, res.body]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kyototycoon-0.1.2 lib/kyototycoon/tsvrpc/nethttp.rb
kyototycoon-0.1.1 lib/kyototycoon/tsvrpc/nethttp.rb
kyototycoon-0.1.0 lib/kyototycoon/tsvrpc/nethttp.rb