Flowdock
method

send_post

Importance_0
v1_8_7_330 - Show latest stable - 0 notes - Class: SOAP::HTTPStreamHandler
send_post(endpoint_url, conn_data, charset) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/soap/streamHandler.rb, line 151
  def send_post(endpoint_url, conn_data, charset)
    conn_data.send_contenttype ||= StreamHandler.create_media_type(charset)

    if @wiredump_file_base
      filename = @wiredump_file_base + '_request.xml'
      f = File.open(filename, "w")
      f << conn_data.send_string
      f.close
    end

    extra = {}
    extra['Content-Type'] = conn_data.send_contenttype
    extra['SOAPAction'] = "\"#{ conn_data.soapaction }\""
    extra['Accept-Encoding'] = 'gzip' if send_accept_encoding_gzip?
    send_string = conn_data.send_string
    @wiredump_dev << "Wire dump:\n\n" if @wiredump_dev
    begin
      retry_count = 0
      while true
        res = @client.post(endpoint_url, send_string, extra)
        if RETRYABLE and HTTP::Status.redirect?(res.status)
          retry_count += 1
          if retry_count >= MAX_RETRY_COUNT
            raise HTTPStreamError.new("redirect count exceeded")
          end
          endpoint_url = res.header["location"][0]
          puts "redirected to #{endpoint_url}" if $DEBUG
        else
          break
        end
      end
    rescue
      @client.reset(endpoint_url)
      raise
    end
    @wiredump_dev << "\n\n" if @wiredump_dev
    receive_string = res.content
    if @wiredump_file_base
      filename = @wiredump_file_base + '_response.xml'
      f = File.open(filename, "w")
      f << receive_string
      f.close
    end
    case res.status
    when 405
      raise PostUnavailableError.new("#{ res.status }: #{ res.reason }")
    when 200, 500
      # Nothing to do.
    else
      raise HTTPStreamError.new("#{ res.status }: #{ res.reason }")
    end
    if res.respond_to?(:header) and !res.header['content-encoding'].empty? and
        res.header['content-encoding'][0].downcase == 'gzip'
      receive_string = decode_gzip(receive_string)
    end
    conn_data.receive_string = receive_string
    conn_data.receive_contenttype = res.contenttype
    conn_data
  end
Register or log in to add new notes.