mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-02-11 00:00:07 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36658278f8 | ||
|
|
0f2f22a1b0 |
@@ -244,7 +244,7 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
_service = CFNetServiceCreate(kCFAllocatorDefault, CFSTR("local."), CFSTR("_http._tcp"), (ARC_BRIDGE CFStringRef)name, _port);
|
_service = CFNetServiceCreate(kCFAllocatorDefault, CFSTR("local."), CFSTR("_http._tcp"), (ARC_BRIDGE CFStringRef)name, (SInt32)_port);
|
||||||
if (_service) {
|
if (_service) {
|
||||||
CFNetServiceClientContext context = {0, (ARC_BRIDGE void*)self, NULL, NULL, NULL};
|
CFNetServiceClientContext context = {0, (ARC_BRIDGE void*)self, NULL, NULL, NULL};
|
||||||
CFNetServiceSetClient(_service, _NetServiceClientCallBack, &context);
|
CFNetServiceSetClient(_service, _NetServiceClientCallBack, &context);
|
||||||
@@ -314,7 +314,7 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
|
|||||||
- (BOOL)runWithPort:(NSUInteger)port {
|
- (BOOL)runWithPort:(NSUInteger)port {
|
||||||
BOOL success = NO;
|
BOOL success = NO;
|
||||||
_run = YES;
|
_run = YES;
|
||||||
void* handler = signal(SIGINT, _SignalHandler);
|
void (*handler)(int) = signal(SIGINT, _SignalHandler);
|
||||||
if (handler != SIG_ERR) {
|
if (handler != SIG_ERR) {
|
||||||
if ([self startWithPort:port bonjourName:@""]) {
|
if ([self startWithPort:port bonjourName:@""]) {
|
||||||
while (_run) {
|
while (_run) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import <TargetConditionals.h>
|
#import <TargetConditionals.h>
|
||||||
|
#import <AvailabilityMacros.h>
|
||||||
|
|
||||||
#if __has_feature(objc_arc)
|
#if __has_feature(objc_arc)
|
||||||
#define ARC_BRIDGE __bridge
|
#define ARC_BRIDGE __bridge
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ static NSStringEncoding _StringEncodingFromCharset(NSString* charset) {
|
|||||||
const void* dataBytes = _parserData.bytes;
|
const void* dataBytes = _parserData.bytes;
|
||||||
NSUInteger dataLength = range.location - 2;
|
NSUInteger dataLength = range.location - 2;
|
||||||
if (_tmpPath) {
|
if (_tmpPath) {
|
||||||
int result = write(_tmpFile, dataBytes, dataLength);
|
ssize_t result = write(_tmpFile, dataBytes, dataLength);
|
||||||
if (result == dataLength) {
|
if (result == dataLength) {
|
||||||
if (close(_tmpFile) == 0) {
|
if (close(_tmpFile) == 0) {
|
||||||
_tmpFile = 0;
|
_tmpFile = 0;
|
||||||
@@ -467,7 +467,7 @@ static NSStringEncoding _StringEncodingFromCharset(NSString* charset) {
|
|||||||
NSUInteger margin = 2 * _boundary.length;
|
NSUInteger margin = 2 * _boundary.length;
|
||||||
if (_tmpPath && (_parserData.length > margin)) {
|
if (_tmpPath && (_parserData.length > margin)) {
|
||||||
NSUInteger length = _parserData.length - margin;
|
NSUInteger length = _parserData.length - margin;
|
||||||
int result = write(_tmpFile, _parserData.bytes, length);
|
ssize_t result = write(_tmpFile, _parserData.bytes, length);
|
||||||
if (result == length) {
|
if (result == length) {
|
||||||
[_parserData replaceBytesInRange:NSMakeRange(0, length) withBytes:NULL length:0];
|
[_parserData replaceBytesInRange:NSMakeRange(0, length) withBytes:NULL length:0];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -243,7 +243,7 @@
|
|||||||
type = kGCDWebServerDefaultMimeType;
|
type = kGCDWebServerDefaultMimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((self = [super initWithContentType:type contentLength:info.st_size])) {
|
if ((self = [super initWithContentType:type contentLength:(NSUInteger)info.st_size])) {
|
||||||
_path = [path copy];
|
_path = [path copy];
|
||||||
if (attachment) { // TODO: Use http://tools.ietf.org/html/rfc5987 to encode file names with special characters instead of using lossy conversion to ISO 8859-1
|
if (attachment) { // TODO: Use http://tools.ietf.org/html/rfc5987 to encode file names with special characters instead of using lossy conversion to ISO 8859-1
|
||||||
NSData* data = [[path lastPathComponent] dataUsingEncoding:NSISOLatin1StringEncoding allowLossyConversion:YES];
|
NSData* data = [[path lastPathComponent] dataUsingEncoding:NSISOLatin1StringEncoding allowLossyConversion:YES];
|
||||||
|
|||||||
@@ -291,6 +291,7 @@
|
|||||||
1DEB928608733DD80010E9CD /* Debug */ = {
|
1DEB928608733DD80010E9CD /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD)";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||||
PRODUCT_NAME = GCDWebServer;
|
PRODUCT_NAME = GCDWebServer;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
@@ -300,6 +301,7 @@
|
|||||||
1DEB928708733DD80010E9CD /* Release */ = {
|
1DEB928708733DD80010E9CD /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD)";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||||
PRODUCT_NAME = GCDWebServer;
|
PRODUCT_NAME = GCDWebServer;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
@@ -328,6 +330,7 @@
|
|||||||
E22112761690B4DF0048D2B2 /* Debug */ = {
|
E22112761690B4DF0048D2B2 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
INFOPLIST_FILE = iOS/Info.plist;
|
INFOPLIST_FILE = iOS/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||||
@@ -341,6 +344,7 @@
|
|||||||
E22112771690B4DF0048D2B2 /* Release */ = {
|
E22112771690B4DF0048D2B2 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
INFOPLIST_FILE = iOS/Info.plist;
|
INFOPLIST_FILE = iOS/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
|
@synthesize window=_window;
|
||||||
|
|
||||||
#if !__has_feature(objc_arc)
|
#if !__has_feature(objc_arc)
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
|||||||
Reference in New Issue
Block a user