Class: Strawman::GlypeProxy

Inherits:
Proxy
  • Object
show all
Defined in:
lib/strawman/proxy.rb

Overview

An implementation of the Proxy class which is specific to Glype proxies. See: www.glype.com/ for more details.

Instance Attribute Summary

Attributes inherited from Proxy

#root_url, #valid

Instance Method Summary collapse

Methods inherited from Proxy

#==, #initialize, #proxy_url, #referer, #valid?

Constructor Details

This class inherits a constructor from Strawman::Proxy

Instance Method Details

#to_sObject



71
72
73
# File 'lib/strawman/proxy.rb', line 71

def to_s
  "<GlypeProxy #{@root_url}>"
end

#validate(verification_url) ⇒ Object

Verifies whether this proxy is currently functional. Returns a deferable.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/strawman/proxy.rb', line 56

def validate(verification_url)
  @valid = false

  # FIXME: This only validate proxies that don't require a unique session
  # cookie which is retrieved by going to the root page and looking for the
  # s cookie.
  url = proxy_url(verification_url)
  http = Transport.new(url).get :head => {'referer' => @root_url}
  http.callback {
    @valid = true if http.response_header.status == 200
  }

  http
end