### Home Classes Methods

### In Files

- lib/termtter/httppool.rb

### Methods

- ::connection
- ::connection_key
- ::finish
- ::http_class
- ::start

### Files

- ChangeLog
- README.rdoc

### Class/Module Index

Quicksearch

- Termtter
- Termtter::API
- Termtter::ActiveRubytter
- Termtter::Client
- Termtter::Client::DirectMessage
- Termtter::Client::Jakigan
- Termtter::Client::SearchEvent
- Termtter::Client::UserSearchEvent
- Termtter::Command
- Termtter::CommandCanceled
- Termtter::CommandLine
- Termtter::CommandNotFound
- Termtter::Config
- Termtter::ConfigSetup
- Termtter::Crypt
- Termtter::English
- Termtter::Event
- Termtter::HTTPpool
- Termtter::Hook
- Termtter::HookCanceled
- Termtter::Hookable
- Termtter::JSONError
- Termtter::MemoryCache
- Termtter::MemoryCache::MemCacheMock
- Termtter::OptParser
- Termtter::Plugin
- Termtter::Plugin::Screen
- Termtter::Plugins
- Termtter::Plugins::Haml
- Termtter::Plugins::ListSwitch
- Termtter::RubytterProxy
- Termtter::RubytterProxy::FrequentAccessError
- Termtter::RubytterProxy::LimitManager
- Termtter::Status
- Termtter::StdOut
- Termtter::Storage
- Termtter::Storage::SQLite3
- Termtter::Storage::Status
- Termtter::Task
- Termtter::TaskManager
- Termtter::TypableIdGenerator
- Termtter::UserStreamReceiver
- Yharian
- Yharian::Alex
- Yharian::Jenifer
- Yharian::Remark
- Yharian::Speaker
- Yharian::Vicki
- Yharian::Yhara
- HatenaKeywordHaiku
- HatenaKeywordHaiku::Word
- OAuth
- OAuth::AccessToken
- Readline
- Readline::LIBREADLINE
- AAMaker
- Array
- BrowserNotFound
- Growl
- IRB
- Object
- Status
- String
- Symbol
- TermColor
- TermtterIrcGateway
- User

No matching classes.

# Termtter::HTTPpool

### Public Class Methods

connection(host, port = 80, ssl = false) click to toggle source

    # File lib/termtter/httppool.rb, line 25
    def self.connection(host, port = 80, ssl = false)
      key = connection_key(host, port)
      http_io = http_class.new(host, port)
      http_io.use_ssl = ssl
      http_io.verify_mode = OpenSSL::SSL::VERIFY_NONE
      @@connections[key] ||= http_io.start
    end

connection_key(host, port) click to toggle source

    # File lib/termtter/httppool.rb, line 39
    def self.connection_key(host, port)
      port == 80 ? host : [host, port.to_s].join(':')
    end

finish(host, port = 80) click to toggle source

    # File lib/termtter/httppool.rb, line 33
    def self.finish(host, port = 80)
      key = connection_key(host, port)
      @@connections[key] && @@connections[key].do_finish rescue nil
      @@connections.delete(key)
    end

http_class() click to toggle source

    # File lib/termtter/httppool.rb, line 43
    def self.http_class
      @@http_class ||=
        if config.proxy.host.nil? or config.proxy.host.empty?
          Net::HTTP
        else
          Net::HTTP::Proxy(
            config.proxy.host,
            config.proxy.port,
            config.proxy.user_name,
            config.proxy.password)
        end
    end

start(host, port = 80, ssl = false) click to toggle source

    # File lib/termtter/httppool.rb, line 11
    def self.start(host, port = 80, ssl = false)
      count = config.retry || 3
      begin
        yield(connection(host, port, ssl))
      rescue EOFError
        finish(host, port)
        if count > 0
          count -= 1
          retry
        end
        raise
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.