http net PUT

M

macarthy

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 ?
 
M

mail list

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top