From: GOTOU Yuuzou Date: 2001-10-11T11:31:38+09:00 Subject: [ruby-talk:22421] Re: Problems with net/https :( In message <20011009104242.A5498@bluenugget.net>, `Jason DiCioccio ' wrote: > > require 'net/https' > # Fetch the requested document > # This used to be more condensed, e.g. Net::HTTP.start( host, port ) > # However, that did not work either. > http = Net::HTTP.new(host, port) > http.use_ssl = true if scheme == "https" # enable SSL/TLS > http.start do |h| > timeout(15) do > h.get2( path ) do |recv| > ...... > end > h.get2( path2 ) do |recv| > ...... > end > end > end > > Basically what happens in a block like this is that the first get2 block works > and fetches the correct page while the second one does not. I can send the > whole program on request, but this should be sufficient. Note that this block > of code works with HTTP but not HTTPS.. I'm using ruby 1.6.5. Hmm, I guess the first get2 block will fail and the second one will success in the HTTP.start block. SSL session is initiated at HTTP.start before passing process to the given block. Then use_ssl= in the HTTP.start block is not effective for the first connection. I think (not condensed) your sample code works fine. # I may be misunderstanding something. -- Gotoyuzo