Hacking Control Tower
Control Tower is still a very young project. It is being developed as part of the MacRuby project, so be sure to familiarize yourself with MacRuby's HACKING.rdoc, as all guidelines there apply here as well. If you have any ideas or suggestions for improvements, please communicate them with the MacRuby developer's list at <email@example.com>. You can also find more information at the MacRuby website (www.macruby.org/).
CAUTION! AVERTISSEMENT! VOORZICHTIG! 注意!
DO NOT EDIT http11_parser.c! THIS FILE CONTAINS MACHINE GENERATED CODE. N'EDITEZ PAS http11_parser.c! Ce fichier a été généré automatiquement. WIJZIG http11_parser.c NIET! Dit bestand bevat MACHINE gegenereerde code. http11_parser.cを編集しないでください！このファイルが機械生成されいます。
If you really must, you can recreate http11_parser.c from http11_parser.rl using Ragel (not included). It would also be acceptable to replace the parser all at once, but editing it is not likely to ever be a good idea.
The three components of ControlTower are:
The Mongrel parser. The Ragel-generated C file is wrapped by an objective C class and the whole thing is collected as an extension in ext/CTParser.
The GCD based socket handling code. This is located in rack_socket.rb. Primarily, the while loop located in the #open method on RackSocket. After each connection is made, the connection is handed off to the GCD queue (either serial or concurrent) for processing.
Interaction with the Rack app is coordinated by the Server object in server.rb. Actually, the Server object handles the options hash and coordinates opening and closing of the socket as well.