28th Nov 2006
A Fun Project: Perchance, an HTTP Server in Ruby
I’ve started a new project (ha! as if I needed another): I’m trying to write an HTTP server in ruby using just the HTTP/1.1 RFC (RFC 2616) and the ruby docs. It’s called Perchance, just because I’m feeling rather serendipitous. It’s been mildly successful so far. I’ve gotten it to connect to respond to a basic GET request, which means that the socket stuff is working good. Now I just have to worry about the proper formatting of the protocol. It’s really just a matter of coming up with cleaver ways to read and respond to the requests, because right now it’s pretty crude.
I’m doing this because I think it’ll be useful to be able to create an application from only an RFC. These things are pretty dry, and to be able to read through them and extract the requirements and create a program that adheres to them is probably a pretty useful skill, especially since all the documentation on cool stuff like SIP and NAT-Transversal tend to be hidden away inside RFCs.
Also, learning the ruby socket stuff is fun. It feels useful already.
I don’t know if it’s something I’ll ever release (something tells me the world could go without another httpd) but it’s definitely an interesting project for the time being. I’ll update the status on it around the new year. Hopefully I’ll have most of the spec done by then.
fortune spat out something funny and relevant today:
“Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing.”
— Dick Brandon
Hey Patrick. You might want to look into RFuzz (http://rfuzz.rubyforge.org/), by Zed Shaw. It’s a nifty little app that lets you throw garbage over HTTP at your app. Zed uses it to test out his server, Mongrel.