mail list
9/18/2008 12:37:00 PM
not exactly what you want but close and i know it works...
response_header = {"Content-type" => "text/xml"}
response_header.merge headers
ht =Net::HTTP.start(self.host,self.port)
url = self.url # + "/" + self.topic
puts "posting to: #{self.host}: #{self.port} #{url}
message: #{msg.to_xml}"
r=ht.post(url,msg.to_xml,response_header)
puts "result: #{r.to_s}"
r
On Sep 18, 2008, at 9:57 AM, macarthy wrote:
> i'm trying to mimic a curl command Im using in ruby
>
> curl -T file https://url
>
> and here is want I'm using in ruby
>
> myfile = File.read("test.txt")
> url = URI.parse(uploadUrl)
> Net::HTTP.version_1_1
>
> conn = Net::HTTP.new(url.host )
> conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
> conn.set_debug_output $stderr
> conn.use_ssl=(true)
>
> response = conn.start do |http|
> http.set_debug_output $stderr
> req = Net::HTTP::Put.new( path )
> http.request(req, myfile)
>
> end
>
> What am I doing wrong ?
>