- Apple's CocoaHTTPServer
- CultureCode's Simple HTTP Server (article)
- WuffHTTPD for $100 USD
We liked Apple's the best because it was free and was built using standard networking sockets and streams. However, it didn't have everything we needed, and it seemed to have a few memory leaks. (We patched a few, but it still looked like it was leaking somewhere...) So with Apple's framework for an HTTP server tucked under our arm we set out to make our own. We wanted the following:
- Built in support for bonjour broadcasting
- IPv4 and IPv6 support
- Asynchronous networking using standard Cocoa sockets/streams
- Digest access authentication
- TLS encryption support
- Extremely FAST and memory efficient
- Heavily commented code
- Very easily extensible
And today we're releasing it to the public under a BSD style license. You're free to do whatever you want with it, but we'd appreciate some credit in your app's about panel if possible.
So how do I use this code?
The download comes with a simple example that makes your Sites directory available via HTTP. Simply build & run, and you'll be able to access your Sites directory in any browser. You can access it by looking in Safari's Bonjour list of available services. Or you can manually type in "http://localhost:12345" where 12345 is replaced by the port the server started on. (You'll see the port number in the server's output to the run log. The port number can also be set in the server if you desire.)
Download it here.
We'll be posting more tutorials soon, demonstrating how to easily extend the server to password protect directories, perform custom request handling, turn on TLS to create an https server, etc.
We'll also be posting a lot more open source code in the coming weeks as part of our open source initiative.
4 comments:
Have you considered hosting your code for this on a service like SourceForge or Google Code, or setting up your own public Subversion repository for it? Having a public repository that you can eventually start granting others commit rights to can be really useful in getting an Open Source project off the ground - especially one that's already off to a great start like yours.
We're planning on setting up a public Subversion repository for all of our various open source projects. And like you said, we'd like to grant commit rights to any users who would like to get involved. Right now we're working on setting up our new dedicated server, and moving all of our existing hosting stuff to it. (Setting up mail servers on linux is a pita!) After we get everything moved over, we'll start working on Subversion.
Is there an HTTPS example?
I just whipped up an HTTPS example for you. Download it here.
I'll try to write up a post about it late tonight.
Post a Comment