- From: Dan Brickley <danbri@w3.org>
- Date: Thu, 26 Sep 2002 16:19:46 -0400
- To: charles@w3.org
- CC: www-archive+esw@w3.org, libby.miller@bristol.ac.uk
Received on Wednesday, 25 September 2002 16:14:55 UTC
Some steps towards ruby HTTP PUT. Doesn't handle redirects yet (though Annotea probably doesn't send them...) Dan
#!/usr/bin/env ruby
require 'net/http'
uri='http://www.w3.org/2002/09/put-1'
uri =~ /:\/\/([^\/]+)(\/.*)$/
host = $1
res = $2
h = Net::HTTP::new host
h.open_timeout = 30 # secs
h.read_timeout = 60 # secs
proxy_addr = 'cache-edi.cableinet.co.uk' # todo: add to config
proxy_port = 8080
account='danbri'
password='xxxx' #
user_agent = 'RDFWeb-Scutter-200207;http://rdfweb.org/foaf/'
my_headers = {'Accept' => 'application/rdf+xml',
'Authentication' => ["#{account}:#{password}"].pack('m').strip ,
'User-agent' => user_agent }
resp=''
data=''
text ='my annotation info'
#puts my_headers.inspect
Net::HTTP::Proxy(proxy_addr, proxy_port).start( $1 ) do |http|
# resp, data = http.get(res, my_headers)
resp, data = http.put(res, text, my_headers)
end
puts "URI: #{uri}\n"
puts "response: #{resp.inspect}\n"
puts "data: #{data.inspect}\n"
Received on Wednesday, 25 September 2002 16:14:55 UTC