Skip to content
This repository

Ruby FTW - For The Web. Experimentation in web clients and servers.

branch: master

Improve ssl security

This was largely done in part to ruby-core's refusal to take
responsibility and accept a patch for ruby's bad SSL defaults.

- disable some insecure ciphers based on advice from howsmyssl
- don't force TLSv1; now uses TLSv1.1 by default in my tests.
- disable compression to avoid CRIME attack
latest commit 1874c707b9
Jordan Sissel authored January 21, 2014
Octocat-spinner-32 .batcave - try doing project-ey things with batcave February 21, 2012
Octocat-spinner-32 certs - Update cacert.pem from upstream December 08, 2013
Octocat-spinner-32 examples - add more logstash examples March 23, 2013
Octocat-spinner-32 lib Improve ssl security January 21, 2014
Octocat-spinner-32 spec Add spec that queries howsmyssl.com and fails if we are "Bad" January 21, 2014
Octocat-spinner-32 test Add FTW::Singleton tests March 05, 2012
Octocat-spinner-32 .gitignore - sprinkle in some testing January 28, 2012
Octocat-spinner-32 .travis.yml add rspec March 15, 2012
Octocat-spinner-32 Gemfile Upgrade some deps September 10, 2012
Octocat-spinner-32 Gemfile.lock . September 10, 2012
Octocat-spinner-32 Makefile Easier updating of cacert.pem December 08, 2013
Octocat-spinner-32 README.md - more things to read March 05, 2012
Octocat-spinner-32 ftw.gemspec - version bump May 08, 2013
Octocat-spinner-32 notify-failure.sh - add test tools February 07, 2012
Octocat-spinner-32 test.rb - update readme with some public APi ideas February 07, 2012
README.md

For The Web

Getting Started

  • For web agents: {FTW::Agent}
  • For dns: {FTW::DNS}
  • For tcp connections: {FTW::Connection}
  • For tcp servers: {FTW::Server}

Overview

net/http is pretty much not good. Additionally, DNS behavior in ruby changes quite frequently.

I primarily want two things in both client and server operations:

  • A consistent API with good documentation, readable code, and high quality tests.
  • Modern web features: websockets, spdy, etc.

Desired features:

  • Awesome documentation
  • A HTTP client that acts as a full user agent, not just a single connections. (With connection reuse)
  • HTTP and SPDY support.
  • WebSockets support.
  • SSL/TLS support.
  • Browser Agent features like cookies and caching
  • An API that lets me do what I need.
  • Server and Client modes.
  • Support for both normal operation and EventMachine would be nice.

For reference:

Agent API

Reference: {FTW::Agent}

Common case

agent = FTW::Agent.new

request = agent.get("http://www.google.com/")
response = request.execute
puts response.body.read

# Simpler
response = agent.get!("http://www.google.com/").read
puts response.body.read

SPDY

  • This is not implemented yet

SPDY should automatically be attempted. The caller should be unaware.

I do not plan on exposing any direct means for invoking SPDY.

WebSockets

# 'http(s)' or 'ws(s)' urls are valid here. They will mean the same thing.
websocket = agent.websocket!("http://somehost/endpoint")

websocket.publish("Hello world")
websocket.each do |message|
  puts :received => message
end

Web Server API

I have implemented a rack server, Rack::Handler::FTW. It does not comply fully with the Rack spec. See 'Rack Compliance Issues' below.

Under the FTW rack handler, there is an environment variable added, "ftw.connection". This will be a FTW::Connection you can use for CONNECT, Upgrades, etc.

There's also a websockets wrapper, FTW::WebSockets::Rack, that will help you specifically with websocket requests and such.

Rack Compliance issues

Due to some awkward and bad requirements - specifically those around the specified behavior of 'rack.input' - I can't support the rack specification fully.

The 'rack.input' must be an IO-like object supporting #rewind which rewinds to the beginning of the request.

For high-data connections (like uploads, HTTP CONNECT, and HTTP Upgrade), it's not practical to hold the entire history of time in a buffer. We'll run out of memory, you crazy fools!

Details here: https://github.com/rack/rack/issues/347

Other Projects

Here are some related projects that I have no affiliation with:

Given some of the above (especially the server-side stuff), I'm likely try and integrate with those projects. For example, writing a Faye handler that uses the FTW server, if the FTW web server even stays around.

Something went wrong with that request. Please try again.