1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | # 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: * [DNS in Ruby stdlib is broken](https://github.com/jordansissel/experiments/tree/master/ruby/dns-resolving-bug), so I need to provide my own DNS api. ## 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: * https://github.com/igrigorik/em-websocket - websocket server for eventmachine * https://github.com/faye/faye - pubsub for the web (includes a websockets implementation) * https://github.com/faye/faye-websocket-ruby - websocket client and server in ruby * https://github.com/lifo/cramp - real-time web framework (async, websockets) * https://github.com/igrigorik/em-http-request - HTTP client for EventMachine * https://github.com/geemus/excon - http client library 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. |
Commit History @debian/0.0.44-2
0
»»
- Set upstream metadata fields: Bug-Database, Bug-Submit. Debian Janitor 4 years ago
- Set debhelper-compat version in Build-Depends. Debian Janitor 4 years ago
- Bump debhelper from old 9 to 12. Debian Janitor 4 years ago
- Use secure URI in Homepage field. Debian Janitor 4 years ago
- Use secure URI in debian/watch. Debian Janitor 4 years ago
- Remove duplicate line from changelog. Debian Janitor 4 years ago
- Use secure copyright file specification URI. Debian Janitor 4 years ago
- Update d/ch Utkarsh Gupta 4 years ago
- Add salsa-ci.yml Utkarsh Gupta 4 years ago
- Run wrap-and-sort on packaging files Cédric Boutillier 8 years ago
- Bump Standards-Version to 3.9.7 (no changes needed) Cédric Boutillier 8 years ago
- Use https:// in Vcs-* fields Cédric Boutillier 8 years ago
- Use https:// in Vcs-* fields Cédric Boutillier 8 years ago
- Remove version in the gem2deb build-dependency Cédric Boutillier 8 years ago
- Bump debhelper compatibility level to 9 Cédric Boutillier 8 years ago
- improve descriptions Cédric Boutillier 8 years ago
- unapply 0001-disable-doc-tests.patch in the source tree Cédric Boutillier 8 years ago
- Update to upstream version 0.0.44 and enable unit tests Tim Potter (commit: root) 8 years ago
- Merge tag 'upstream/0.0.44' Tim Potter (commit: root) 8 years ago
- Imported Upstream version 0.0.44 Tim Potter (commit: root) 8 years ago
- Add ruby-minitest B-D Tim Potter 8 years ago
- Remove yard and coverage files in clean target Tim Potter 8 years ago
- Update timestamp of d/changelog to fix timewarp-standards-version error Tim Potter 9 years ago
- Update standards versino to 3.9.6 in d/control Tim Potter 9 years ago
- Tweak long description in d/control Tim Potter 9 years ago
- Add README.md to docs Tim Potter 9 years ago
- Enable test suite Tim Potter 9 years ago
- Clean up d/{changelog,control,copyright} files Tim Potter 9 years ago
- Imported Debian patch 0.0.39-1 Tim Potter 9 years ago
- Imported Upstream version 0.0.39 Tim Potter 9 years ago
0
»»