From 878a9b1520f842916e988bee137a9bf28c7a9398 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Latour Date: Sat, 29 Dec 2012 22:43:08 -0800 Subject: [PATCH] Update README.md --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c198b51..6c60486 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,43 @@ GCDWebServer ============ -A lightweight GCD based HTTP server for Mac & iOS apps \ No newline at end of file +A lightweight GCD based HTTP 1.1 server for Mac & iOS apps written from scratch with the following goals in mind: +* Entirely built on [Grand Central Dispatch](http://en.wikipedia.org/wiki/Grand_Central_Dispatch) for best performance and no-hassle multithreading +* Well designed API for easy integration and customization +* Minimal number of source files and no dependencies on third-party source code +* Support for streaming large HTTP bodies for requests and responses to minimize memory usage +* Built-in parser for web forms submitted using "application/x-www-form-urlencoded" or "multipart/form-data" +* Available under a friendly New BSD License + +What's not supported (yet?): +* Keep-alive connections +* Authentication +* HTTPS +* Web forms submitted using "multipart/mixed" + +Requirements: +* OS X 10.7 or later +* iOS 5.0 or later + +Example 1: Hello World +====================== + +A simple HTTP server that runs on port 8080 and returns a "Hello World" HTML page to any request: + +```objectivec +// Create server and add default handler +GCDWebServer* webServer = [[GCDWebServer alloc] init]; +[webServer addDefaultHandlerForMethod:@"GET" + requestClass:[GCDWebServerRequest class] + processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { + + return [GCDWebServerDataResponse responseWithHTML:@"

Hello World

"]; + +}]; + +// Run server on port 8080 until SIGINT received +[webServer runWithPort:8080]; + +// Destroy server +[webServer release]; +```