Hi all,
net/http,smtp,pop version 1.2 pre1 is released.
I check in these after ruby 1.7 branch is started.
Any bug report/proposal is welcome.
http://www1.u-netsurf.ne.jp/~brew/mine/soft/net-1.2.0-pre1.tar.gz
(..../soft/index.html is the index.)
Changes:
* HTTP#get,head,post does not raise ProtocolError
* HTTP#get,head,post return only HTTPResponse object;
Entity body is got by response.body
* Request object. HTTP#new_get,new_head,new_post creates this
* POP3#delete_all, POP3.delete_all, POP3.foreach
(*) no changes in HTTP#get2,head2,post2
(*) no changes in smtp.rb
Usage of new_* is below.
HTTP.start( host ) do |http|
http.new_get( '/index.html' ) do |request|
request['user-agent'] = 'My Getter 1.0'
p request['allow']
response = request.dispatch
puts response.code # 200
puts response['content-type'] # text/html
puts response.read_body # <html><head><tit...
response.body # same to read_body()
end
http.new_post( '/cgi-bin/killercgi.rb' ) do |request|
response = request.dispatch {|f|
f.write str
f.write str
}
response.read_body
end
end
P.S.
For backward compatibility, HTTP::old_implementation method can
be used. After calling this method Net::HTTP object behaves as
it is version 1.1's.
Minero Aoki