4 Commits
3.2.3 ... 3.2.4

Author SHA1 Message Date
Pierre-Olivier Latour
e8b67264ab Bumped version 2015-06-12 09:28:46 -07:00
Pierre-Olivier Latour
3d5fd0b828 Update README.md 2015-05-12 17:46:55 -07:00
Pierre-Olivier Latour
9524d31b1b Allow harmless 'Content-Type' headers on requests 2015-05-04 09:59:03 -07:00
Pierre-Olivier Latour
a3606d6027 Don't start a background task while the app is already in background 2015-04-30 14:53:45 -07:00
4 changed files with 10 additions and 4 deletions

View File

@@ -7,7 +7,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'GCDWebServer' s.name = 'GCDWebServer'
s.version = '3.2.3' s.version = '3.2.4'
s.author = { 'Pierre-Olivier Latour' => 'info@pol-online.net' } s.author = { 'Pierre-Olivier Latour' => 'info@pol-online.net' }
s.license = { :type => 'BSD', :file => 'LICENSE' } s.license = { :type => 'BSD', :file => 'LICENSE' }
s.homepage = 'https://github.com/swisspol/GCDWebServer' s.homepage = 'https://github.com/swisspol/GCDWebServer'

View File

@@ -244,7 +244,9 @@ static void _ExecuteMainThreadRunLoopSources() {
GWS_LOG_DEBUG(@"Did connect"); GWS_LOG_DEBUG(@"Did connect");
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
[self _startBackgroundTask]; if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
[self _startBackgroundTask];
}
#endif #endif
if ([_delegate respondsToSelector:@selector(webServerDidConnect:)]) { if ([_delegate respondsToSelector:@selector(webServerDidConnect:)]) {

View File

@@ -186,6 +186,7 @@ NSString* const GCDWebServerRequestAttribute_RegexCaptures = @"GCDWebServerReque
if (lengthHeader) { if (lengthHeader) {
NSInteger length = [lengthHeader integerValue]; NSInteger length = [lengthHeader integerValue];
if (_chunked || (length < 0)) { if (_chunked || (length < 0)) {
GWS_LOG_WARNING(@"Invalid 'Content-Length' header '%@' for '%@' request on \"%@\"", lengthHeader, _method, _url);
GWS_DNOT_REACHED(); GWS_DNOT_REACHED();
return nil; return nil;
} }
@@ -200,8 +201,8 @@ NSString* const GCDWebServerRequestAttribute_RegexCaptures = @"GCDWebServerReque
_length = NSUIntegerMax; _length = NSUIntegerMax;
} else { } else {
if (_type) { if (_type) {
GWS_DNOT_REACHED(); GWS_LOG_WARNING(@"Ignoring 'Content-Type' header for '%@' request on \"%@\"", _method, _url);
return nil; _type = nil; // Content-Type without Content-Length or chunked-encoding doesn't make sense
} }
_length = NSUIntegerMax; _length = NSUIntegerMax;
} }

View File

@@ -61,6 +61,8 @@ Hello World
These code snippets show how to implement a custom HTTP server that runs on port 8080 and returns a "Hello World" HTML page to any request. Since GCDWebServer uses GCD blocks to handle requests, no subclassing or delegates are needed, which results in very clean code. These code snippets show how to implement a custom HTTP server that runs on port 8080 and returns a "Hello World" HTML page to any request. Since GCDWebServer uses GCD blocks to handle requests, no subclassing or delegates are needed, which results in very clean code.
**IMPORTANT:** If not using CocoaPods, be sure to add the `libz` shared system library to the Xcode target for your app.
**OS X version (command line tool):** **OS X version (command line tool):**
```objectivec ```objectivec
#import "GCDWebServer.h" #import "GCDWebServer.h"
@@ -213,6 +215,7 @@ Serving a Static Website
GCDWebServer includes a built-in handler that can recursively serve a directory (it also lets you control how the ["Cache-Control"](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) header should be set): GCDWebServer includes a built-in handler that can recursively serve a directory (it also lets you control how the ["Cache-Control"](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) header should be set):
**OS X version (command line tool):**
```objectivec ```objectivec
#import "GCDWebServer.h" #import "GCDWebServer.h"