Strawman

A ruby gem which allows you to proxy EventMachine HTTP GET requests through glype proxies on the net.

RDoc: http://rdoc.info/projects/MattColyer/strawman

Getting started

# make sure you have gemcutter.org repos enabled
gem install strawman

A simple example

require 'rubygems'
require 'eventmachine'
require 'em-http'
require 'strawman'
require 'logger'

log = Logger.new(STDOUT)
log.level = Logger::INFO

EventMachine.run {
proxy_list = Strawman::ProxyList.new("http://whatismyip.org")
proxy_list.load("proxies") if File.exist?("proxies")
sources_set = proxy_list.add_sources([Strawman::TwitterSource.new("proxy_sites")])

sources_set.callback{
  proxy_list.save("proxies")
  request = Strawman::HttpRequest.new(proxy_list, 'http://goingtorain.com/')
  request.callback {
    http = request.get
    http.callback {
      log.info http.response_header.inspect
      log.info http.response
      EventMachine.stop
    }
  }
  request.errback{
    log.error "No available proxies"
  }
}

sources_set.errback{
  log.error "Something went wrong"
  EventMachine.stop
}
}

TODO

Patches happily accepted, please open a github ticket and attach the patch.

  • Undo link encoding if Glype adds it
  • Strip annoying stuff that Glype adds as a footer and header
  • Implement other proxy sources

Limitations

  • Cookies from the proxied page are returned like this: c[PATH][NAME]=VALUE; path=/"* Note the letter c is configurable on the Glype proxy so it might not always b this.
  • Cookies are sent like this: :head => => {"c[DOMAIN][PATH][NAME]" => VALUE} Again note that the letter c is configurable on the Glype proxy.
  • Cookies are currently not reliable as they can be enabled or disabled by each Glype install (the default is to enable though).
  • SSL is not reliable. Some proxies throw up a warning while others let it through. Also it's not secure, by it's very nature this library is introducing a MITM. Don't use it for sensitive things.
  • PUT and DELETE can't work do to the way Glype is implemented.