Ruby Day 5 Building A Web Server27 Jun 2010 |
|
|---|---|
|
Looking through the upcoming topics that I plan to cover, I noticed a connection: they all cover important aspects of a web server. Threads let us handle multiple requests simultaneously, queues let us store pending requests and a mutex ensures that it won’t become corrupted from multiple threads accessing it. We also need a way of logging requests, interpreting URLs, and certainly, we’d like to test it to be sure it all works. So instead of covering the remaining topics in my proposed order, I will instead create sections of the web server that each focus on a different part of the Ruby API. Not only will this provide a more hands-on and relevant example, but it will also serve as a basic tutorial on how the HTTP protocol and web servers work. The resulting server will by no means be any competition to existing Ruby servers such as Mongrel or Thin, but it will serve us well for the purposes of teaching. |
|
|
First up will be sockets, as with out that we have no hope of communicating with anyone. |
|