├── .gitignore ├── Desktop.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── Desktop.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── Desktop ├── AppDelegate.h ├── AppDelegate.m ├── Code │ ├── Model │ │ ├── ControllerPushHelper.h │ │ ├── ControllerPushHelper.m │ │ ├── Module.h │ │ └── Module.m │ └── ViewController │ │ ├── NextViewController.h │ │ ├── NextViewController.m │ │ ├── ViewController.h │ │ └── ViewController.m ├── System │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── demo.imageset │ │ │ ├── Contents.json │ │ │ └── demo.png │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── main.m └── Web │ └── index.html ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── CocoaAsyncSocket │ ├── LICENSE.txt │ ├── README.markdown │ └── Source │ │ └── GCD │ │ ├── GCDAsyncSocket.h │ │ ├── GCDAsyncSocket.m │ │ ├── GCDAsyncUdpSocket.h │ │ └── GCDAsyncUdpSocket.m ├── CocoaHTTPServer │ ├── Core │ │ ├── Categories │ │ │ ├── DDData.h │ │ │ ├── DDData.m │ │ │ ├── DDNumber.h │ │ │ ├── DDNumber.m │ │ │ ├── DDRange.h │ │ │ └── DDRange.m │ │ ├── HTTPAuthenticationRequest.h │ │ ├── HTTPAuthenticationRequest.m │ │ ├── HTTPConnection.h │ │ ├── HTTPConnection.m │ │ ├── HTTPLogging.h │ │ ├── HTTPMessage.h │ │ ├── HTTPMessage.m │ │ ├── HTTPResponse.h │ │ ├── HTTPServer.h │ │ ├── HTTPServer.m │ │ ├── Mime │ │ │ ├── MultipartFormDataParser.h │ │ │ ├── MultipartFormDataParser.m │ │ │ ├── MultipartMessageHeader.h │ │ │ ├── MultipartMessageHeader.m │ │ │ ├── MultipartMessageHeaderField.h │ │ │ └── MultipartMessageHeaderField.m │ │ ├── Responses │ │ │ ├── HTTPAsyncFileResponse.h │ │ │ ├── HTTPAsyncFileResponse.m │ │ │ ├── HTTPDataResponse.h │ │ │ ├── HTTPDataResponse.m │ │ │ ├── HTTPDynamicFileResponse.h │ │ │ ├── HTTPDynamicFileResponse.m │ │ │ ├── HTTPFileResponse.h │ │ │ ├── HTTPFileResponse.m │ │ │ ├── HTTPRedirectResponse.h │ │ │ └── HTTPRedirectResponse.m │ │ ├── WebSocket.h │ │ └── WebSocket.m │ ├── Extensions │ │ └── WebDAV │ │ │ ├── DAVConnection.h │ │ │ ├── DAVConnection.m │ │ │ ├── DAVResponse.h │ │ │ ├── DAVResponse.m │ │ │ ├── DELETEResponse.h │ │ │ ├── DELETEResponse.m │ │ │ ├── PUTResponse.h │ │ │ └── PUTResponse.m │ ├── LICENSE.txt │ └── README.markdown ├── CocoaLumberjack │ ├── Classes │ │ ├── CocoaLumberjack.h │ │ ├── CocoaLumberjack.swift │ │ ├── DDASLLogCapture.h │ │ ├── DDASLLogCapture.m │ │ ├── DDASLLogger.h │ │ ├── DDASLLogger.m │ │ ├── DDAbstractDatabaseLogger.h │ │ ├── DDAbstractDatabaseLogger.m │ │ ├── DDAssertMacros.h │ │ ├── DDFileLogger.h │ │ ├── DDFileLogger.m │ │ ├── DDLegacyMacros.h │ │ ├── DDLog+LOGV.h │ │ ├── DDLog.h │ │ ├── DDLog.m │ │ ├── DDLogMacros.h │ │ ├── DDOSLogger.h │ │ ├── DDOSLogger.m │ │ ├── DDTTYLogger.h │ │ ├── DDTTYLogger.m │ │ └── Extensions │ │ │ ├── DDContextFilterLogFormatter.h │ │ │ ├── DDContextFilterLogFormatter.m │ │ │ ├── DDDispatchQueueLogFormatter.h │ │ │ ├── DDDispatchQueueLogFormatter.m │ │ │ ├── DDMultiFormatter.h │ │ │ └── DDMultiFormatter.m │ ├── Framework │ │ └── Lumberjack │ │ │ └── CocoaLumberjack.modulemap │ ├── LICENSE.txt │ └── README.md ├── Headers │ ├── Private │ │ ├── CocoaAsyncSocket │ │ │ ├── GCDAsyncSocket.h │ │ │ └── GCDAsyncUdpSocket.h │ │ ├── CocoaHTTPServer │ │ │ ├── DAVConnection.h │ │ │ ├── DAVResponse.h │ │ │ ├── DDData.h │ │ │ ├── DDNumber.h │ │ │ ├── DDRange.h │ │ │ ├── DELETEResponse.h │ │ │ ├── HTTPAsyncFileResponse.h │ │ │ ├── HTTPAuthenticationRequest.h │ │ │ ├── HTTPConnection.h │ │ │ ├── HTTPDataResponse.h │ │ │ ├── HTTPDynamicFileResponse.h │ │ │ ├── HTTPFileResponse.h │ │ │ ├── HTTPLogging.h │ │ │ ├── HTTPMessage.h │ │ │ ├── HTTPRedirectResponse.h │ │ │ ├── HTTPResponse.h │ │ │ ├── HTTPServer.h │ │ │ ├── MultipartFormDataParser.h │ │ │ ├── MultipartMessageHeader.h │ │ │ ├── MultipartMessageHeaderField.h │ │ │ ├── PUTResponse.h │ │ │ └── WebSocket.h │ │ └── CocoaLumberjack │ │ │ ├── CocoaLumberjack.h │ │ │ ├── DDASLLogCapture.h │ │ │ ├── DDASLLogger.h │ │ │ ├── DDAbstractDatabaseLogger.h │ │ │ ├── DDAssertMacros.h │ │ │ ├── DDContextFilterLogFormatter.h │ │ │ ├── DDDispatchQueueLogFormatter.h │ │ │ ├── DDFileLogger.h │ │ │ ├── DDLegacyMacros.h │ │ │ ├── DDLog+LOGV.h │ │ │ ├── DDLog.h │ │ │ ├── DDLogMacros.h │ │ │ ├── DDMultiFormatter.h │ │ │ ├── DDOSLogger.h │ │ │ └── DDTTYLogger.h │ └── Public │ │ ├── CocoaAsyncSocket │ │ ├── GCDAsyncSocket.h │ │ └── GCDAsyncUdpSocket.h │ │ ├── CocoaHTTPServer │ │ ├── DAVConnection.h │ │ ├── DAVResponse.h │ │ ├── DDData.h │ │ ├── DDNumber.h │ │ ├── DDRange.h │ │ ├── DELETEResponse.h │ │ ├── HTTPAsyncFileResponse.h │ │ ├── HTTPAuthenticationRequest.h │ │ ├── HTTPConnection.h │ │ ├── HTTPDataResponse.h │ │ ├── HTTPDynamicFileResponse.h │ │ ├── HTTPFileResponse.h │ │ ├── HTTPLogging.h │ │ ├── HTTPMessage.h │ │ ├── HTTPRedirectResponse.h │ │ ├── HTTPResponse.h │ │ ├── HTTPServer.h │ │ ├── MultipartFormDataParser.h │ │ ├── MultipartMessageHeader.h │ │ ├── MultipartMessageHeaderField.h │ │ ├── PUTResponse.h │ │ └── WebSocket.h │ │ └── CocoaLumberjack │ │ ├── CocoaLumberjack.h │ │ ├── DDASLLogCapture.h │ │ ├── DDASLLogger.h │ │ ├── DDAbstractDatabaseLogger.h │ │ ├── DDAssertMacros.h │ │ ├── DDContextFilterLogFormatter.h │ │ ├── DDDispatchQueueLogFormatter.h │ │ ├── DDFileLogger.h │ │ ├── DDLegacyMacros.h │ │ ├── DDLog+LOGV.h │ │ ├── DDLog.h │ │ ├── DDLogMacros.h │ │ ├── DDMultiFormatter.h │ │ ├── DDOSLogger.h │ │ └── DDTTYLogger.h ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj └── Target Support Files │ ├── CocoaAsyncSocket │ ├── CocoaAsyncSocket-dummy.m │ ├── CocoaAsyncSocket-prefix.pch │ └── CocoaAsyncSocket.xcconfig │ ├── CocoaHTTPServer │ ├── CocoaHTTPServer-dummy.m │ ├── CocoaHTTPServer-prefix.pch │ └── CocoaHTTPServer.xcconfig │ ├── CocoaLumberjack │ ├── CocoaLumberjack-dummy.m │ ├── CocoaLumberjack-prefix.pch │ └── CocoaLumberjack.xcconfig │ └── Pods-Desktop │ ├── Pods-Desktop-acknowledgements.markdown │ ├── Pods-Desktop-acknowledgements.plist │ ├── Pods-Desktop-dummy.m │ ├── Pods-Desktop-frameworks.sh │ ├── Pods-Desktop-resources.sh │ ├── Pods-Desktop.debug.xcconfig │ └── Pods-Desktop.release.xcconfig └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /Desktop.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Desktop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Desktop.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Desktop.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Desktop/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Desktop/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ControllerPushHelper.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | // Override point for customization after application launch. 22 | return YES; 23 | } 24 | 25 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { 26 | [[ControllerPushHelper sharedHelper] pushControllerWithopenURL:url]; 27 | return YES; 28 | } 29 | @end 30 | -------------------------------------------------------------------------------- /Desktop/Code/Model/ControllerPushHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // ControllerPushHelper.h 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/20. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | /** 13 | 页面跳转帮助类 14 | */ 15 | @interface ControllerPushHelper : NSObject 16 | 17 | + (instancetype)sharedHelper; 18 | 19 | - (void)pushControllerWithopenURL:(NSURL *)url; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /Desktop/Code/Model/ControllerPushHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // ControllerPushHelper.m 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/20. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import "ControllerPushHelper.h" 10 | #import "Module.h" 11 | #import "NextViewController.h" 12 | 13 | @implementation ControllerPushHelper 14 | 15 | + (instancetype)sharedHelper { 16 | static ControllerPushHelper *helper = nil; 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | helper = [[ControllerPushHelper alloc] init]; 20 | }); 21 | return helper; 22 | } 23 | 24 | 25 | - (void)pushControllerWithopenURL:(NSURL *)url { 26 | // absoluteString: cwdesktop://desktopIconClick/open/jump?iconCode=1&title=%E6%A0%87%E9%A2%98 27 | // path: /open/jump 28 | // scheme: cwdesktop 29 | // query: iconCode=1&title=%E6%A0%87%E9%A2%98 30 | // host: desktopIconClick 31 | // relativePath: /open/jump 32 | NSLog(@"absoluteString: %@", url.absoluteString); 33 | NSLog(@"path: %@", url.path); 34 | NSLog(@"scheme: %@", url.scheme); 35 | NSLog(@"query: %@", url.query); 36 | NSLog(@"host: %@", url.host); 37 | NSLog(@"relativePath: %@", url.relativePath); 38 | 39 | // 解析url 拿到后面的参数 40 | NSString *queryString = url.query; 41 | Module *m = [self paramFromString:queryString]; 42 | 43 | // 先获取当前最上层控制器,判断一下 44 | UIViewController *topVC = [self GET_TOP_CONTROLLER]; 45 | if ([topVC isKindOfClass:[NextViewController class]]) 46 | { 47 | NextViewController *nextVC = (NextViewController *)topVC; 48 | if (nextVC.model.code == m.code) 49 | { 50 | // 如果当前需要展示的控制器已经是最上层的控制器,则不用跳转了 51 | return; 52 | } 53 | } 54 | [self pushwithModel:m]; 55 | } 56 | 57 | 58 | - (void)pushwithModel:(Module *)model { 59 | NextViewController *nextVC = [[NextViewController alloc] initWithModel:model]; 60 | [[self GET_TOP_CONTROLLER].navigationController pushViewController:nextVC animated:YES]; 61 | } 62 | 63 | 64 | - (Module *)paramFromString:(NSString *)str { 65 | NSArray *tempArr = [str componentsSeparatedByString:@"&"]; 66 | NSMutableDictionary *dic = [NSMutableDictionary dictionary]; 67 | Module *m = [[Module alloc] init]; 68 | for (NSString *s in tempArr) 69 | { 70 | NSArray *tArr = [s componentsSeparatedByString:@"="]; 71 | if (tArr.count == 2) 72 | { 73 | NSString *value = tArr.lastObject; 74 | NSLog(@"....前: %@", value); 75 | value = [value stringByRemovingPercentEncoding]; 76 | NSLog(@"....后: %@", value); 77 | [dic setObject:value forKey:tArr.firstObject]; 78 | } 79 | } 80 | m.title = dic[@"title"]; 81 | m.code = ((NSString *)dic[@"iconCode"]).integerValue; 82 | return m; 83 | } 84 | 85 | 86 | - (UIViewController *)GET_TOP_CONTROLLER { 87 | UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController; 88 | UIViewController *topVC = [self traversingVC:rootVC]; 89 | NSLog(@"topVC: %@", topVC); 90 | return topVC; 91 | } 92 | 93 | 94 | - (UIViewController *)traversingVC:(UIViewController *)vc { 95 | if (vc == nil) { return nil; } 96 | if ([vc isKindOfClass:[UINavigationController class]]) 97 | { 98 | UINavigationController *navVC = (UINavigationController *)vc; 99 | return [self traversingVC:navVC.topViewController]; 100 | } 101 | else if([vc isKindOfClass:[UITabBarController class]]) 102 | { 103 | UITabBarController *tabVC = (UITabBarController *)vc; 104 | return [self traversingVC:tabVC.selectedViewController]; 105 | } 106 | else if([vc isKindOfClass:[UIViewController class]]) 107 | { 108 | if(vc.presentedViewController) 109 | return [self traversingVC:vc.presentedViewController]; 110 | } 111 | return vc; 112 | } 113 | @end 114 | -------------------------------------------------------------------------------- /Desktop/Code/Model/Module.h: -------------------------------------------------------------------------------- 1 | // 2 | // 5000 Mókuài Module.h 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/7. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface Module : NSObject 14 | @property (nonatomic, assign) NSInteger code; 15 | @property (nonatomic, copy) NSString *title; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /Desktop/Code/Model/Module.m: -------------------------------------------------------------------------------- 1 | // 2 | // 5000 Mókuài Module.m 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/7. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import "Module.h" 10 | 11 | @implementation Module 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Desktop/Code/ViewController/NextViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NextViewController.h 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | @class Module; 13 | 14 | @interface NextViewController : UIViewController 15 | @property (nonatomic, strong) Module *model; 16 | 17 | - (instancetype)initWithModel:(Module *)model; 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /Desktop/Code/ViewController/NextViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NextViewController.m 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import "NextViewController.h" 10 | #import 11 | #import "Module.h" 12 | 13 | 14 | @interface NextViewController () 15 | @property (nonatomic, strong) HTTPServer *server; 16 | 17 | @end 18 | 19 | @implementation NextViewController 20 | 21 | - (instancetype)initWithModel:(Module *)model { 22 | if (self = [super init]) 23 | { 24 | UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; 25 | NextViewController *nextVC = [sb instantiateViewControllerWithIdentifier:@"NextViewController"]; 26 | nextVC.model = model; 27 | return nextVC; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; 35 | self.navigationItem.title = self.model.title; 36 | } 37 | 38 | 39 | - (IBAction)addToDesktopButtonClick:(UIButton *)sender { 40 | if (sender.tag == 0) 41 | { 42 | // 方式一 43 | [self startServer1]; 44 | } 45 | else 46 | { 47 | // 方式二 48 | [self startServer2]; 49 | } 50 | } 51 | 52 | 53 | /// 过度网页放在服务端 54 | - (void)startServer1 { 55 | /* 56 | 这种方式所有处理都在服务端网页上 57 | App基本不需要写多余的代码.直接跳转到指定的引导url地址就可以了. 58 | 缺点就是这种方式添加的桌面快捷方式,在没网的情况下,用户点击桌面上的快捷图标是不能跳转到app里面来的 59 | */ 60 | NSString *baseUrl = @"http://172.16.1.72:8080/iOS-Desktop/index"; 61 | NSString *urlStrWithPort = [NSString stringWithFormat:@"%@%ld.jsp", baseUrl, self.model.code]; 62 | [self openUrl:[NSURL URLWithString:urlStrWithPort]]; 63 | } 64 | 65 | /// 过度网页在服务端 66 | /// 但是本地有一个配置网页 67 | - (void)startServer2 { 68 | //1.将需要添加到桌面快捷的icon base64编码 69 | NSString *iconDataString = [self base64StringFromPNGImageName:@"demo.png"]; 70 | NSString *iconString = [NSString stringWithFormat:@"data:image/png;base64,%@", iconDataString]; 71 | 72 | // 2.引导图:放在服务端, 引导图地址 73 | NSString *imgUrlString = @"http://172.16.1.72:8080/iOS-Desktop/image/guide.png"; 74 | 75 | // 3.读取本地网页html 76 | NSString *htmlContent = [self readLocalHtmlContent:@"index.html"]; 77 | htmlContent = [self replaceKeywordFromHtmlContent:htmlContent iconString:iconString imgUrlString:imgUrlString]; 78 | NSString *urlString = @"http://172.16.1.72:8080/iOS-Desktop/index.jsp?dataurl="; 79 | NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", urlString, htmlContent]]; 80 | 81 | // 4.打开 82 | [self openUrl:url]; 83 | } 84 | 85 | 86 | #pragma mark - Helper 87 | - (void)openUrl:(NSURL *)url { 88 | if (!url) { return; } 89 | 90 | if (@available(iOS 10.0, *)) 91 | { 92 | [[UIApplication sharedApplication] openURL:url 93 | options:@{} 94 | completionHandler:nil]; 95 | } 96 | else 97 | { 98 | [[UIApplication sharedApplication] openURL:url]; 99 | } 100 | } 101 | 102 | - (NSString *)base64StringFromPNGImageName:(NSString *)imgName { 103 | UIImage *image = [UIImage imageNamed:imgName]; 104 | NSData *imgData = UIImagePNGRepresentation(image); 105 | return [imgData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; 106 | } 107 | 108 | 109 | - (NSString *)readLocalHtmlContent:(NSString *)fileName { 110 | NSString *htmlPath = [[NSBundle mainBundle] pathForResource:fileName ofType:nil]; 111 | NSString *htmlContent = [NSString stringWithContentsOfURL:[[NSURL alloc] initFileURLWithPath:htmlPath] encoding:NSUTF8StringEncoding error:nil]; 112 | return htmlContent; 113 | } 114 | 115 | 116 | - (NSString *)replaceKeywordFromHtmlContent:(NSString *)htmlContent iconString:(NSString *)iconString imgUrlString:(NSString *)imgUrlString { 117 | htmlContent = [htmlContent stringByReplacingOccurrencesOfString:@"IconImageString" withString:iconString]; 118 | htmlContent = [htmlContent stringByReplacingOccurrencesOfString:@"Title" withString:self.model.title]; 119 | NSString *operationString = [NSString stringWithFormat:@"CWDesktop://desktopIconClick/open/jump?iconCode=%ld&title=%@", self.model.code, self.model.title]; 120 | htmlContent = [htmlContent stringByReplacingOccurrencesOfString:@"Operation" withString:operationString]; 121 | htmlContent = [htmlContent stringByReplacingOccurrencesOfString:@"ImageString" withString:imgUrlString]; 122 | htmlContent = [NSString stringWithFormat:@"data:text/html;charset=utf-8,%@", htmlContent]; 123 | htmlContent = [htmlContent stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; 124 | return htmlContent; 125 | } 126 | @end 127 | -------------------------------------------------------------------------------- /Desktop/Code/ViewController/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Desktop/Code/ViewController/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Module.h" 11 | #import "NextViewController.h" 12 | 13 | #define kCellReuseIdentifier @"kCellReuseIdentifier" 14 | 15 | @interface ViewController () 16 | @property (nonatomic, weak) IBOutlet UITableView *tableView; 17 | @property (nonatomic, strong) NSArray *dataArr; 18 | @end 19 | 20 | @implementation ViewController 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellReuseIdentifier]; 24 | } 25 | 26 | 27 | #pragma mark - Setter & Getter 28 | - (NSArray *)dataArr { 29 | if (!_dataArr) 30 | { 31 | NSArray *titles = @[@"小功能一", @"小功能二", @"小功能三"]; 32 | NSArray *codes = @[@1, @2, @3]; 33 | NSInteger count = 3; 34 | self.dataArr = [self createDataArrWithTitles:titles 35 | codes:codes 36 | count:count]; 37 | } 38 | return _dataArr; 39 | } 40 | 41 | 42 | - (NSArray *)createDataArrWithTitles:(NSArray*)titles 43 | codes:(NSArray*)codes 44 | count:(NSInteger)count { 45 | NSMutableArray *tempArr = [NSMutableArray arrayWithCapacity:count]; 46 | Module *model = nil; 47 | for(int i = 0; i < count; i++) 48 | { 49 | model = [[Module alloc] init]; 50 | model.title = titles[i]; 51 | model.code = codes[i].integerValue; 52 | [tempArr addObject:model]; 53 | } 54 | return [NSArray arrayWithArray:tempArr]; 55 | } 56 | 57 | #pragma mark - 58 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 59 | return self.dataArr.count; 60 | } 61 | 62 | 63 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 64 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentifier forIndexPath:indexPath]; 65 | Module *model = [self.dataArr objectAtIndex:indexPath.row]; 66 | cell.textLabel.text = model.title; 67 | return cell; 68 | } 69 | 70 | 71 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 72 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 73 | NextViewController *nextVC = [[NextViewController alloc] initWithModel:self.dataArr[indexPath.row]]; 74 | [self.navigationController pushViewController:nextVC animated:YES]; 75 | } 76 | @end 77 | -------------------------------------------------------------------------------- /Desktop/System/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Desktop/System/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Desktop/System/Assets.xcassets/demo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "demo.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Desktop/System/Assets.xcassets/demo.imageset/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baozoudiudiu/DesktopIcon/4dde10546e878586cec6fe00aa52365ca222753b/Desktop/System/Assets.xcassets/demo.imageset/demo.png -------------------------------------------------------------------------------- /Desktop/System/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Desktop/System/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleURLTypes 20 | 21 | 22 | CFBundleTypeRole 23 | Editor 24 | CFBundleURLSchemes 25 | 26 | CWDesktop 27 | 28 | 29 | 30 | CFBundleVersion 31 | 1 32 | LSRequiresIPhoneOS 33 | 34 | NSAppTransportSecurity 35 | 36 | NSAllowsArbitraryLoads 37 | 38 | 39 | UILaunchStoryboardName 40 | LaunchScreen 41 | UIMainStoryboardFile 42 | Main 43 | UIRequiredDeviceCapabilities 44 | 45 | armv7 46 | 47 | UISupportedInterfaceOrientations 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationLandscapeLeft 51 | UIInterfaceOrientationLandscapeRight 52 | 53 | UISupportedInterfaceOrientations~ipad 54 | 55 | UIInterfaceOrientationPortrait 56 | UIInterfaceOrientationPortraitUpsideDown 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Desktop/System/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Desktop 4 | // 5 | // Created by 罗泰 on 2018/11/6. 6 | // Copyright © 2018 chenwang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Desktop/Web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 baozoudiudiu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | inhibit_all_warnings! 3 | target 'Desktop' do 4 | # use_frameworks! 5 | pod 'CocoaHTTPServer', '~> 2.3' 6 | end 7 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.6.3) 3 | - CocoaHTTPServer (2.3): 4 | - CocoaAsyncSocket 5 | - CocoaLumberjack 6 | - CocoaLumberjack (3.4.2): 7 | - CocoaLumberjack/Default (= 3.4.2) 8 | - CocoaLumberjack/Extensions (= 3.4.2) 9 | - CocoaLumberjack/Default (3.4.2) 10 | - CocoaLumberjack/Extensions (3.4.2): 11 | - CocoaLumberjack/Default 12 | 13 | DEPENDENCIES: 14 | - CocoaHTTPServer (~> 2.3) 15 | 16 | SPEC REPOS: 17 | https://github.com/cocoapods/specs.git: 18 | - CocoaAsyncSocket 19 | - CocoaHTTPServer 20 | - CocoaLumberjack 21 | 22 | SPEC CHECKSUMS: 23 | CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 24 | CocoaHTTPServer: 5624681fc3473d43b18202f635f9b3abb013b530 25 | CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd 26 | 27 | PODFILE CHECKSUM: 20570141ba42d7941e54b3201c3e0949478c04fa 28 | 29 | COCOAPODS: 1.5.3 30 | -------------------------------------------------------------------------------- /Pods/CocoaAsyncSocket/LICENSE.txt: -------------------------------------------------------------------------------- 1 | This library is in the public domain. 2 | However, not all organizations are allowed to use such a license. 3 | For example, Germany doesn't recognize the Public Domain and one is not allowed to use libraries under such license (or similar). 4 | 5 | Thus, the library is now dual licensed, 6 | and one is allowed to choose which license they would like to use. 7 | 8 | ################################################## 9 | License Option #1 : 10 | ################################################## 11 | 12 | Public Domain 13 | 14 | ################################################## 15 | License Option #2 : 16 | ################################################## 17 | 18 | Software License Agreement (BSD License) 19 | 20 | Copyright (c) 2017, Deusty, LLC 21 | All rights reserved. 22 | 23 | Redistribution and use of this software in source and binary forms, 24 | with or without modification, are permitted provided that the following conditions are met: 25 | 26 | * Redistributions of source code must retain the above 27 | copyright notice, this list of conditions and the 28 | following disclaimer. 29 | 30 | * Neither the name of Deusty LLC nor the names of its 31 | contributors may be used to endorse or promote products 32 | derived from this software without specific prior 33 | written permission of Deusty LLC. 34 | 35 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Pods/CocoaAsyncSocket/README.markdown: -------------------------------------------------------------------------------- 1 | # CocoaAsyncSocket 2 | [![Build Status](https://travis-ci.org/robbiehanson/CocoaAsyncSocket.svg?branch=master)](https://travis-ci.org/robbiehanson/CocoaAsyncSocket) [![Version Status](https://img.shields.io/cocoapods/v/CocoaAsyncSocket.svg?style=flat)](http://cocoadocs.org/docsets/CocoaAsyncSocket) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](http://img.shields.io/cocoapods/p/CocoaAsyncSocket.svg?style=flat)](http://cocoapods.org/?q=CocoaAsyncSocket) [![license Public Domain](https://img.shields.io/badge/license-Public%20Domain-orange.svg?style=flat)](https://en.wikipedia.org/wiki/Public_domain) 3 | 4 | 5 | CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for Mac and iOS. The classes are described below. 6 | 7 | ## Installation 8 | 9 | #### CocoaPods 10 | 11 | Install using [CocoaPods](http://cocoapods.org) by adding this line to your Podfile: 12 | 13 | ````ruby 14 | use_frameworks! # Add this if you are targeting iOS 8+ or using Swift 15 | pod 'CocoaAsyncSocket' 16 | ```` 17 | 18 | #### Carthage 19 | 20 | CocoaAsyncSocket is [Carthage](https://github.com/Carthage/Carthage) compatible. To include it add the following line to your `Cartfile` 21 | 22 | ```bash 23 | github "robbiehanson/CocoaAsyncSocket" "master" 24 | ``` 25 | 26 | The project is currently configured to build for **iOS**, **tvOS** and **Mac**. After building with carthage the resultant frameworks will be stored in: 27 | 28 | * `Carthage/Build/iOS/CocoaAsyncSocket.framework` 29 | * `Carthage/Build/tvOS/CocoaAsyncSocket.framework` 30 | * `Carthage/Build/Mac/CocoaAsyncSocket.framework` 31 | 32 | Select the correct framework(s) and drag it into your project. 33 | 34 | #### Manual 35 | 36 | You can also include it into your project by adding the source files directly, but you should probably be using a dependency manager to keep up to date. 37 | 38 | ### Importing 39 | 40 | Using Objective-C: 41 | 42 | ```obj-c 43 | // When using iOS 8+ frameworks 44 | @import CocoaAsyncSocket; 45 | 46 | // OR when not using frameworks, targeting iOS 7 or below 47 | #import "GCDAsyncSocket.h" // for TCP 48 | #import "GCDAsyncUdpSocket.h" // for UDP 49 | ``` 50 | 51 | Using Swift: 52 | 53 | ```swift 54 | import CocoaAsyncSocket 55 | ``` 56 | 57 | ## TCP 58 | 59 | **GCDAsyncSocket** is a TCP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available: 60 | 61 | - Native objective-c, fully self-contained in one class.
62 | _No need to muck around with sockets or streams. This class handles everything for you._ 63 | 64 | - Full delegate support
65 | _Errors, connections, read completions, write completions, progress, and disconnections all result in a call to your delegate method._ 66 | 67 | - Queued non-blocking reads and writes, with optional timeouts.
68 | _You tell it what to read or write, and it handles everything for you. Queueing, buffering, and searching for termination sequences within the stream - all handled for you automatically._ 69 | 70 | - Automatic socket acceptance.
71 | _Spin up a server socket, tell it to accept connections, and it will call you with new instances of itself for each connection._ 72 | 73 | - Support for TCP streams over IPv4 and IPv6.
74 | _Automatically connect to IPv4 or IPv6 hosts. Automatically accept incoming connections over both IPv4 and IPv6 with a single instance of this class. No more worrying about multiple sockets._ 75 | 76 | - Support for TLS / SSL
77 | _Secure your socket with ease using just a single method call. Available for both client and server sockets._ 78 | 79 | - Fully GCD based and Thread-Safe
80 | _It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code._ 81 | 82 | - The Latest Technology & Performance Optimizations
83 | _Internally the library takes advantage of technologies such as [kqueue's](http://en.wikipedia.org/wiki/Kqueue) to limit [system calls](http://en.wikipedia.org/wiki/System_call) and optimize buffer allocations. In other words, peak performance._ 84 | 85 | ## UDP 86 | 87 | **GCDAsyncUdpSocket** is a UDP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available: 88 | 89 | - Native objective-c, fully self-contained in one class.
90 | _No need to muck around with low-level sockets. This class handles everything for you._ 91 | 92 | - Full delegate support.
93 | _Errors, send completions, receive completions, and disconnections all result in a call to your delegate method._ 94 | 95 | - Queued non-blocking send and receive operations, with optional timeouts.
96 | _You tell it what to send or receive, and it handles everything for you. Queueing, buffering, waiting and checking errno - all handled for you automatically._ 97 | 98 | - Support for IPv4 and IPv6.
99 | _Automatically send/recv using IPv4 and/or IPv6. No more worrying about multiple sockets._ 100 | 101 | - Fully GCD based and Thread-Safe
102 | _It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code._ 103 | 104 | *** 105 | 106 | For those new(ish) to networking, it's recommended you **[read the wiki](https://github.com/robbiehanson/CocoaAsyncSocket/wiki)**.
_Sockets might not work exactly like you think they do..._ 107 | 108 | **Still got questions?** Try the **[CocoaAsyncSocket Mailing List](http://groups.google.com/group/cocoaasyncsocket)**. 109 | *** 110 | 111 | Love the project? Wanna buy me a ☕️  ? (or a 🍺  😀 ): 112 | 113 | [![donation-bitcoin](https://bitpay.com/img/donate-sm.png)](https://onename.com/robbiehanson) 114 | [![donation-paypal](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2M8C699FQ8AW2) 115 | 116 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Categories/DDData.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSData (DDData) 4 | 5 | - (NSData *)md5Digest; 6 | 7 | - (NSData *)sha1Digest; 8 | 9 | - (NSString *)hexStringValue; 10 | 11 | - (NSString *)base64Encoded; 12 | - (NSData *)base64Decoded; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Categories/DDData.m: -------------------------------------------------------------------------------- 1 | #import "DDData.h" 2 | #import 3 | 4 | 5 | @implementation NSData (DDData) 6 | 7 | static char encodingTable[64] = { 8 | 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 9 | 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 10 | 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 11 | 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; 12 | 13 | - (NSData *)md5Digest 14 | { 15 | unsigned char result[CC_MD5_DIGEST_LENGTH]; 16 | 17 | CC_MD5([self bytes], (CC_LONG)[self length], result); 18 | return [NSData dataWithBytes:result length:CC_MD5_DIGEST_LENGTH]; 19 | } 20 | 21 | - (NSData *)sha1Digest 22 | { 23 | unsigned char result[CC_SHA1_DIGEST_LENGTH]; 24 | 25 | CC_SHA1([self bytes], (CC_LONG)[self length], result); 26 | return [NSData dataWithBytes:result length:CC_SHA1_DIGEST_LENGTH]; 27 | } 28 | 29 | - (NSString *)hexStringValue 30 | { 31 | NSMutableString *stringBuffer = [NSMutableString stringWithCapacity:([self length] * 2)]; 32 | 33 | const unsigned char *dataBuffer = [self bytes]; 34 | int i; 35 | 36 | for (i = 0; i < [self length]; ++i) 37 | { 38 | [stringBuffer appendFormat:@"%02x", (unsigned int)dataBuffer[i]]; 39 | } 40 | 41 | return [stringBuffer copy]; 42 | } 43 | 44 | - (NSString *)base64Encoded 45 | { 46 | const unsigned char *bytes = [self bytes]; 47 | NSMutableString *result = [NSMutableString stringWithCapacity:[self length]]; 48 | unsigned long ixtext = 0; 49 | unsigned long lentext = [self length]; 50 | long ctremaining = 0; 51 | unsigned char inbuf[3], outbuf[4]; 52 | unsigned short i = 0; 53 | unsigned short charsonline = 0, ctcopy = 0; 54 | unsigned long ix = 0; 55 | 56 | while( YES ) 57 | { 58 | ctremaining = lentext - ixtext; 59 | if( ctremaining <= 0 ) break; 60 | 61 | for( i = 0; i < 3; i++ ) { 62 | ix = ixtext + i; 63 | if( ix < lentext ) inbuf[i] = bytes[ix]; 64 | else inbuf [i] = 0; 65 | } 66 | 67 | outbuf [0] = (inbuf [0] & 0xFC) >> 2; 68 | outbuf [1] = ((inbuf [0] & 0x03) << 4) | ((inbuf [1] & 0xF0) >> 4); 69 | outbuf [2] = ((inbuf [1] & 0x0F) << 2) | ((inbuf [2] & 0xC0) >> 6); 70 | outbuf [3] = inbuf [2] & 0x3F; 71 | ctcopy = 4; 72 | 73 | switch( ctremaining ) 74 | { 75 | case 1: 76 | ctcopy = 2; 77 | break; 78 | case 2: 79 | ctcopy = 3; 80 | break; 81 | } 82 | 83 | for( i = 0; i < ctcopy; i++ ) 84 | [result appendFormat:@"%c", encodingTable[outbuf[i]]]; 85 | 86 | for( i = ctcopy; i < 4; i++ ) 87 | [result appendString:@"="]; 88 | 89 | ixtext += 3; 90 | charsonline += 4; 91 | } 92 | 93 | return [NSString stringWithString:result]; 94 | } 95 | 96 | - (NSData *)base64Decoded 97 | { 98 | const unsigned char *bytes = [self bytes]; 99 | NSMutableData *result = [NSMutableData dataWithCapacity:[self length]]; 100 | 101 | unsigned long ixtext = 0; 102 | unsigned long lentext = [self length]; 103 | unsigned char ch = 0; 104 | unsigned char inbuf[4] = {0, 0, 0, 0}; 105 | unsigned char outbuf[3] = {0, 0, 0}; 106 | short i = 0, ixinbuf = 0; 107 | BOOL flignore = NO; 108 | BOOL flendtext = NO; 109 | 110 | while( YES ) 111 | { 112 | if( ixtext >= lentext ) break; 113 | ch = bytes[ixtext++]; 114 | flignore = NO; 115 | 116 | if( ( ch >= 'A' ) && ( ch <= 'Z' ) ) ch = ch - 'A'; 117 | else if( ( ch >= 'a' ) && ( ch <= 'z' ) ) ch = ch - 'a' + 26; 118 | else if( ( ch >= '0' ) && ( ch <= '9' ) ) ch = ch - '0' + 52; 119 | else if( ch == '+' ) ch = 62; 120 | else if( ch == '=' ) flendtext = YES; 121 | else if( ch == '/' ) ch = 63; 122 | else flignore = YES; 123 | 124 | if( ! flignore ) 125 | { 126 | short ctcharsinbuf = 3; 127 | BOOL flbreak = NO; 128 | 129 | if( flendtext ) 130 | { 131 | if( ! ixinbuf ) break; 132 | if( ( ixinbuf == 1 ) || ( ixinbuf == 2 ) ) ctcharsinbuf = 1; 133 | else ctcharsinbuf = 2; 134 | ixinbuf = 3; 135 | flbreak = YES; 136 | } 137 | 138 | inbuf [ixinbuf++] = ch; 139 | 140 | if( ixinbuf == 4 ) 141 | { 142 | ixinbuf = 0; 143 | outbuf [0] = ( inbuf[0] << 2 ) | ( ( inbuf[1] & 0x30) >> 4 ); 144 | outbuf [1] = ( ( inbuf[1] & 0x0F ) << 4 ) | ( ( inbuf[2] & 0x3C ) >> 2 ); 145 | outbuf [2] = ( ( inbuf[2] & 0x03 ) << 6 ) | ( inbuf[3] & 0x3F ); 146 | 147 | for( i = 0; i < ctcharsinbuf; i++ ) 148 | [result appendBytes:&outbuf[i] length:1]; 149 | } 150 | 151 | if( flbreak ) break; 152 | } 153 | } 154 | 155 | return [NSData dataWithData:result]; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Categories/DDNumber.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface NSNumber (DDNumber) 5 | 6 | + (BOOL)parseString:(NSString *)str intoSInt64:(SInt64 *)pNum; 7 | + (BOOL)parseString:(NSString *)str intoUInt64:(UInt64 *)pNum; 8 | 9 | + (BOOL)parseString:(NSString *)str intoNSInteger:(NSInteger *)pNum; 10 | + (BOOL)parseString:(NSString *)str intoNSUInteger:(NSUInteger *)pNum; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Categories/DDNumber.m: -------------------------------------------------------------------------------- 1 | #import "DDNumber.h" 2 | 3 | 4 | @implementation NSNumber (DDNumber) 5 | 6 | + (BOOL)parseString:(NSString *)str intoSInt64:(SInt64 *)pNum 7 | { 8 | if(str == nil) 9 | { 10 | *pNum = 0; 11 | return NO; 12 | } 13 | 14 | errno = 0; 15 | 16 | // On both 32-bit and 64-bit machines, long long = 64 bit 17 | 18 | *pNum = strtoll([str UTF8String], NULL, 10); 19 | 20 | if(errno != 0) 21 | return NO; 22 | else 23 | return YES; 24 | } 25 | 26 | + (BOOL)parseString:(NSString *)str intoUInt64:(UInt64 *)pNum 27 | { 28 | if(str == nil) 29 | { 30 | *pNum = 0; 31 | return NO; 32 | } 33 | 34 | errno = 0; 35 | 36 | // On both 32-bit and 64-bit machines, unsigned long long = 64 bit 37 | 38 | *pNum = strtoull([str UTF8String], NULL, 10); 39 | 40 | if(errno != 0) 41 | return NO; 42 | else 43 | return YES; 44 | } 45 | 46 | + (BOOL)parseString:(NSString *)str intoNSInteger:(NSInteger *)pNum 47 | { 48 | if(str == nil) 49 | { 50 | *pNum = 0; 51 | return NO; 52 | } 53 | 54 | errno = 0; 55 | 56 | // On LP64, NSInteger = long = 64 bit 57 | // Otherwise, NSInteger = int = long = 32 bit 58 | 59 | *pNum = strtol([str UTF8String], NULL, 10); 60 | 61 | if(errno != 0) 62 | return NO; 63 | else 64 | return YES; 65 | } 66 | 67 | + (BOOL)parseString:(NSString *)str intoNSUInteger:(NSUInteger *)pNum 68 | { 69 | if(str == nil) 70 | { 71 | *pNum = 0; 72 | return NO; 73 | } 74 | 75 | errno = 0; 76 | 77 | // On LP64, NSUInteger = unsigned long = 64 bit 78 | // Otherwise, NSUInteger = unsigned int = unsigned long = 32 bit 79 | 80 | *pNum = strtoul([str UTF8String], NULL, 10); 81 | 82 | if(errno != 0) 83 | return NO; 84 | else 85 | return YES; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Categories/DDRange.h: -------------------------------------------------------------------------------- 1 | /** 2 | * DDRange is the functional equivalent of a 64 bit NSRange. 3 | * The HTTP Server is designed to support very large files. 4 | * On 32 bit architectures (ppc, i386) NSRange uses unsigned 32 bit integers. 5 | * This only supports a range of up to 4 gigabytes. 6 | * By defining our own variant, we can support a range up to 16 exabytes. 7 | * 8 | * All effort is given such that DDRange functions EXACTLY the same as NSRange. 9 | **/ 10 | 11 | #import 12 | #import 13 | 14 | @class NSString; 15 | 16 | typedef struct _DDRange { 17 | UInt64 location; 18 | UInt64 length; 19 | } DDRange; 20 | 21 | typedef DDRange *DDRangePointer; 22 | 23 | NS_INLINE DDRange DDMakeRange(UInt64 loc, UInt64 len) { 24 | DDRange r; 25 | r.location = loc; 26 | r.length = len; 27 | return r; 28 | } 29 | 30 | NS_INLINE UInt64 DDMaxRange(DDRange range) { 31 | return (range.location + range.length); 32 | } 33 | 34 | NS_INLINE BOOL DDLocationInRange(UInt64 loc, DDRange range) { 35 | return (loc - range.location < range.length); 36 | } 37 | 38 | NS_INLINE BOOL DDEqualRanges(DDRange range1, DDRange range2) { 39 | return ((range1.location == range2.location) && (range1.length == range2.length)); 40 | } 41 | 42 | FOUNDATION_EXPORT DDRange DDUnionRange(DDRange range1, DDRange range2); 43 | FOUNDATION_EXPORT DDRange DDIntersectionRange(DDRange range1, DDRange range2); 44 | FOUNDATION_EXPORT NSString *DDStringFromRange(DDRange range); 45 | FOUNDATION_EXPORT DDRange DDRangeFromString(NSString *aString); 46 | 47 | NSInteger DDRangeCompare(DDRangePointer pDDRange1, DDRangePointer pDDRange2); 48 | 49 | @interface NSValue (NSValueDDRangeExtensions) 50 | 51 | + (NSValue *)valueWithDDRange:(DDRange)range; 52 | - (DDRange)ddrangeValue; 53 | 54 | - (NSInteger)ddrangeCompare:(NSValue *)ddrangeValue; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Categories/DDRange.m: -------------------------------------------------------------------------------- 1 | #import "DDRange.h" 2 | #import "DDNumber.h" 3 | 4 | DDRange DDUnionRange(DDRange range1, DDRange range2) 5 | { 6 | DDRange result; 7 | 8 | result.location = MIN(range1.location, range2.location); 9 | result.length = MAX(DDMaxRange(range1), DDMaxRange(range2)) - result.location; 10 | 11 | return result; 12 | } 13 | 14 | DDRange DDIntersectionRange(DDRange range1, DDRange range2) 15 | { 16 | DDRange result; 17 | 18 | if((DDMaxRange(range1) < range2.location) || (DDMaxRange(range2) < range1.location)) 19 | { 20 | return DDMakeRange(0, 0); 21 | } 22 | 23 | result.location = MAX(range1.location, range2.location); 24 | result.length = MIN(DDMaxRange(range1), DDMaxRange(range2)) - result.location; 25 | 26 | return result; 27 | } 28 | 29 | NSString *DDStringFromRange(DDRange range) 30 | { 31 | return [NSString stringWithFormat:@"{%qu, %qu}", range.location, range.length]; 32 | } 33 | 34 | DDRange DDRangeFromString(NSString *aString) 35 | { 36 | DDRange result = DDMakeRange(0, 0); 37 | 38 | // NSRange will ignore '-' characters, but not '+' characters 39 | NSCharacterSet *cset = [NSCharacterSet characterSetWithCharactersInString:@"+0123456789"]; 40 | 41 | NSScanner *scanner = [NSScanner scannerWithString:aString]; 42 | [scanner setCharactersToBeSkipped:[cset invertedSet]]; 43 | 44 | NSString *str1 = nil; 45 | NSString *str2 = nil; 46 | 47 | BOOL found1 = [scanner scanCharactersFromSet:cset intoString:&str1]; 48 | BOOL found2 = [scanner scanCharactersFromSet:cset intoString:&str2]; 49 | 50 | if(found1) [NSNumber parseString:str1 intoUInt64:&result.location]; 51 | if(found2) [NSNumber parseString:str2 intoUInt64:&result.length]; 52 | 53 | return result; 54 | } 55 | 56 | NSInteger DDRangeCompare(DDRangePointer pDDRange1, DDRangePointer pDDRange2) 57 | { 58 | // Comparison basis: 59 | // Which range would you encouter first if you started at zero, and began walking towards infinity. 60 | // If you encouter both ranges at the same time, which range would end first. 61 | 62 | if(pDDRange1->location < pDDRange2->location) 63 | { 64 | return NSOrderedAscending; 65 | } 66 | if(pDDRange1->location > pDDRange2->location) 67 | { 68 | return NSOrderedDescending; 69 | } 70 | if(pDDRange1->length < pDDRange2->length) 71 | { 72 | return NSOrderedAscending; 73 | } 74 | if(pDDRange1->length > pDDRange2->length) 75 | { 76 | return NSOrderedDescending; 77 | } 78 | 79 | return NSOrderedSame; 80 | } 81 | 82 | @implementation NSValue (NSValueDDRangeExtensions) 83 | 84 | + (NSValue *)valueWithDDRange:(DDRange)range 85 | { 86 | return [NSValue valueWithBytes:&range objCType:@encode(DDRange)]; 87 | } 88 | 89 | - (DDRange)ddrangeValue 90 | { 91 | DDRange result; 92 | [self getValue:&result]; 93 | return result; 94 | } 95 | 96 | - (NSInteger)ddrangeCompare:(NSValue *)other 97 | { 98 | DDRange r1 = [self ddrangeValue]; 99 | DDRange r2 = [other ddrangeValue]; 100 | 101 | return DDRangeCompare(&r1, &r2); 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IPHONE 4 | // Note: You may need to add the CFNetwork Framework to your project 5 | #import 6 | #endif 7 | 8 | @class HTTPMessage; 9 | 10 | 11 | @interface HTTPAuthenticationRequest : NSObject 12 | { 13 | BOOL isBasic; 14 | BOOL isDigest; 15 | 16 | NSString *base64Credentials; 17 | 18 | NSString *username; 19 | NSString *realm; 20 | NSString *nonce; 21 | NSString *uri; 22 | NSString *qop; 23 | NSString *nc; 24 | NSString *cnonce; 25 | NSString *response; 26 | } 27 | - (id)initWithRequest:(HTTPMessage *)request; 28 | 29 | - (BOOL)isBasic; 30 | - (BOOL)isDigest; 31 | 32 | // Basic 33 | - (NSString *)base64Credentials; 34 | 35 | // Digest 36 | - (NSString *)username; 37 | - (NSString *)realm; 38 | - (NSString *)nonce; 39 | - (NSString *)uri; 40 | - (NSString *)qop; 41 | - (NSString *)nc; 42 | - (NSString *)cnonce; 43 | - (NSString *)response; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m: -------------------------------------------------------------------------------- 1 | #import "HTTPAuthenticationRequest.h" 2 | #import "HTTPMessage.h" 3 | 4 | #if ! __has_feature(objc_arc) 5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 6 | #endif 7 | 8 | @interface HTTPAuthenticationRequest (PrivateAPI) 9 | - (NSString *)quotedSubHeaderFieldValue:(NSString *)param fromHeaderFieldValue:(NSString *)header; 10 | - (NSString *)nonquotedSubHeaderFieldValue:(NSString *)param fromHeaderFieldValue:(NSString *)header; 11 | @end 12 | 13 | 14 | @implementation HTTPAuthenticationRequest 15 | 16 | - (id)initWithRequest:(HTTPMessage *)request 17 | { 18 | if ((self = [super init])) 19 | { 20 | NSString *authInfo = [request headerField:@"Authorization"]; 21 | 22 | isBasic = NO; 23 | if ([authInfo length] >= 6) 24 | { 25 | isBasic = [[authInfo substringToIndex:6] caseInsensitiveCompare:@"Basic "] == NSOrderedSame; 26 | } 27 | 28 | isDigest = NO; 29 | if ([authInfo length] >= 7) 30 | { 31 | isDigest = [[authInfo substringToIndex:7] caseInsensitiveCompare:@"Digest "] == NSOrderedSame; 32 | } 33 | 34 | if (isBasic) 35 | { 36 | NSMutableString *temp = [[authInfo substringFromIndex:6] mutableCopy]; 37 | CFStringTrimWhitespace((__bridge CFMutableStringRef)temp); 38 | 39 | base64Credentials = [temp copy]; 40 | } 41 | 42 | if (isDigest) 43 | { 44 | username = [self quotedSubHeaderFieldValue:@"username" fromHeaderFieldValue:authInfo]; 45 | realm = [self quotedSubHeaderFieldValue:@"realm" fromHeaderFieldValue:authInfo]; 46 | nonce = [self quotedSubHeaderFieldValue:@"nonce" fromHeaderFieldValue:authInfo]; 47 | uri = [self quotedSubHeaderFieldValue:@"uri" fromHeaderFieldValue:authInfo]; 48 | 49 | // It appears from RFC 2617 that the qop is to be given unquoted 50 | // Tests show that Firefox performs this way, but Safari does not 51 | // Thus we'll attempt to retrieve the value as nonquoted, but we'll verify it doesn't start with a quote 52 | qop = [self nonquotedSubHeaderFieldValue:@"qop" fromHeaderFieldValue:authInfo]; 53 | if(qop && ([qop characterAtIndex:0] == '"')) 54 | { 55 | qop = [self quotedSubHeaderFieldValue:@"qop" fromHeaderFieldValue:authInfo]; 56 | } 57 | 58 | nc = [self nonquotedSubHeaderFieldValue:@"nc" fromHeaderFieldValue:authInfo]; 59 | cnonce = [self quotedSubHeaderFieldValue:@"cnonce" fromHeaderFieldValue:authInfo]; 60 | response = [self quotedSubHeaderFieldValue:@"response" fromHeaderFieldValue:authInfo]; 61 | } 62 | } 63 | return self; 64 | } 65 | 66 | 67 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 68 | #pragma mark Accessors: 69 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 70 | 71 | - (BOOL)isBasic { 72 | return isBasic; 73 | } 74 | 75 | - (BOOL)isDigest { 76 | return isDigest; 77 | } 78 | 79 | - (NSString *)base64Credentials { 80 | return base64Credentials; 81 | } 82 | 83 | - (NSString *)username { 84 | return username; 85 | } 86 | 87 | - (NSString *)realm { 88 | return realm; 89 | } 90 | 91 | - (NSString *)nonce { 92 | return nonce; 93 | } 94 | 95 | - (NSString *)uri { 96 | return uri; 97 | } 98 | 99 | - (NSString *)qop { 100 | return qop; 101 | } 102 | 103 | - (NSString *)nc { 104 | return nc; 105 | } 106 | 107 | - (NSString *)cnonce { 108 | return cnonce; 109 | } 110 | 111 | - (NSString *)response { 112 | return response; 113 | } 114 | 115 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 116 | #pragma mark Private API: 117 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 118 | 119 | /** 120 | * Retrieves a "Sub Header Field Value" from a given header field value. 121 | * The sub header field is expected to be quoted. 122 | * 123 | * In the following header field: 124 | * Authorization: Digest username="Mufasa", qop=auth, response="6629fae4939" 125 | * The sub header field titled 'username' is quoted, and this method would return the value @"Mufasa". 126 | **/ 127 | - (NSString *)quotedSubHeaderFieldValue:(NSString *)param fromHeaderFieldValue:(NSString *)header 128 | { 129 | NSRange startRange = [header rangeOfString:[NSString stringWithFormat:@"%@=\"", param]]; 130 | if(startRange.location == NSNotFound) 131 | { 132 | // The param was not found anywhere in the header 133 | return nil; 134 | } 135 | 136 | NSUInteger postStartRangeLocation = startRange.location + startRange.length; 137 | NSUInteger postStartRangeLength = [header length] - postStartRangeLocation; 138 | NSRange postStartRange = NSMakeRange(postStartRangeLocation, postStartRangeLength); 139 | 140 | NSRange endRange = [header rangeOfString:@"\"" options:0 range:postStartRange]; 141 | if(endRange.location == NSNotFound) 142 | { 143 | // The ending double-quote was not found anywhere in the header 144 | return nil; 145 | } 146 | 147 | NSRange subHeaderRange = NSMakeRange(postStartRangeLocation, endRange.location - postStartRangeLocation); 148 | return [header substringWithRange:subHeaderRange]; 149 | } 150 | 151 | /** 152 | * Retrieves a "Sub Header Field Value" from a given header field value. 153 | * The sub header field is expected to not be quoted. 154 | * 155 | * In the following header field: 156 | * Authorization: Digest username="Mufasa", qop=auth, response="6629fae4939" 157 | * The sub header field titled 'qop' is nonquoted, and this method would return the value @"auth". 158 | **/ 159 | - (NSString *)nonquotedSubHeaderFieldValue:(NSString *)param fromHeaderFieldValue:(NSString *)header 160 | { 161 | NSRange startRange = [header rangeOfString:[NSString stringWithFormat:@"%@=", param]]; 162 | if(startRange.location == NSNotFound) 163 | { 164 | // The param was not found anywhere in the header 165 | return nil; 166 | } 167 | 168 | NSUInteger postStartRangeLocation = startRange.location + startRange.length; 169 | NSUInteger postStartRangeLength = [header length] - postStartRangeLocation; 170 | NSRange postStartRange = NSMakeRange(postStartRangeLocation, postStartRangeLength); 171 | 172 | NSRange endRange = [header rangeOfString:@"," options:0 range:postStartRange]; 173 | if(endRange.location == NSNotFound) 174 | { 175 | // The ending comma was not found anywhere in the header 176 | // However, if the nonquoted param is at the end of the string, there would be no comma 177 | // This is only possible if there are no spaces anywhere 178 | NSRange endRange2 = [header rangeOfString:@" " options:0 range:postStartRange]; 179 | if(endRange2.location != NSNotFound) 180 | { 181 | return nil; 182 | } 183 | else 184 | { 185 | return [header substringWithRange:postStartRange]; 186 | } 187 | } 188 | else 189 | { 190 | NSRange subHeaderRange = NSMakeRange(postStartRangeLocation, endRange.location - postStartRangeLocation); 191 | return [header substringWithRange:subHeaderRange]; 192 | } 193 | } 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/HTTPConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class GCDAsyncSocket; 4 | @class HTTPMessage; 5 | @class HTTPServer; 6 | @class WebSocket; 7 | @protocol HTTPResponse; 8 | 9 | 10 | #define HTTPConnectionDidDieNotification @"HTTPConnectionDidDie" 11 | 12 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 13 | #pragma mark - 14 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 15 | 16 | @interface HTTPConfig : NSObject 17 | { 18 | HTTPServer __unsafe_unretained *server; 19 | NSString __strong *documentRoot; 20 | dispatch_queue_t queue; 21 | } 22 | 23 | - (id)initWithServer:(HTTPServer *)server documentRoot:(NSString *)documentRoot; 24 | - (id)initWithServer:(HTTPServer *)server documentRoot:(NSString *)documentRoot queue:(dispatch_queue_t)q; 25 | 26 | @property (nonatomic, unsafe_unretained, readonly) HTTPServer *server; 27 | @property (nonatomic, strong, readonly) NSString *documentRoot; 28 | @property (nonatomic, readonly) dispatch_queue_t queue; 29 | 30 | @end 31 | 32 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 33 | #pragma mark - 34 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 35 | 36 | @interface HTTPConnection : NSObject 37 | { 38 | dispatch_queue_t connectionQueue; 39 | GCDAsyncSocket *asyncSocket; 40 | HTTPConfig *config; 41 | 42 | BOOL started; 43 | 44 | HTTPMessage *request; 45 | unsigned int numHeaderLines; 46 | 47 | BOOL sentResponseHeaders; 48 | 49 | NSString *nonce; 50 | long lastNC; 51 | 52 | NSObject *httpResponse; 53 | 54 | NSMutableArray *ranges; 55 | NSMutableArray *ranges_headers; 56 | NSString *ranges_boundry; 57 | int rangeIndex; 58 | 59 | UInt64 requestContentLength; 60 | UInt64 requestContentLengthReceived; 61 | UInt64 requestChunkSize; 62 | UInt64 requestChunkSizeReceived; 63 | 64 | NSMutableArray *responseDataSizes; 65 | } 66 | 67 | - (id)initWithAsyncSocket:(GCDAsyncSocket *)newSocket configuration:(HTTPConfig *)aConfig; 68 | 69 | - (void)start; 70 | - (void)stop; 71 | 72 | - (void)startConnection; 73 | 74 | - (BOOL)supportsMethod:(NSString *)method atPath:(NSString *)path; 75 | - (BOOL)expectsRequestBodyFromMethod:(NSString *)method atPath:(NSString *)path; 76 | 77 | - (BOOL)isSecureServer; 78 | - (NSArray *)sslIdentityAndCertificates; 79 | 80 | - (BOOL)isPasswordProtected:(NSString *)path; 81 | - (BOOL)useDigestAccessAuthentication; 82 | - (NSString *)realm; 83 | - (NSString *)passwordForUser:(NSString *)username; 84 | 85 | - (NSDictionary *)parseParams:(NSString *)query; 86 | - (NSDictionary *)parseGetParams; 87 | 88 | - (NSString *)requestURI; 89 | 90 | - (NSArray *)directoryIndexFileNames; 91 | - (NSString *)filePathForURI:(NSString *)path; 92 | - (NSString *)filePathForURI:(NSString *)path allowDirectory:(BOOL)allowDirectory; 93 | - (NSObject *)httpResponseForMethod:(NSString *)method URI:(NSString *)path; 94 | - (WebSocket *)webSocketForURI:(NSString *)path; 95 | 96 | - (void)prepareForBodyWithSize:(UInt64)contentLength; 97 | - (void)processBodyData:(NSData *)postDataChunk; 98 | - (void)finishBody; 99 | 100 | - (void)handleVersionNotSupported:(NSString *)version; 101 | - (void)handleAuthenticationFailed; 102 | - (void)handleResourceNotFound; 103 | - (void)handleInvalidRequest:(NSData *)data; 104 | - (void)handleUnknownMethod:(NSString *)method; 105 | 106 | - (NSData *)preprocessResponse:(HTTPMessage *)response; 107 | - (NSData *)preprocessErrorResponse:(HTTPMessage *)response; 108 | 109 | - (void)finishResponse; 110 | 111 | - (BOOL)shouldDie; 112 | - (void)die; 113 | 114 | @end 115 | 116 | @interface HTTPConnection (AsynchronousHTTPResponse) 117 | - (void)responseHasAvailableData:(NSObject *)sender; 118 | - (void)responseDidAbort:(NSObject *)sender; 119 | @end 120 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/HTTPLogging.h: -------------------------------------------------------------------------------- 1 | /** 2 | * In order to provide fast and flexible logging, this project uses Cocoa Lumberjack. 3 | * 4 | * The Google Code page has a wealth of documentation if you have any questions. 5 | * https://github.com/robbiehanson/CocoaLumberjack 6 | * 7 | * Here's what you need to know concerning how logging is setup for CocoaHTTPServer: 8 | * 9 | * There are 4 log levels: 10 | * - Error 11 | * - Warning 12 | * - Info 13 | * - Verbose 14 | * 15 | * In addition to this, there is a Trace flag that can be enabled. 16 | * When tracing is enabled, it spits out the methods that are being called. 17 | * 18 | * Please note that tracing is separate from the log levels. 19 | * For example, one could set the log level to warning, and enable tracing. 20 | * 21 | * All logging is asynchronous, except errors. 22 | * To use logging within your own custom files, follow the steps below. 23 | * 24 | * Step 1: 25 | * Import this header in your implementation file: 26 | * 27 | * #import "HTTPLogging.h" 28 | * 29 | * Step 2: 30 | * Define your logging level in your implementation file: 31 | * 32 | * // Log levels: off, error, warn, info, verbose 33 | * static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; 34 | * 35 | * If you wish to enable tracing, you could do something like this: 36 | * 37 | * // Debug levels: off, error, warn, info, verbose 38 | * static const int httpLogLevel = HTTP_LOG_LEVEL_INFO | HTTP_LOG_FLAG_TRACE; 39 | * 40 | * Step 3: 41 | * Replace your NSLog statements with HTTPLog statements according to the severity of the message. 42 | * 43 | * NSLog(@"Fatal error, no dohickey found!"); -> HTTPLogError(@"Fatal error, no dohickey found!"); 44 | * 45 | * HTTPLog works exactly the same as NSLog. 46 | * This means you can pass it multiple variables just like NSLog. 47 | **/ 48 | 49 | #import "DDLog.h" 50 | 51 | // Define logging context for every log message coming from the HTTP server. 52 | // The logging context can be extracted from the DDLogMessage from within the logging framework, 53 | // which gives loggers, formatters, and filters the ability to optionally process them differently. 54 | 55 | #define HTTP_LOG_CONTEXT 80 56 | 57 | // Configure log levels. 58 | 59 | #define HTTP_LOG_FLAG_ERROR (1 << 0) // 0...00001 60 | #define HTTP_LOG_FLAG_WARN (1 << 1) // 0...00010 61 | #define HTTP_LOG_FLAG_INFO (1 << 2) // 0...00100 62 | #define HTTP_LOG_FLAG_VERBOSE (1 << 3) // 0...01000 63 | 64 | #define HTTP_LOG_LEVEL_OFF 0 // 0...00000 65 | #define HTTP_LOG_LEVEL_ERROR (HTTP_LOG_LEVEL_OFF | HTTP_LOG_FLAG_ERROR) // 0...00001 66 | #define HTTP_LOG_LEVEL_WARN (HTTP_LOG_LEVEL_ERROR | HTTP_LOG_FLAG_WARN) // 0...00011 67 | #define HTTP_LOG_LEVEL_INFO (HTTP_LOG_LEVEL_WARN | HTTP_LOG_FLAG_INFO) // 0...00111 68 | #define HTTP_LOG_LEVEL_VERBOSE (HTTP_LOG_LEVEL_INFO | HTTP_LOG_FLAG_VERBOSE) // 0...01111 69 | 70 | // Setup fine grained logging. 71 | // The first 4 bits are being used by the standard log levels (0 - 3) 72 | // 73 | // We're going to add tracing, but NOT as a log level. 74 | // Tracing can be turned on and off independently of log level. 75 | 76 | #define HTTP_LOG_FLAG_TRACE (1 << 4) // 0...10000 77 | 78 | // Setup the usual boolean macros. 79 | 80 | #define HTTP_LOG_ERROR (httpLogLevel & HTTP_LOG_FLAG_ERROR) 81 | #define HTTP_LOG_WARN (httpLogLevel & HTTP_LOG_FLAG_WARN) 82 | #define HTTP_LOG_INFO (httpLogLevel & HTTP_LOG_FLAG_INFO) 83 | #define HTTP_LOG_VERBOSE (httpLogLevel & HTTP_LOG_FLAG_VERBOSE) 84 | #define HTTP_LOG_TRACE (httpLogLevel & HTTP_LOG_FLAG_TRACE) 85 | 86 | // Configure asynchronous logging. 87 | // We follow the default configuration, 88 | // but we reserve a special macro to easily disable asynchronous logging for debugging purposes. 89 | 90 | #define HTTP_LOG_ASYNC_ENABLED YES 91 | 92 | #define HTTP_LOG_ASYNC_ERROR ( NO && HTTP_LOG_ASYNC_ENABLED) 93 | #define HTTP_LOG_ASYNC_WARN (YES && HTTP_LOG_ASYNC_ENABLED) 94 | #define HTTP_LOG_ASYNC_INFO (YES && HTTP_LOG_ASYNC_ENABLED) 95 | #define HTTP_LOG_ASYNC_VERBOSE (YES && HTTP_LOG_ASYNC_ENABLED) 96 | #define HTTP_LOG_ASYNC_TRACE (YES && HTTP_LOG_ASYNC_ENABLED) 97 | 98 | // Define logging primitives. 99 | 100 | #define HTTPLogError(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_ERROR, httpLogLevel, HTTP_LOG_FLAG_ERROR, \ 101 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 102 | 103 | #define HTTPLogWarn(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_WARN, httpLogLevel, HTTP_LOG_FLAG_WARN, \ 104 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 105 | 106 | #define HTTPLogInfo(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_INFO, httpLogLevel, HTTP_LOG_FLAG_INFO, \ 107 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 108 | 109 | #define HTTPLogVerbose(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_VERBOSE, httpLogLevel, HTTP_LOG_FLAG_VERBOSE, \ 110 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 111 | 112 | #define HTTPLogTrace() LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE, \ 113 | HTTP_LOG_CONTEXT, @"%@[%p]: %@", THIS_FILE, self, THIS_METHOD) 114 | 115 | #define HTTPLogTrace2(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE, \ 116 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 117 | 118 | 119 | #define HTTPLogCError(frmt, ...) LOG_C_MAYBE(HTTP_LOG_ASYNC_ERROR, httpLogLevel, HTTP_LOG_FLAG_ERROR, \ 120 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 121 | 122 | #define HTTPLogCWarn(frmt, ...) LOG_C_MAYBE(HTTP_LOG_ASYNC_WARN, httpLogLevel, HTTP_LOG_FLAG_WARN, \ 123 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 124 | 125 | #define HTTPLogCInfo(frmt, ...) LOG_C_MAYBE(HTTP_LOG_ASYNC_INFO, httpLogLevel, HTTP_LOG_FLAG_INFO, \ 126 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 127 | 128 | #define HTTPLogCVerbose(frmt, ...) LOG_C_MAYBE(HTTP_LOG_ASYNC_VERBOSE, httpLogLevel, HTTP_LOG_FLAG_VERBOSE, \ 129 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 130 | 131 | #define HTTPLogCTrace() LOG_C_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE, \ 132 | HTTP_LOG_CONTEXT, @"%@[%p]: %@", THIS_FILE, self, __FUNCTION__) 133 | 134 | #define HTTPLogCTrace2(frmt, ...) LOG_C_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE, \ 135 | HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__) 136 | 137 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/HTTPMessage.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The HTTPMessage class is a simple Objective-C wrapper around Apple's CFHTTPMessage class. 3 | **/ 4 | 5 | #import 6 | 7 | #if TARGET_OS_IPHONE 8 | // Note: You may need to add the CFNetwork Framework to your project 9 | #import 10 | #endif 11 | 12 | #define HTTPVersion1_0 ((NSString *)kCFHTTPVersion1_0) 13 | #define HTTPVersion1_1 ((NSString *)kCFHTTPVersion1_1) 14 | 15 | 16 | @interface HTTPMessage : NSObject 17 | { 18 | CFHTTPMessageRef message; 19 | } 20 | 21 | - (id)initEmptyRequest; 22 | 23 | - (id)initRequestWithMethod:(NSString *)method URL:(NSURL *)url version:(NSString *)version; 24 | 25 | - (id)initResponseWithStatusCode:(NSInteger)code description:(NSString *)description version:(NSString *)version; 26 | 27 | - (BOOL)appendData:(NSData *)data; 28 | 29 | - (BOOL)isHeaderComplete; 30 | 31 | - (NSString *)version; 32 | 33 | - (NSString *)method; 34 | - (NSURL *)url; 35 | 36 | - (NSInteger)statusCode; 37 | 38 | - (NSDictionary *)allHeaderFields; 39 | - (NSString *)headerField:(NSString *)headerField; 40 | 41 | - (void)setHeaderField:(NSString *)headerField value:(NSString *)headerFieldValue; 42 | 43 | - (NSData *)messageData; 44 | 45 | - (NSData *)body; 46 | - (void)setBody:(NSData *)body; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/HTTPMessage.m: -------------------------------------------------------------------------------- 1 | #import "HTTPMessage.h" 2 | 3 | #if ! __has_feature(objc_arc) 4 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 5 | #endif 6 | 7 | 8 | @implementation HTTPMessage 9 | 10 | - (id)initEmptyRequest 11 | { 12 | if ((self = [super init])) 13 | { 14 | message = CFHTTPMessageCreateEmpty(NULL, YES); 15 | } 16 | return self; 17 | } 18 | 19 | - (id)initRequestWithMethod:(NSString *)method URL:(NSURL *)url version:(NSString *)version 20 | { 21 | if ((self = [super init])) 22 | { 23 | message = CFHTTPMessageCreateRequest(NULL, 24 | (__bridge CFStringRef)method, 25 | (__bridge CFURLRef)url, 26 | (__bridge CFStringRef)version); 27 | } 28 | return self; 29 | } 30 | 31 | - (id)initResponseWithStatusCode:(NSInteger)code description:(NSString *)description version:(NSString *)version 32 | { 33 | if ((self = [super init])) 34 | { 35 | message = CFHTTPMessageCreateResponse(NULL, 36 | (CFIndex)code, 37 | (__bridge CFStringRef)description, 38 | (__bridge CFStringRef)version); 39 | } 40 | return self; 41 | } 42 | 43 | - (void)dealloc 44 | { 45 | if (message) 46 | { 47 | CFRelease(message); 48 | } 49 | } 50 | 51 | - (BOOL)appendData:(NSData *)data 52 | { 53 | return CFHTTPMessageAppendBytes(message, [data bytes], [data length]); 54 | } 55 | 56 | - (BOOL)isHeaderComplete 57 | { 58 | return CFHTTPMessageIsHeaderComplete(message); 59 | } 60 | 61 | - (NSString *)version 62 | { 63 | return (__bridge_transfer NSString *)CFHTTPMessageCopyVersion(message); 64 | } 65 | 66 | - (NSString *)method 67 | { 68 | return (__bridge_transfer NSString *)CFHTTPMessageCopyRequestMethod(message); 69 | } 70 | 71 | - (NSURL *)url 72 | { 73 | return (__bridge_transfer NSURL *)CFHTTPMessageCopyRequestURL(message); 74 | } 75 | 76 | - (NSInteger)statusCode 77 | { 78 | return (NSInteger)CFHTTPMessageGetResponseStatusCode(message); 79 | } 80 | 81 | - (NSDictionary *)allHeaderFields 82 | { 83 | return (__bridge_transfer NSDictionary *)CFHTTPMessageCopyAllHeaderFields(message); 84 | } 85 | 86 | - (NSString *)headerField:(NSString *)headerField 87 | { 88 | return (__bridge_transfer NSString *)CFHTTPMessageCopyHeaderFieldValue(message, (__bridge CFStringRef)headerField); 89 | } 90 | 91 | - (void)setHeaderField:(NSString *)headerField value:(NSString *)headerFieldValue 92 | { 93 | CFHTTPMessageSetHeaderFieldValue(message, 94 | (__bridge CFStringRef)headerField, 95 | (__bridge CFStringRef)headerFieldValue); 96 | } 97 | 98 | - (NSData *)messageData 99 | { 100 | return (__bridge_transfer NSData *)CFHTTPMessageCopySerializedMessage(message); 101 | } 102 | 103 | - (NSData *)body 104 | { 105 | return (__bridge_transfer NSData *)CFHTTPMessageCopyBody(message); 106 | } 107 | 108 | - (void)setBody:(NSData *)body 109 | { 110 | CFHTTPMessageSetBody(message, (__bridge CFDataRef)body); 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h: -------------------------------------------------------------------------------- 1 | 2 | #import "MultipartMessageHeader.h" 3 | 4 | /* 5 | Part one: http://tools.ietf.org/html/rfc2045 (Format of Internet Message Bodies) 6 | Part two: http://tools.ietf.org/html/rfc2046 (Media Types) 7 | Part three: http://tools.ietf.org/html/rfc2047 (Message Header Extensions for Non-ASCII Text) 8 | Part four: http://tools.ietf.org/html/rfc4289 (Registration Procedures) 9 | Part five: http://tools.ietf.org/html/rfc2049 (Conformance Criteria and Examples) 10 | 11 | Internet message format: http://tools.ietf.org/html/rfc2822 12 | 13 | Multipart/form-data http://tools.ietf.org/html/rfc2388 14 | */ 15 | 16 | @class MultipartFormDataParser; 17 | 18 | //----------------------------------------------------------------- 19 | // protocol MultipartFormDataParser 20 | //----------------------------------------------------------------- 21 | 22 | @protocol MultipartFormDataParserDelegate 23 | @optional 24 | - (void) processContent:(NSData*) data WithHeader:(MultipartMessageHeader*) header; 25 | - (void) processEndOfPartWithHeader:(MultipartMessageHeader*) header; 26 | - (void) processPreambleData:(NSData*) data; 27 | - (void) processEpilogueData:(NSData*) data; 28 | - (void) processStartOfPartWithHeader:(MultipartMessageHeader*) header; 29 | @end 30 | 31 | //----------------------------------------------------------------- 32 | // interface MultipartFormDataParser 33 | //----------------------------------------------------------------- 34 | 35 | @interface MultipartFormDataParser : NSObject { 36 | NSMutableData* pendingData; 37 | NSData* boundaryData; 38 | MultipartMessageHeader* currentHeader; 39 | 40 | BOOL waitingForCRLF; 41 | BOOL reachedEpilogue; 42 | BOOL processedPreamble; 43 | BOOL checkForContentEnd; 44 | 45 | #if __has_feature(objc_arc_weak) 46 | __weak id delegate; 47 | #else 48 | __unsafe_unretained id delegate; 49 | #endif 50 | int currentEncoding; 51 | NSStringEncoding formEncoding; 52 | } 53 | 54 | - (BOOL) appendData:(NSData*) data; 55 | 56 | - (id) initWithBoundary:(NSString*) boundary formEncoding:(NSStringEncoding) formEncoding; 57 | 58 | #if __has_feature(objc_arc_weak) 59 | @property(weak, readwrite) id delegate; 60 | #else 61 | @property(unsafe_unretained, readwrite) id delegate; 62 | #endif 63 | @property(readwrite) NSStringEncoding formEncoding; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MultipartMessagePart.h 3 | // HttpServer 4 | // 5 | // Created by Валерий Гаврилов on 29.03.12. 6 | // Copyright (c) 2012 LLC "Online Publishing Partners" (onlinepp.ru). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | //----------------------------------------------------------------- 13 | // interface MultipartMessageHeader 14 | //----------------------------------------------------------------- 15 | enum { 16 | contentTransferEncoding_unknown, 17 | contentTransferEncoding_7bit, 18 | contentTransferEncoding_8bit, 19 | contentTransferEncoding_binary, 20 | contentTransferEncoding_base64, 21 | contentTransferEncoding_quotedPrintable, 22 | }; 23 | 24 | @interface MultipartMessageHeader : NSObject { 25 | NSMutableDictionary* fields; 26 | int encoding; 27 | NSString* contentDispositionName; 28 | } 29 | @property (strong,readonly) NSDictionary* fields; 30 | @property (readonly) int encoding; 31 | 32 | - (id) initWithData:(NSData*) data formEncoding:(NSStringEncoding) encoding; 33 | @end 34 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MultipartMessagePart.m 3 | // HttpServer 4 | // 5 | // Created by Валерий Гаврилов on 29.03.12. 6 | // Copyright (c) 2012 LLC "Online Publishing Partners" (onlinepp.ru). All rights reserved. 7 | 8 | #import "MultipartMessageHeader.h" 9 | #import "MultipartMessageHeaderField.h" 10 | 11 | #import "HTTPLogging.h" 12 | 13 | //----------------------------------------------------------------- 14 | #pragma mark log level 15 | 16 | #ifdef DEBUG 17 | static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; 18 | #else 19 | static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; 20 | #endif 21 | 22 | //----------------------------------------------------------------- 23 | // implementation MultipartMessageHeader 24 | //----------------------------------------------------------------- 25 | 26 | 27 | @implementation MultipartMessageHeader 28 | @synthesize fields,encoding; 29 | 30 | 31 | - (id) initWithData:(NSData *)data formEncoding:(NSStringEncoding) formEncoding { 32 | if( nil == (self = [super init]) ) { 33 | return self; 34 | } 35 | 36 | fields = [[NSMutableDictionary alloc] initWithCapacity:1]; 37 | 38 | // In case encoding is not mentioned, 39 | encoding = contentTransferEncoding_unknown; 40 | 41 | char* bytes = (char*)data.bytes; 42 | int length = data.length; 43 | int offset = 0; 44 | 45 | // split header into header fields, separated by \r\n 46 | uint16_t fields_separator = 0x0A0D; // \r\n 47 | while( offset < length - 2 ) { 48 | 49 | // the !isspace condition is to support header unfolding 50 | if( (*(uint16_t*) (bytes+offset) == fields_separator) && ((offset == length - 2) || !(isspace(bytes[offset+2])) )) { 51 | NSData* fieldData = [NSData dataWithBytesNoCopy:bytes length:offset freeWhenDone:NO]; 52 | MultipartMessageHeaderField* field = [[MultipartMessageHeaderField alloc] initWithData: fieldData contentEncoding:formEncoding]; 53 | if( field ) { 54 | [fields setObject:field forKey:field.name]; 55 | HTTPLogVerbose(@"MultipartFormDataParser: Processed Header field '%@'",field.name); 56 | } 57 | else { 58 | NSString* fieldStr = [[NSString alloc] initWithData:fieldData encoding:NSASCIIStringEncoding]; 59 | HTTPLogWarn(@"MultipartFormDataParser: Failed to parse MIME header field. Input ASCII string:%@",fieldStr); 60 | } 61 | 62 | // move to the next header field 63 | bytes += offset + 2; 64 | length -= offset + 2; 65 | offset = 0; 66 | continue; 67 | } 68 | ++ offset; 69 | } 70 | 71 | if( !fields.count ) { 72 | // it was an empty header. 73 | // we have to set default values. 74 | // default header. 75 | [fields setObject:@"text/plain" forKey:@"Content-Type"]; 76 | } 77 | 78 | return self; 79 | } 80 | 81 | - (NSString *)description { 82 | return [NSString stringWithFormat:@"%@",fields]; 83 | } 84 | 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | //----------------------------------------------------------------- 5 | // interface MultipartMessageHeaderField 6 | //----------------------------------------------------------------- 7 | 8 | @interface MultipartMessageHeaderField : NSObject { 9 | NSString* name; 10 | NSString* value; 11 | NSMutableDictionary* params; 12 | } 13 | 14 | @property (strong, readonly) NSString* value; 15 | @property (strong, readonly) NSDictionary* params; 16 | @property (strong, readonly) NSString* name; 17 | 18 | //- (id) initWithLine:(NSString*) line; 19 | //- (id) initWithName:(NSString*) paramName value:(NSString*) paramValue; 20 | 21 | - (id) initWithData:(NSData*) data contentEncoding:(NSStringEncoding) encoding; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | 4 | @class HTTPConnection; 5 | 6 | /** 7 | * This is an asynchronous version of HTTPFileResponse. 8 | * It reads data from the given file asynchronously via GCD. 9 | * 10 | * It may be overriden to allow custom post-processing of the data that has been read from the file. 11 | * An example of this is the HTTPDynamicFileResponse class. 12 | **/ 13 | 14 | @interface HTTPAsyncFileResponse : NSObject 15 | { 16 | HTTPConnection *connection; 17 | 18 | NSString *filePath; 19 | UInt64 fileLength; 20 | UInt64 fileOffset; // File offset as pertains to data given to connection 21 | UInt64 readOffset; // File offset as pertains to data read from file (but maybe not returned to connection) 22 | 23 | BOOL aborted; 24 | 25 | NSData *data; 26 | 27 | int fileFD; 28 | void *readBuffer; 29 | NSUInteger readBufferSize; // Malloced size of readBuffer 30 | NSUInteger readBufferOffset; // Offset within readBuffer where the end of existing data is 31 | NSUInteger readRequestLength; 32 | dispatch_queue_t readQueue; 33 | dispatch_source_t readSource; 34 | BOOL readSourceSuspended; 35 | } 36 | 37 | - (id)initWithFilePath:(NSString *)filePath forConnection:(HTTPConnection *)connection; 38 | - (NSString *)filePath; 39 | 40 | @end 41 | 42 | /** 43 | * Explanation of Variables (excluding those that are obvious) 44 | * 45 | * fileOffset 46 | * This is the number of bytes that have been returned to the connection via the readDataOfLength method. 47 | * If 1KB of data has been read from the file, but none of that data has yet been returned to the connection, 48 | * then the fileOffset variable remains at zero. 49 | * This variable is used in the calculation of the isDone method. 50 | * Only after all data has been returned to the connection are we actually done. 51 | * 52 | * readOffset 53 | * Represents the offset of the file descriptor. 54 | * In other words, the file position indidcator for our read stream. 55 | * It might be easy to think of it as the total number of bytes that have been read from the file. 56 | * However, this isn't entirely accurate, as the setOffset: method may have caused us to 57 | * jump ahead in the file (lseek). 58 | * 59 | * readBuffer 60 | * Malloc'd buffer to hold data read from the file. 61 | * 62 | * readBufferSize 63 | * Total allocation size of malloc'd buffer. 64 | * 65 | * readBufferOffset 66 | * Represents the position in the readBuffer where we should store new bytes. 67 | * 68 | * readRequestLength 69 | * The total number of bytes that were requested from the connection. 70 | * It's OK if we return a lesser number of bytes to the connection. 71 | * It's NOT OK if we return a greater number of bytes to the connection. 72 | * Doing so would disrupt proper support for range requests. 73 | * If, however, the response is chunked then we don't need to worry about this. 74 | * Chunked responses inheritly don't support range requests. 75 | **/ -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | 4 | 5 | @interface HTTPDataResponse : NSObject 6 | { 7 | NSUInteger offset; 8 | NSData *data; 9 | } 10 | 11 | - (id)initWithData:(NSData *)data; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m: -------------------------------------------------------------------------------- 1 | #import "HTTPDataResponse.h" 2 | #import "HTTPLogging.h" 3 | 4 | #if ! __has_feature(objc_arc) 5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 6 | #endif 7 | 8 | // Log levels : off, error, warn, info, verbose 9 | // Other flags: trace 10 | static const int httpLogLevel = HTTP_LOG_LEVEL_OFF; // | HTTP_LOG_FLAG_TRACE; 11 | 12 | 13 | @implementation HTTPDataResponse 14 | 15 | - (id)initWithData:(NSData *)dataParam 16 | { 17 | if((self = [super init])) 18 | { 19 | HTTPLogTrace(); 20 | 21 | offset = 0; 22 | data = dataParam; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)dealloc 28 | { 29 | HTTPLogTrace(); 30 | 31 | } 32 | 33 | - (UInt64)contentLength 34 | { 35 | UInt64 result = (UInt64)[data length]; 36 | 37 | HTTPLogTrace2(@"%@[%p]: contentLength - %llu", THIS_FILE, self, result); 38 | 39 | return result; 40 | } 41 | 42 | - (UInt64)offset 43 | { 44 | HTTPLogTrace(); 45 | 46 | return offset; 47 | } 48 | 49 | - (void)setOffset:(UInt64)offsetParam 50 | { 51 | HTTPLogTrace2(@"%@[%p]: setOffset:%lu", THIS_FILE, self, (unsigned long)offset); 52 | 53 | offset = (NSUInteger)offsetParam; 54 | } 55 | 56 | - (NSData *)readDataOfLength:(NSUInteger)lengthParameter 57 | { 58 | HTTPLogTrace2(@"%@[%p]: readDataOfLength:%lu", THIS_FILE, self, (unsigned long)lengthParameter); 59 | 60 | NSUInteger remaining = [data length] - offset; 61 | NSUInteger length = lengthParameter < remaining ? lengthParameter : remaining; 62 | 63 | void *bytes = (void *)([data bytes] + offset); 64 | 65 | offset += length; 66 | 67 | return [NSData dataWithBytesNoCopy:bytes length:length freeWhenDone:NO]; 68 | } 69 | 70 | - (BOOL)isDone 71 | { 72 | BOOL result = (offset == [data length]); 73 | 74 | HTTPLogTrace2(@"%@[%p]: isDone - %@", THIS_FILE, self, (result ? @"YES" : @"NO")); 75 | 76 | return result; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | #import "HTTPAsyncFileResponse.h" 4 | 5 | /** 6 | * This class is designed to assist with dynamic content. 7 | * Imagine you have a file that you want to make dynamic: 8 | * 9 | * 10 | * 11 | *

ComputerName Control Panel

12 | * ... 13 | *
  • System Time: SysTime
  • 14 | * 15 | * 16 | * 17 | * Now you could generate the entire file in Objective-C, 18 | * but this would be a horribly tedious process. 19 | * Beside, you want to design the file with professional tools to make it look pretty. 20 | * 21 | * So all you have to do is escape your dynamic content like this: 22 | * 23 | * ... 24 | *

    %%ComputerName%% Control Panel

    25 | * ... 26 | *
  • System Time: %%SysTime%%
  • 27 | * 28 | * And then you create an instance of this class with: 29 | * 30 | * - separator = @"%%" 31 | * - replacementDictionary = { "ComputerName"="Black MacBook", "SysTime"="2010-04-30 03:18:24" } 32 | * 33 | * This class will then perform the replacements for you, on the fly, as it reads the file data. 34 | * This class is also asynchronous, so it will perform the file IO using its own GCD queue. 35 | * 36 | * All keys for the replacementDictionary must be NSString's. 37 | * Values for the replacementDictionary may be NSString's, or any object that 38 | * returns what you want when its description method is invoked. 39 | **/ 40 | 41 | @interface HTTPDynamicFileResponse : HTTPAsyncFileResponse 42 | { 43 | NSData *separator; 44 | NSDictionary *replacementDict; 45 | } 46 | 47 | - (id)initWithFilePath:(NSString *)filePath 48 | forConnection:(HTTPConnection *)connection 49 | separator:(NSString *)separatorStr 50 | replacementDictionary:(NSDictionary *)dictionary; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | 4 | @class HTTPConnection; 5 | 6 | 7 | @interface HTTPFileResponse : NSObject 8 | { 9 | HTTPConnection *connection; 10 | 11 | NSString *filePath; 12 | UInt64 fileLength; 13 | UInt64 fileOffset; 14 | 15 | BOOL aborted; 16 | 17 | int fileFD; 18 | void *buffer; 19 | NSUInteger bufferSize; 20 | } 21 | 22 | - (id)initWithFilePath:(NSString *)filePath forConnection:(HTTPConnection *)connection; 23 | - (NSString *)filePath; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m: -------------------------------------------------------------------------------- 1 | #import "HTTPFileResponse.h" 2 | #import "HTTPConnection.h" 3 | #import "HTTPLogging.h" 4 | 5 | #import 6 | #import 7 | 8 | #if ! __has_feature(objc_arc) 9 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 10 | #endif 11 | 12 | // Log levels : off, error, warn, info, verbose 13 | // Other flags: trace 14 | static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE; 15 | 16 | #define NULL_FD -1 17 | 18 | 19 | @implementation HTTPFileResponse 20 | 21 | - (id)initWithFilePath:(NSString *)fpath forConnection:(HTTPConnection *)parent 22 | { 23 | if((self = [super init])) 24 | { 25 | HTTPLogTrace(); 26 | 27 | connection = parent; // Parents retain children, children do NOT retain parents 28 | 29 | fileFD = NULL_FD; 30 | filePath = [[fpath copy] stringByResolvingSymlinksInPath]; 31 | if (filePath == nil) 32 | { 33 | HTTPLogWarn(@"%@: Init failed - Nil filePath", THIS_FILE); 34 | 35 | return nil; 36 | } 37 | 38 | NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil]; 39 | if (fileAttributes == nil) 40 | { 41 | HTTPLogWarn(@"%@: Init failed - Unable to get file attributes. filePath: %@", THIS_FILE, filePath); 42 | 43 | return nil; 44 | } 45 | 46 | fileLength = (UInt64)[[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue]; 47 | fileOffset = 0; 48 | 49 | aborted = NO; 50 | 51 | // We don't bother opening the file here. 52 | // If this is a HEAD request we only need to know the fileLength. 53 | } 54 | return self; 55 | } 56 | 57 | - (void)abort 58 | { 59 | HTTPLogTrace(); 60 | 61 | [connection responseDidAbort:self]; 62 | aborted = YES; 63 | } 64 | 65 | - (BOOL)openFile 66 | { 67 | HTTPLogTrace(); 68 | 69 | fileFD = open([filePath UTF8String], O_RDONLY); 70 | if (fileFD == NULL_FD) 71 | { 72 | HTTPLogError(@"%@[%p]: Unable to open file. filePath: %@", THIS_FILE, self, filePath); 73 | 74 | [self abort]; 75 | return NO; 76 | } 77 | 78 | HTTPLogVerbose(@"%@[%p]: Open fd[%i] -> %@", THIS_FILE, self, fileFD, filePath); 79 | 80 | return YES; 81 | } 82 | 83 | - (BOOL)openFileIfNeeded 84 | { 85 | if (aborted) 86 | { 87 | // The file operation has been aborted. 88 | // This could be because we failed to open the file, 89 | // or the reading process failed. 90 | return NO; 91 | } 92 | 93 | if (fileFD != NULL_FD) 94 | { 95 | // File has already been opened. 96 | return YES; 97 | } 98 | 99 | return [self openFile]; 100 | } 101 | 102 | - (UInt64)contentLength 103 | { 104 | HTTPLogTrace(); 105 | 106 | return fileLength; 107 | } 108 | 109 | - (UInt64)offset 110 | { 111 | HTTPLogTrace(); 112 | 113 | return fileOffset; 114 | } 115 | 116 | - (void)setOffset:(UInt64)offset 117 | { 118 | HTTPLogTrace2(@"%@[%p]: setOffset:%llu", THIS_FILE, self, offset); 119 | 120 | if (![self openFileIfNeeded]) 121 | { 122 | // File opening failed, 123 | // or response has been aborted due to another error. 124 | return; 125 | } 126 | 127 | fileOffset = offset; 128 | 129 | off_t result = lseek(fileFD, (off_t)offset, SEEK_SET); 130 | if (result == -1) 131 | { 132 | HTTPLogError(@"%@[%p]: lseek failed - errno(%i) filePath(%@)", THIS_FILE, self, errno, filePath); 133 | 134 | [self abort]; 135 | } 136 | } 137 | 138 | - (NSData *)readDataOfLength:(NSUInteger)length 139 | { 140 | HTTPLogTrace2(@"%@[%p]: readDataOfLength:%lu", THIS_FILE, self, (unsigned long)length); 141 | 142 | if (![self openFileIfNeeded]) 143 | { 144 | // File opening failed, 145 | // or response has been aborted due to another error. 146 | return nil; 147 | } 148 | 149 | // Determine how much data we should read. 150 | // 151 | // It is OK if we ask to read more bytes than exist in the file. 152 | // It is NOT OK to over-allocate the buffer. 153 | 154 | UInt64 bytesLeftInFile = fileLength - fileOffset; 155 | 156 | NSUInteger bytesToRead = (NSUInteger)MIN(length, bytesLeftInFile); 157 | 158 | // Make sure buffer is big enough for read request. 159 | // Do not over-allocate. 160 | 161 | if (buffer == NULL || bufferSize < bytesToRead) 162 | { 163 | bufferSize = bytesToRead; 164 | buffer = reallocf(buffer, (size_t)bufferSize); 165 | 166 | if (buffer == NULL) 167 | { 168 | HTTPLogError(@"%@[%p]: Unable to allocate buffer", THIS_FILE, self); 169 | 170 | [self abort]; 171 | return nil; 172 | } 173 | } 174 | 175 | // Perform the read 176 | 177 | HTTPLogVerbose(@"%@[%p]: Attempting to read %lu bytes from file", THIS_FILE, self, (unsigned long)bytesToRead); 178 | 179 | ssize_t result = read(fileFD, buffer, bytesToRead); 180 | 181 | // Check the results 182 | 183 | if (result < 0) 184 | { 185 | HTTPLogError(@"%@: Error(%i) reading file(%@)", THIS_FILE, errno, filePath); 186 | 187 | [self abort]; 188 | return nil; 189 | } 190 | else if (result == 0) 191 | { 192 | HTTPLogError(@"%@: Read EOF on file(%@)", THIS_FILE, filePath); 193 | 194 | [self abort]; 195 | return nil; 196 | } 197 | else // (result > 0) 198 | { 199 | HTTPLogVerbose(@"%@[%p]: Read %ld bytes from file", THIS_FILE, self, (long)result); 200 | 201 | fileOffset += result; 202 | 203 | return [NSData dataWithBytes:buffer length:result]; 204 | } 205 | } 206 | 207 | - (BOOL)isDone 208 | { 209 | BOOL result = (fileOffset == fileLength); 210 | 211 | HTTPLogTrace2(@"%@[%p]: isDone - %@", THIS_FILE, self, (result ? @"YES" : @"NO")); 212 | 213 | return result; 214 | } 215 | 216 | - (NSString *)filePath 217 | { 218 | return filePath; 219 | } 220 | 221 | - (void)dealloc 222 | { 223 | HTTPLogTrace(); 224 | 225 | if (fileFD != NULL_FD) 226 | { 227 | HTTPLogVerbose(@"%@[%p]: Close fd[%i]", THIS_FILE, self, fileFD); 228 | 229 | close(fileFD); 230 | } 231 | 232 | if (buffer) 233 | free(buffer); 234 | 235 | } 236 | 237 | @end 238 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | 4 | 5 | @interface HTTPRedirectResponse : NSObject 6 | { 7 | NSString *redirectPath; 8 | } 9 | 10 | - (id)initWithPath:(NSString *)redirectPath; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m: -------------------------------------------------------------------------------- 1 | #import "HTTPRedirectResponse.h" 2 | #import "HTTPLogging.h" 3 | 4 | #if ! __has_feature(objc_arc) 5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 6 | #endif 7 | 8 | // Log levels : off, error, warn, info, verbose 9 | // Other flags: trace 10 | static const int httpLogLevel = HTTP_LOG_LEVEL_OFF; // | HTTP_LOG_FLAG_TRACE; 11 | 12 | 13 | @implementation HTTPRedirectResponse 14 | 15 | - (id)initWithPath:(NSString *)path 16 | { 17 | if ((self = [super init])) 18 | { 19 | HTTPLogTrace(); 20 | 21 | redirectPath = [path copy]; 22 | } 23 | return self; 24 | } 25 | 26 | - (UInt64)contentLength 27 | { 28 | return 0; 29 | } 30 | 31 | - (UInt64)offset 32 | { 33 | return 0; 34 | } 35 | 36 | - (void)setOffset:(UInt64)offset 37 | { 38 | // Nothing to do 39 | } 40 | 41 | - (NSData *)readDataOfLength:(NSUInteger)length 42 | { 43 | HTTPLogTrace(); 44 | 45 | return nil; 46 | } 47 | 48 | - (BOOL)isDone 49 | { 50 | return YES; 51 | } 52 | 53 | - (NSDictionary *)httpHeaders 54 | { 55 | HTTPLogTrace(); 56 | 57 | return [NSDictionary dictionaryWithObject:redirectPath forKey:@"Location"]; 58 | } 59 | 60 | - (NSInteger)status 61 | { 62 | HTTPLogTrace(); 63 | 64 | return 302; 65 | } 66 | 67 | - (void)dealloc 68 | { 69 | HTTPLogTrace(); 70 | 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Core/WebSocket.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class HTTPMessage; 4 | @class GCDAsyncSocket; 5 | 6 | 7 | #define WebSocketDidDieNotification @"WebSocketDidDie" 8 | 9 | @interface WebSocket : NSObject 10 | { 11 | dispatch_queue_t websocketQueue; 12 | 13 | HTTPMessage *request; 14 | GCDAsyncSocket *asyncSocket; 15 | 16 | NSData *term; 17 | 18 | BOOL isStarted; 19 | BOOL isOpen; 20 | BOOL isVersion76; 21 | 22 | id __unsafe_unretained delegate; 23 | } 24 | 25 | + (BOOL)isWebSocketRequest:(HTTPMessage *)request; 26 | 27 | - (id)initWithRequest:(HTTPMessage *)request socket:(GCDAsyncSocket *)socket; 28 | 29 | /** 30 | * Delegate option. 31 | * 32 | * In most cases it will be easier to subclass WebSocket, 33 | * but some circumstances may lead one to prefer standard delegate callbacks instead. 34 | **/ 35 | @property (/* atomic */ unsafe_unretained) id delegate; 36 | 37 | /** 38 | * The WebSocket class is thread-safe, generally via it's GCD queue. 39 | * All public API methods are thread-safe, 40 | * and the subclass API methods are thread-safe as they are all invoked on the same GCD queue. 41 | **/ 42 | @property (nonatomic, readonly) dispatch_queue_t websocketQueue; 43 | 44 | /** 45 | * Public API 46 | * 47 | * These methods are automatically called by the HTTPServer. 48 | * You may invoke the stop method yourself to close the WebSocket manually. 49 | **/ 50 | - (void)start; 51 | - (void)stop; 52 | 53 | /** 54 | * Public API 55 | * 56 | * Sends a message over the WebSocket. 57 | * This method is thread-safe. 58 | **/ 59 | - (void)sendMessage:(NSString *)msg; 60 | 61 | /** 62 | * Subclass API 63 | * 64 | * These methods are designed to be overriden by subclasses. 65 | **/ 66 | - (void)didOpen; 67 | - (void)didReceiveMessage:(NSString *)msg; 68 | - (void)didClose; 69 | 70 | @end 71 | 72 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 73 | #pragma mark - 74 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 75 | 76 | /** 77 | * There are two ways to create your own custom WebSocket: 78 | * 79 | * - Subclass it and override the methods you're interested in. 80 | * - Use traditional delegate paradigm along with your own custom class. 81 | * 82 | * They both exist to allow for maximum flexibility. 83 | * In most cases it will be easier to subclass WebSocket. 84 | * However some circumstances may lead one to prefer standard delegate callbacks instead. 85 | * One such example, you're already subclassing another class, so subclassing WebSocket isn't an option. 86 | **/ 87 | 88 | @protocol WebSocketDelegate 89 | @optional 90 | 91 | - (void)webSocketDidOpen:(WebSocket *)ws; 92 | 93 | - (void)webSocket:(WebSocket *)ws didReceiveMessage:(NSString *)msg; 94 | 95 | - (void)webSocketDidClose:(WebSocket *)ws; 96 | 97 | @end -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h: -------------------------------------------------------------------------------- 1 | #import "HTTPConnection.h" 2 | 3 | @interface DAVConnection : HTTPConnection { 4 | id requestContentBody; 5 | NSOutputStream* requestContentStream; 6 | } 7 | @end 8 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m: -------------------------------------------------------------------------------- 1 | #import "DAVConnection.h" 2 | #import "HTTPMessage.h" 3 | #import "HTTPFileResponse.h" 4 | #import "HTTPAsyncFileResponse.h" 5 | #import "PUTResponse.h" 6 | #import "DELETEResponse.h" 7 | #import "DAVResponse.h" 8 | #import "HTTPLogging.h" 9 | 10 | #define HTTP_BODY_MAX_MEMORY_SIZE (1024 * 1024) 11 | #define HTTP_ASYNC_FILE_RESPONSE_THRESHOLD (16 * 1024 * 1024) 12 | 13 | static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; 14 | 15 | @implementation DAVConnection 16 | 17 | - (void) dealloc { 18 | [requestContentStream close]; 19 | 20 | } 21 | 22 | - (BOOL) supportsMethod:(NSString*)method atPath:(NSString*)path { 23 | // HTTPFileResponse & HTTPAsyncFileResponse 24 | if ([method isEqualToString:@"GET"]) return YES; 25 | if ([method isEqualToString:@"HEAD"]) return YES; 26 | 27 | // PUTResponse 28 | if ([method isEqualToString:@"PUT"]) return YES; 29 | 30 | // DELETEResponse 31 | if ([method isEqualToString:@"DELETE"]) return YES; 32 | 33 | // DAVResponse 34 | if ([method isEqualToString:@"OPTIONS"]) return YES; 35 | if ([method isEqualToString:@"PROPFIND"]) return YES; 36 | if ([method isEqualToString:@"MKCOL"]) return YES; 37 | if ([method isEqualToString:@"MOVE"]) return YES; 38 | if ([method isEqualToString:@"COPY"]) return YES; 39 | if ([method isEqualToString:@"LOCK"]) return YES; 40 | if ([method isEqualToString:@"UNLOCK"]) return YES; 41 | 42 | return NO; 43 | } 44 | 45 | - (BOOL) expectsRequestBodyFromMethod:(NSString*)method atPath:(NSString*)path { 46 | // PUTResponse 47 | if ([method isEqualToString:@"PUT"]) { 48 | return YES; 49 | } 50 | 51 | // DAVResponse 52 | if ([method isEqual:@"PROPFIND"] || [method isEqual:@"MKCOL"]) { 53 | return [request headerField:@"Content-Length"] ? YES : NO; 54 | } 55 | if ([method isEqual:@"LOCK"]) { 56 | return YES; 57 | } 58 | 59 | return NO; 60 | } 61 | 62 | - (void) prepareForBodyWithSize:(UInt64)contentLength { 63 | NSAssert(requestContentStream == nil, @"requestContentStream should be nil"); 64 | NSAssert(requestContentBody == nil, @"requestContentBody should be nil"); 65 | 66 | if (contentLength > HTTP_BODY_MAX_MEMORY_SIZE) { 67 | requestContentBody = [[NSTemporaryDirectory() stringByAppendingString:[[NSProcessInfo processInfo] globallyUniqueString]] copy]; 68 | requestContentStream = [[NSOutputStream alloc] initToFileAtPath:requestContentBody append:NO]; 69 | [requestContentStream open]; 70 | } else { 71 | requestContentBody = [[NSMutableData alloc] initWithCapacity:(NSUInteger)contentLength]; 72 | requestContentStream = nil; 73 | } 74 | } 75 | 76 | - (void) processBodyData:(NSData*)postDataChunk { 77 | NSAssert(requestContentBody != nil, @"requestContentBody should not be nil"); 78 | if (requestContentStream) { 79 | [requestContentStream write:[postDataChunk bytes] maxLength:[postDataChunk length]]; 80 | } else { 81 | [(NSMutableData*)requestContentBody appendData:postDataChunk]; 82 | } 83 | } 84 | 85 | - (void) finishBody { 86 | NSAssert(requestContentBody != nil, @"requestContentBody should not be nil"); 87 | if (requestContentStream) { 88 | [requestContentStream close]; 89 | requestContentStream = nil; 90 | } 91 | } 92 | 93 | - (void)finishResponse { 94 | NSAssert(requestContentStream == nil, @"requestContentStream should be nil"); 95 | requestContentBody = nil; 96 | 97 | [super finishResponse]; 98 | } 99 | 100 | - (NSObject*) httpResponseForMethod:(NSString*)method URI:(NSString*)path { 101 | if ([method isEqualToString:@"HEAD"] || [method isEqualToString:@"GET"]) { 102 | NSString* filePath = [self filePathForURI:path allowDirectory:NO]; 103 | if (filePath) { 104 | NSDictionary* fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:NULL]; 105 | if (fileAttributes) { 106 | if ([[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue] > HTTP_ASYNC_FILE_RESPONSE_THRESHOLD) { 107 | return [[HTTPAsyncFileResponse alloc] initWithFilePath:filePath forConnection:self]; 108 | } else { 109 | return [[HTTPFileResponse alloc] initWithFilePath:filePath forConnection:self]; 110 | } 111 | } 112 | } 113 | } 114 | 115 | if ([method isEqualToString:@"PUT"]) { 116 | NSString* filePath = [self filePathForURI:path allowDirectory:YES]; 117 | if (filePath) { 118 | if ([requestContentBody isKindOfClass:[NSString class]]) { 119 | return [[PUTResponse alloc] initWithFilePath:filePath headers:[request allHeaderFields] bodyFile:requestContentBody]; 120 | } else if ([requestContentBody isKindOfClass:[NSData class]]) { 121 | return [[PUTResponse alloc] initWithFilePath:filePath headers:[request allHeaderFields] bodyData:requestContentBody]; 122 | } else { 123 | HTTPLogError(@"Internal error"); 124 | } 125 | } 126 | } 127 | 128 | if ([method isEqualToString:@"DELETE"]) { 129 | NSString* filePath = [self filePathForURI:path allowDirectory:YES]; 130 | if (filePath) { 131 | return [[DELETEResponse alloc] initWithFilePath:filePath]; 132 | } 133 | } 134 | 135 | if ([method isEqualToString:@"OPTIONS"] || [method isEqualToString:@"PROPFIND"] || [method isEqualToString:@"MKCOL"] || 136 | [method isEqualToString:@"MOVE"] || [method isEqualToString:@"COPY"] || [method isEqualToString:@"LOCK"] || [method isEqualToString:@"UNLOCK"]) { 137 | NSString* filePath = [self filePathForURI:path allowDirectory:YES]; 138 | if (filePath) { 139 | NSString* rootPath = [config documentRoot]; 140 | NSString* resourcePath = [filePath substringFromIndex:([rootPath length] + 1)]; 141 | if (requestContentBody) { 142 | if ([requestContentBody isKindOfClass:[NSString class]]) { 143 | requestContentBody = [NSData dataWithContentsOfFile:requestContentBody]; 144 | } else if (![requestContentBody isKindOfClass:[NSData class]]) { 145 | HTTPLogError(@"Internal error"); 146 | return nil; 147 | } 148 | } 149 | return [[DAVResponse alloc] initWithMethod:method 150 | headers:[request allHeaderFields] 151 | bodyData:requestContentBody 152 | resourcePath:resourcePath 153 | rootPath:rootPath]; 154 | } 155 | } 156 | 157 | return nil; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h: -------------------------------------------------------------------------------- 1 | #import "HTTPResponse.h" 2 | 3 | @interface DAVResponse : NSObject { 4 | @private 5 | UInt64 _offset; 6 | NSMutableDictionary* _headers; 7 | NSData* _data; 8 | NSInteger _status; 9 | } 10 | - (id) initWithMethod:(NSString*)method headers:(NSDictionary*)headers bodyData:(NSData*)body resourcePath:(NSString*)resourcePath rootPath:(NSString*)rootPath; 11 | @end 12 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h: -------------------------------------------------------------------------------- 1 | #import "HTTPResponse.h" 2 | 3 | @interface DELETEResponse : NSObject { 4 | NSInteger _status; 5 | } 6 | - (id) initWithFilePath:(NSString*)path; 7 | @end 8 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m: -------------------------------------------------------------------------------- 1 | #import "DELETEResponse.h" 2 | #import "HTTPLogging.h" 3 | 4 | // HTTP methods: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 5 | // HTTP headers: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 6 | // HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 7 | 8 | static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; 9 | 10 | @implementation DELETEResponse 11 | 12 | - (id) initWithFilePath:(NSString*)path { 13 | if ((self = [super init])) { 14 | BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path]; 15 | if ([[NSFileManager defaultManager] removeItemAtPath:path error:NULL]) { 16 | _status = exists ? 200 : 204; 17 | } else { 18 | HTTPLogError(@"Failed deleting \"%@\"", path); 19 | _status = 404; 20 | } 21 | } 22 | return self; 23 | } 24 | 25 | - (UInt64) contentLength { 26 | return 0; 27 | } 28 | 29 | - (UInt64) offset { 30 | return 0; 31 | } 32 | 33 | - (void)setOffset:(UInt64)offset { 34 | ; 35 | } 36 | 37 | - (NSData*) readDataOfLength:(NSUInteger)length { 38 | return nil; 39 | } 40 | 41 | - (BOOL) isDone { 42 | return YES; 43 | } 44 | 45 | - (NSInteger) status { 46 | return _status; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h: -------------------------------------------------------------------------------- 1 | #import "HTTPResponse.h" 2 | 3 | @interface PUTResponse : NSObject { 4 | NSInteger _status; 5 | } 6 | - (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyData:(NSData*)body; 7 | - (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyFile:(NSString*)body; 8 | @end 9 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m: -------------------------------------------------------------------------------- 1 | #import "PUTResponse.h" 2 | #import "HTTPLogging.h" 3 | 4 | // HTTP methods: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 5 | // HTTP headers: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 6 | // HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 7 | 8 | static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; 9 | 10 | @implementation PUTResponse 11 | 12 | - (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers body:(id)body { 13 | if ((self = [super init])) { 14 | if ([headers objectForKey:@"Content-Range"]) { 15 | HTTPLogError(@"Content-Range not supported for upload to \"%@\"", path); 16 | _status = 400; 17 | } else { 18 | BOOL overwrite = [[NSFileManager defaultManager] fileExistsAtPath:path]; 19 | BOOL success; 20 | if ([body isKindOfClass:[NSString class]]) { 21 | [[NSFileManager defaultManager] removeItemAtPath:path error:NULL]; 22 | success = [[NSFileManager defaultManager] moveItemAtPath:body toPath:path error:NULL]; 23 | } else { 24 | success = [body writeToFile:path atomically:YES]; 25 | } 26 | if (success) { 27 | _status = overwrite ? 200 : 201; 28 | } else { 29 | HTTPLogError(@"Failed writing upload to \"%@\"", path); 30 | _status = 403; 31 | } 32 | } 33 | } 34 | return self; 35 | } 36 | 37 | - (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyData:(NSData*)body { 38 | return [self initWithFilePath:path headers:headers body:body]; 39 | } 40 | 41 | - (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyFile:(NSString*)body { 42 | return [self initWithFilePath:path headers:headers body:body]; 43 | } 44 | 45 | - (UInt64) contentLength { 46 | return 0; 47 | } 48 | 49 | - (UInt64) offset { 50 | return 0; 51 | } 52 | 53 | - (void) setOffset:(UInt64)offset { 54 | ; 55 | } 56 | 57 | - (NSData*) readDataOfLength:(NSUInteger)length { 58 | return nil; 59 | } 60 | 61 | - (BOOL) isDone { 62 | return YES; 63 | } 64 | 65 | - (NSInteger) status { 66 | return _status; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2011, Deusty, LLC 4 | All rights reserved. 5 | 6 | Redistribution and use of this software in source and binary forms, 7 | with or without modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above 10 | copyright notice, this list of conditions and the 11 | following disclaimer. 12 | 13 | * Neither the name of Deusty nor the names of its 14 | contributors may be used to endorse or promote products 15 | derived from this software without specific prior 16 | written permission of Deusty, LLC. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Pods/CocoaHTTPServer/README.markdown: -------------------------------------------------------------------------------- 1 | CocoaHTTPServer is a small, lightweight, embeddable HTTP server for Mac OS X or iOS applications. 2 | 3 | Sometimes developers need an embedded HTTP server in their app. Perhaps it's a server application with remote monitoring. Or perhaps it's a desktop application using HTTP for the communication backend. Or perhaps it's an iOS app providing over-the-air access to documents. Whatever your reason, CocoaHTTPServer can get the job done. It provides: 4 | 5 | - Built in support for bonjour broadcasting 6 | - IPv4 and IPv6 support 7 | - Asynchronous networking using GCD and standard sockets 8 | - Password protection support 9 | - SSL/TLS encryption support 10 | - Extremely FAST and memory efficient 11 | - Extremely scalable (built entirely upon GCD) 12 | - Heavily commented code 13 | - Very easily extensible 14 | - WebDAV is supported too! 15 | 16 |
    17 | Can't find the answer to your question in any of the [wiki](https://github.com/robbiehanson/CocoaHTTPServer/wiki) articles? Try the **[mailing list](http://groups.google.com/group/cocoahttpserver)**. 18 |
    19 |
    20 | Love the project? Wanna buy me a coffee? (or a beer :D) [![donation](http://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BHF2DJRETGV5S) 21 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/CocoaLumberjack.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | /** 17 | * Welcome to CocoaLumberjack! 18 | * 19 | * The project page has a wealth of documentation if you have any questions. 20 | * https://github.com/CocoaLumberjack/CocoaLumberjack 21 | * 22 | * If you're new to the project you may wish to read "Getting Started" at: 23 | * Documentation/GettingStarted.md 24 | * 25 | * Otherwise, here is a quick refresher. 26 | * There are three steps to using the macros: 27 | * 28 | * Step 1: 29 | * Import the header in your implementation or prefix file: 30 | * 31 | * #import 32 | * 33 | * Step 2: 34 | * Define your logging level in your implementation file: 35 | * 36 | * // Log levels: off, error, warn, info, verbose 37 | * static const DDLogLevel ddLogLevel = DDLogLevelVerbose; 38 | * 39 | * Step 2 [3rd party frameworks]: 40 | * 41 | * Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel: 42 | * 43 | * // #undef LOG_LEVEL_DEF // Undefine first only if needed 44 | * #define LOG_LEVEL_DEF myLibLogLevel 45 | * 46 | * Define your logging level in your implementation file: 47 | * 48 | * // Log levels: off, error, warn, info, verbose 49 | * static const DDLogLevel myLibLogLevel = DDLogLevelVerbose; 50 | * 51 | * Step 3: 52 | * Replace your NSLog statements with DDLog statements according to the severity of the message. 53 | * 54 | * NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!"); 55 | * 56 | * DDLog works exactly the same as NSLog. 57 | * This means you can pass it multiple variables just like NSLog. 58 | **/ 59 | 60 | #import 61 | 62 | // Disable legacy macros 63 | #ifndef DD_LEGACY_MACROS 64 | #define DD_LEGACY_MACROS 0 65 | #endif 66 | 67 | // Core 68 | #import "DDLog.h" 69 | 70 | // Main macros 71 | #import "DDLogMacros.h" 72 | #import "DDAssertMacros.h" 73 | 74 | // Capture ASL 75 | #import "DDASLLogCapture.h" 76 | 77 | // Loggers 78 | #import "DDTTYLogger.h" 79 | #import "DDASLLogger.h" 80 | #import "DDFileLogger.h" 81 | #import "DDOSLogger.h" 82 | 83 | // CLI 84 | #if __has_include("CLIColor.h") && TARGET_OS_OSX 85 | #import "CLIColor.h" 86 | #endif 87 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/CocoaLumberjack.swift: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2014-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | import Foundation 17 | 18 | extension DDLogFlag { 19 | public static func from(_ logLevel: DDLogLevel) -> DDLogFlag { 20 | return DDLogFlag(rawValue: logLevel.rawValue) 21 | } 22 | 23 | public init(_ logLevel: DDLogLevel) { 24 | self = DDLogFlag(rawValue: logLevel.rawValue) 25 | } 26 | 27 | ///returns the log level, or the lowest equivalant. 28 | public func toLogLevel() -> DDLogLevel { 29 | if let ourValid = DDLogLevel(rawValue: rawValue) { 30 | return ourValid 31 | } else { 32 | if contains(.verbose) { 33 | return .verbose 34 | } else if contains(.debug) { 35 | return .debug 36 | } else if contains(.info) { 37 | return .info 38 | } else if contains(.warning) { 39 | return .warning 40 | } else if contains(.error) { 41 | return .error 42 | } else { 43 | return .off 44 | } 45 | } 46 | } 47 | } 48 | 49 | public var defaultDebugLevel = DDLogLevel.verbose 50 | 51 | public func resetDefaultDebugLevel() { 52 | defaultDebugLevel = DDLogLevel.verbose 53 | } 54 | 55 | public func _DDLogMessage(_ message: @autoclosure () -> String, level: DDLogLevel, flag: DDLogFlag, context: Int, file: StaticString, function: StaticString, line: UInt, tag: Any?, asynchronous: Bool, ddlog: DDLog) { 56 | if level.rawValue & flag.rawValue != 0 { 57 | // Tell the DDLogMessage constructor to copy the C strings that get passed to it. 58 | let logMessage = DDLogMessage(message: message(), level: level, flag: flag, context: context, file: String(describing: file), function: String(describing: function), line: line, tag: tag, options: [.copyFile, .copyFunction], timestamp: nil) 59 | ddlog.log(asynchronous: asynchronous, message: logMessage) 60 | } 61 | } 62 | 63 | public func DDLogDebug(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { 64 | _DDLogMessage(message, level: level, flag: .debug, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) 65 | } 66 | 67 | public func DDLogInfo(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { 68 | _DDLogMessage(message, level: level, flag: .info, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) 69 | } 70 | 71 | public func DDLogWarn(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { 72 | _DDLogMessage(message, level: level, flag: .warning, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) 73 | } 74 | 75 | public func DDLogVerbose(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) { 76 | _DDLogMessage(message, level: level, flag: .verbose, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) 77 | } 78 | 79 | public func DDLogError(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) { 80 | _DDLogMessage(message, level: level, flag: .error, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog) 81 | } 82 | 83 | /// Returns a String of the current filename, without full path or extension. 84 | /// 85 | /// Analogous to the C preprocessor macro `THIS_FILE`. 86 | public func CurrentFileName(_ fileName: StaticString = #file) -> String { 87 | var str = String(describing: fileName) 88 | if let idx = str.range(of: "/", options: .backwards)?.upperBound { 89 | str = String(str[idx...]) 90 | } 91 | if let idx = str.range(of: ".", options: .backwards)?.lowerBound { 92 | str = String(str[.. 17 | 18 | // Disable legacy macros 19 | #ifndef DD_LEGACY_MACROS 20 | #define DD_LEGACY_MACROS 0 21 | #endif 22 | 23 | #import "DDLog.h" 24 | 25 | // Custom key set on messages sent to ASL 26 | extern const char* const kDDASLKeyDDLog; 27 | 28 | // Value set for kDDASLKeyDDLog 29 | extern const char* const kDDASLDDLogValue; 30 | 31 | /** 32 | * This class provides a logger for the Apple System Log facility. 33 | * 34 | * As described in the "Getting Started" page, 35 | * the traditional NSLog() function directs its output to two places: 36 | * 37 | * - Apple System Log 38 | * - StdErr (if stderr is a TTY) so log statements show up in Xcode console 39 | * 40 | * To duplicate NSLog() functionality you can simply add this logger and a tty logger. 41 | * However, if you instead choose to use file logging (for faster performance), 42 | * you may choose to use a file logger and a tty logger. 43 | **/ 44 | @interface DDASLLogger : DDAbstractLogger 45 | 46 | /** 47 | * Singleton method 48 | * 49 | * @return the shared instance 50 | */ 51 | @property (class, readonly, strong) DDASLLogger *sharedInstance; 52 | 53 | // Inherited from DDAbstractLogger 54 | 55 | // - (id )logFormatter; 56 | // - (void)setLogFormatter:(id )formatter; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDASLLogger.m: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import "DDASLLogger.h" 17 | #import 18 | 19 | #if !__has_feature(objc_arc) 20 | #error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 21 | #endif 22 | 23 | const char* const kDDASLKeyDDLog = "DDLog"; 24 | 25 | const char* const kDDASLDDLogValue = "1"; 26 | 27 | static DDASLLogger *sharedInstance; 28 | 29 | @interface DDASLLogger () { 30 | aslclient _client; 31 | } 32 | 33 | @end 34 | 35 | 36 | @implementation DDASLLogger 37 | 38 | + (instancetype)sharedInstance { 39 | static dispatch_once_t DDASLLoggerOnceToken; 40 | 41 | dispatch_once(&DDASLLoggerOnceToken, ^{ 42 | sharedInstance = [[[self class] alloc] init]; 43 | }); 44 | 45 | return sharedInstance; 46 | } 47 | 48 | - (instancetype)init { 49 | if (sharedInstance != nil) { 50 | return nil; 51 | } 52 | 53 | if ((self = [super init])) { 54 | // A default asl client is provided for the main thread, 55 | // but background threads need to create their own client. 56 | 57 | _client = asl_open(NULL, "com.apple.console", 0); 58 | } 59 | 60 | return self; 61 | } 62 | 63 | - (void)logMessage:(DDLogMessage *)logMessage { 64 | // Skip captured log messages 65 | if ([logMessage->_fileName isEqualToString:@"DDASLLogCapture"]) { 66 | return; 67 | } 68 | 69 | NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message; 70 | 71 | if (message) { 72 | const char *msg = [message UTF8String]; 73 | 74 | size_t aslLogLevel; 75 | switch (logMessage->_flag) { 76 | // Note: By default ASL will filter anything above level 5 (Notice). 77 | // So our mappings shouldn't go above that level. 78 | case DDLogFlagError : aslLogLevel = ASL_LEVEL_CRIT; break; 79 | case DDLogFlagWarning : aslLogLevel = ASL_LEVEL_ERR; break; 80 | case DDLogFlagInfo : aslLogLevel = ASL_LEVEL_WARNING; break; // Regular NSLog's level 81 | case DDLogFlagDebug : 82 | case DDLogFlagVerbose : 83 | default : aslLogLevel = ASL_LEVEL_NOTICE; break; 84 | } 85 | 86 | static char const *const level_strings[] = { "0", "1", "2", "3", "4", "5", "6", "7" }; 87 | 88 | // NSLog uses the current euid to set the ASL_KEY_READ_UID. 89 | uid_t const readUID = geteuid(); 90 | 91 | char readUIDString[16]; 92 | #ifndef NS_BLOCK_ASSERTIONS 93 | size_t l = snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); 94 | #else 95 | snprintf(readUIDString, sizeof(readUIDString), "%d", readUID); 96 | #endif 97 | 98 | NSAssert(l < sizeof(readUIDString), 99 | @"Formatted euid is too long."); 100 | NSAssert(aslLogLevel < (sizeof(level_strings) / sizeof(level_strings[0])), 101 | @"Unhandled ASL log level."); 102 | 103 | aslmsg m = asl_new(ASL_TYPE_MSG); 104 | if (m != NULL) { 105 | if (asl_set(m, ASL_KEY_LEVEL, level_strings[aslLogLevel]) == 0 && 106 | asl_set(m, ASL_KEY_MSG, msg) == 0 && 107 | asl_set(m, ASL_KEY_READ_UID, readUIDString) == 0 && 108 | asl_set(m, kDDASLKeyDDLog, kDDASLDDLogValue) == 0) { 109 | asl_send(_client, m); 110 | } 111 | asl_free(m); 112 | } 113 | //TODO handle asl_* failures non-silently? 114 | } 115 | } 116 | 117 | - (NSString *)loggerName { 118 | return @"cocoa.lumberjack.aslLogger"; 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | // Disable legacy macros 17 | #ifndef DD_LEGACY_MACROS 18 | #define DD_LEGACY_MACROS 0 19 | #endif 20 | 21 | #import "DDLog.h" 22 | 23 | /** 24 | * This class provides an abstract implementation of a database logger. 25 | * 26 | * That is, it provides the base implementation for a database logger to build atop of. 27 | * All that is needed for a concrete database logger is to extend this class 28 | * and override the methods in the implementation file that are prefixed with "db_". 29 | **/ 30 | @interface DDAbstractDatabaseLogger : DDAbstractLogger { 31 | 32 | @protected 33 | NSUInteger _saveThreshold; 34 | NSTimeInterval _saveInterval; 35 | NSTimeInterval _maxAge; 36 | NSTimeInterval _deleteInterval; 37 | BOOL _deleteOnEverySave; 38 | 39 | BOOL _saveTimerSuspended; 40 | NSUInteger _unsavedCount; 41 | dispatch_time_t _unsavedTime; 42 | dispatch_source_t _saveTimer; 43 | dispatch_time_t _lastDeleteTime; 44 | dispatch_source_t _deleteTimer; 45 | } 46 | 47 | /** 48 | * Specifies how often to save the data to disk. 49 | * Since saving is an expensive operation (disk io) it is not done after every log statement. 50 | * These properties allow you to configure how/when the logger saves to disk. 51 | * 52 | * A save is done when either (whichever happens first): 53 | * 54 | * - The number of unsaved log entries reaches saveThreshold 55 | * - The amount of time since the oldest unsaved log entry was created reaches saveInterval 56 | * 57 | * You can optionally disable the saveThreshold by setting it to zero. 58 | * If you disable the saveThreshold you are entirely dependent on the saveInterval. 59 | * 60 | * You can optionally disable the saveInterval by setting it to zero (or a negative value). 61 | * If you disable the saveInterval you are entirely dependent on the saveThreshold. 62 | * 63 | * It's not wise to disable both saveThreshold and saveInterval. 64 | * 65 | * The default saveThreshold is 500. 66 | * The default saveInterval is 60 seconds. 67 | **/ 68 | @property (assign, readwrite) NSUInteger saveThreshold; 69 | 70 | /** 71 | * See the description for the `saveThreshold` property 72 | */ 73 | @property (assign, readwrite) NSTimeInterval saveInterval; 74 | 75 | /** 76 | * It is likely you don't want the log entries to persist forever. 77 | * Doing so would allow the database to grow infinitely large over time. 78 | * 79 | * The maxAge property provides a way to specify how old a log statement can get 80 | * before it should get deleted from the database. 81 | * 82 | * The deleteInterval specifies how often to sweep for old log entries. 83 | * Since deleting is an expensive operation (disk io) is is done on a fixed interval. 84 | * 85 | * An alternative to the deleteInterval is the deleteOnEverySave option. 86 | * This specifies that old log entries should be deleted during every save operation. 87 | * 88 | * You can optionally disable the maxAge by setting it to zero (or a negative value). 89 | * If you disable the maxAge then old log statements are not deleted. 90 | * 91 | * You can optionally disable the deleteInterval by setting it to zero (or a negative value). 92 | * 93 | * If you disable both deleteInterval and deleteOnEverySave then old log statements are not deleted. 94 | * 95 | * It's not wise to enable both deleteInterval and deleteOnEverySave. 96 | * 97 | * The default maxAge is 7 days. 98 | * The default deleteInterval is 5 minutes. 99 | * The default deleteOnEverySave is NO. 100 | **/ 101 | @property (assign, readwrite) NSTimeInterval maxAge; 102 | 103 | /** 104 | * See the description for the `maxAge` property 105 | */ 106 | @property (assign, readwrite) NSTimeInterval deleteInterval; 107 | 108 | /** 109 | * See the description for the `maxAge` property 110 | */ 111 | @property (assign, readwrite) BOOL deleteOnEverySave; 112 | 113 | /** 114 | * Forces a save of any pending log entries (flushes log entries to disk). 115 | **/ 116 | - (void)savePendingLogEntries; 117 | 118 | /** 119 | * Removes any log entries that are older than maxAge. 120 | **/ 121 | - (void)deleteOldLogEntries; 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDAssertMacros.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | /** 17 | * NSAsset replacement that will output a log message even when assertions are disabled. 18 | **/ 19 | #define DDAssert(condition, frmt, ...) \ 20 | if (!(condition)) { \ 21 | NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \ 22 | DDLogError(@"%@", description); \ 23 | NSAssert(NO, description); \ 24 | } 25 | #define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition) 26 | 27 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDLegacyMacros.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | /** 17 | * Legacy macros used for 1.9.x backwards compatibility. 18 | * 19 | * Imported by default when importing a DDLog.h directly and DD_LEGACY_MACROS is not defined and set to 0. 20 | **/ 21 | #if DD_LEGACY_MACROS 22 | 23 | #warning CocoaLumberjack 1.9.x legacy macros enabled. \ 24 | Disable legacy macros by importing CocoaLumberjack.h or DDLogMacros.h instead of DDLog.h or add `#define DD_LEGACY_MACROS 0` before importing DDLog.h. 25 | 26 | #ifndef LOG_LEVEL_DEF 27 | #define LOG_LEVEL_DEF ddLogLevel 28 | #endif 29 | 30 | #define LOG_FLAG_ERROR DDLogFlagError 31 | #define LOG_FLAG_WARN DDLogFlagWarning 32 | #define LOG_FLAG_INFO DDLogFlagInfo 33 | #define LOG_FLAG_DEBUG DDLogFlagDebug 34 | #define LOG_FLAG_VERBOSE DDLogFlagVerbose 35 | 36 | #define LOG_LEVEL_OFF DDLogLevelOff 37 | #define LOG_LEVEL_ERROR DDLogLevelError 38 | #define LOG_LEVEL_WARN DDLogLevelWarning 39 | #define LOG_LEVEL_INFO DDLogLevelInfo 40 | #define LOG_LEVEL_DEBUG DDLogLevelDebug 41 | #define LOG_LEVEL_VERBOSE DDLogLevelVerbose 42 | #define LOG_LEVEL_ALL DDLogLevelAll 43 | 44 | #define LOG_ASYNC_ENABLED YES 45 | 46 | #define LOG_ASYNC_ERROR ( NO && LOG_ASYNC_ENABLED) 47 | #define LOG_ASYNC_WARN (YES && LOG_ASYNC_ENABLED) 48 | #define LOG_ASYNC_INFO (YES && LOG_ASYNC_ENABLED) 49 | #define LOG_ASYNC_DEBUG (YES && LOG_ASYNC_ENABLED) 50 | #define LOG_ASYNC_VERBOSE (YES && LOG_ASYNC_ENABLED) 51 | 52 | #define LOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \ 53 | [DDLog log : isAsynchronous \ 54 | level : lvl \ 55 | flag : flg \ 56 | context : ctx \ 57 | file : __FILE__ \ 58 | function : fnct \ 59 | line : __LINE__ \ 60 | tag : atag \ 61 | format : (frmt), ## __VA_ARGS__] 62 | 63 | #define LOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \ 64 | do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0) 65 | 66 | #define LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \ 67 | LOG_MAYBE(async, lvl, flg, ctx, __PRETTY_FUNCTION__, frmt, ## __VA_ARGS__) 68 | 69 | #define DDLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, LOG_LEVEL_DEF, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__) 70 | #define DDLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, LOG_LEVEL_DEF, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__) 71 | #define DDLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, LOG_LEVEL_DEF, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__) 72 | #define DDLogDebug(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_DEBUG, LOG_LEVEL_DEF, LOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__) 73 | #define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, LOG_LEVEL_DEF, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__) 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDLog+LOGV.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | // Disable legacy macros 17 | #ifndef DD_LEGACY_MACROS 18 | #define DD_LEGACY_MACROS 0 19 | #endif 20 | 21 | #import "DDLog.h" 22 | 23 | /** 24 | * The constant/variable/method responsible for controlling the current log level. 25 | **/ 26 | #ifndef LOG_LEVEL_DEF 27 | #define LOG_LEVEL_DEF ddLogLevel 28 | #endif 29 | 30 | /** 31 | * Whether async should be used by log messages, excluding error messages that are always sent sync. 32 | **/ 33 | #ifndef LOG_ASYNC_ENABLED 34 | #define LOG_ASYNC_ENABLED YES 35 | #endif 36 | 37 | /** 38 | * This is the single macro that all other macros below compile into. 39 | * This big multiline macro makes all the other macros easier to read. 40 | **/ 41 | #define LOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, avalist) \ 42 | [DDLog log : isAsynchronous \ 43 | level : lvl \ 44 | flag : flg \ 45 | context : ctx \ 46 | file : __FILE__ \ 47 | function : fnct \ 48 | line : __LINE__ \ 49 | tag : atag \ 50 | format : frmt \ 51 | args : avalist] 52 | 53 | /** 54 | * Define version of the macro that only execute if the log level is above the threshold. 55 | * The compiled versions essentially look like this: 56 | * 57 | * if (logFlagForThisLogMsg & ddLogLevel) { execute log message } 58 | * 59 | * When LOG_LEVEL_DEF is defined as ddLogLevel. 60 | * 61 | * As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels. 62 | * This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques. 63 | * 64 | * Note that when compiler optimizations are enabled (as they are for your release builds), 65 | * the log messages above your logging threshold will automatically be compiled out. 66 | * 67 | * (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see 68 | * if the 'if' statement would execute, and if not it strips it from the binary.) 69 | * 70 | * We also define shorthand versions for asynchronous and synchronous logging. 71 | **/ 72 | #define LOGV_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \ 73 | do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0) 74 | 75 | /** 76 | * Ready to use log macros with no context or tag. 77 | **/ 78 | #define DDLogVError(frmt, avalist) LOGV_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) 79 | #define DDLogVWarn(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) 80 | #define DDLogVInfo(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) 81 | #define DDLogVDebug(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) 82 | #define DDLogVVerbose(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, avalist) 83 | 84 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDLogMacros.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | // Disable legacy macros 17 | #ifndef DD_LEGACY_MACROS 18 | #define DD_LEGACY_MACROS 0 19 | #endif 20 | 21 | #import "DDLog.h" 22 | 23 | /** 24 | * The constant/variable/method responsible for controlling the current log level. 25 | **/ 26 | #ifndef LOG_LEVEL_DEF 27 | #define LOG_LEVEL_DEF ddLogLevel 28 | #endif 29 | 30 | /** 31 | * Whether async should be used by log messages, excluding error messages that are always sent sync. 32 | **/ 33 | #ifndef LOG_ASYNC_ENABLED 34 | #define LOG_ASYNC_ENABLED YES 35 | #endif 36 | 37 | /** 38 | * These are the two macros that all other macros below compile into. 39 | * These big multiline macros makes all the other macros easier to read. 40 | **/ 41 | #define LOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \ 42 | [DDLog log : isAsynchronous \ 43 | level : lvl \ 44 | flag : flg \ 45 | context : ctx \ 46 | file : __FILE__ \ 47 | function : fnct \ 48 | line : __LINE__ \ 49 | tag : atag \ 50 | format : (frmt), ## __VA_ARGS__] 51 | 52 | #define LOG_MACRO_TO_DDLOG(ddlog, isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \ 53 | [ddlog log : isAsynchronous \ 54 | level : lvl \ 55 | flag : flg \ 56 | context : ctx \ 57 | file : __FILE__ \ 58 | function : fnct \ 59 | line : __LINE__ \ 60 | tag : atag \ 61 | format : (frmt), ## __VA_ARGS__] 62 | 63 | /** 64 | * Define version of the macro that only execute if the log level is above the threshold. 65 | * The compiled versions essentially look like this: 66 | * 67 | * if (logFlagForThisLogMsg & ddLogLevel) { execute log message } 68 | * 69 | * When LOG_LEVEL_DEF is defined as ddLogLevel. 70 | * 71 | * As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels. 72 | * This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques. 73 | * 74 | * Note that when compiler optimizations are enabled (as they are for your release builds), 75 | * the log messages above your logging threshold will automatically be compiled out. 76 | * 77 | * (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see 78 | * if the 'if' statement would execute, and if not it strips it from the binary.) 79 | * 80 | * We also define shorthand versions for asynchronous and synchronous logging. 81 | **/ 82 | #define LOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \ 83 | do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0) 84 | 85 | #define LOG_MAYBE_TO_DDLOG(ddlog, async, lvl, flg, ctx, tag, fnct, frmt, ...) \ 86 | do { if(lvl & flg) LOG_MACRO_TO_DDLOG(ddlog, async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0) 87 | 88 | /** 89 | * Ready to use log macros with no context or tag. 90 | **/ 91 | #define DDLogError(frmt, ...) LOG_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 92 | #define DDLogWarn(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 93 | #define DDLogInfo(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 94 | #define DDLogDebug(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 95 | #define DDLogVerbose(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 96 | 97 | #define DDLogErrorToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 98 | #define DDLogWarnToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 99 | #define DDLogInfoToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 100 | #define DDLogDebugToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 101 | #define DDLogVerboseToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) 102 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDOSLogger.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import 17 | 18 | // Disable legacy macros 19 | #ifndef DD_LEGACY_MACROS 20 | #define DD_LEGACY_MACROS 0 21 | #endif 22 | 23 | #import "DDLog.h" 24 | 25 | /** 26 | * This class provides a logger for the Apple os_log facility. 27 | **/ 28 | @interface DDOSLogger : DDAbstractLogger 29 | 30 | /** 31 | * Singleton method 32 | * 33 | * @return the shared instance 34 | */ 35 | @property (class, readonly, strong) DDOSLogger *sharedInstance; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDOSLogger.m: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import "DDOSLogger.h" 17 | #import 18 | 19 | static DDOSLogger *sharedInstance; 20 | 21 | @implementation DDOSLogger 22 | 23 | + (instancetype)sharedInstance { 24 | static dispatch_once_t DDOSLoggerOnceToken; 25 | 26 | dispatch_once(&DDOSLoggerOnceToken, ^{ 27 | sharedInstance = [[[self class] alloc] init]; 28 | }); 29 | 30 | return sharedInstance; 31 | } 32 | 33 | - (instancetype)init { 34 | if (sharedInstance != nil) { 35 | return nil; 36 | } 37 | 38 | if (self = [super init]) { 39 | return self; 40 | } 41 | 42 | return nil; 43 | } 44 | 45 | - (void)logMessage:(DDLogMessage *)logMessage { 46 | // Skip captured log messages 47 | if ([logMessage->_fileName isEqualToString:@"DDASLLogCapture"]) { 48 | return; 49 | } 50 | 51 | if(@available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)) { 52 | 53 | NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message; 54 | if (message) { 55 | const char *msg = [message UTF8String]; 56 | 57 | switch (logMessage->_flag) { 58 | case DDLogFlagError : 59 | os_log_error(OS_LOG_DEFAULT, "%{public}s", msg); 60 | break; 61 | case DDLogFlagWarning : 62 | case DDLogFlagInfo : 63 | os_log_info(OS_LOG_DEFAULT, "%{public}s", msg); 64 | break; 65 | case DDLogFlagDebug : 66 | case DDLogFlagVerbose : 67 | default : 68 | os_log_debug(OS_LOG_DEFAULT, "%{public}s", msg); 69 | break; 70 | } 71 | } 72 | 73 | } 74 | 75 | } 76 | 77 | - (NSString *)loggerName { 78 | return @"cocoa.lumberjack.osLogger"; 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/Extensions/DDContextFilterLogFormatter.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import 17 | 18 | // Disable legacy macros 19 | #ifndef DD_LEGACY_MACROS 20 | #define DD_LEGACY_MACROS 0 21 | #endif 22 | 23 | #import "DDLog.h" 24 | 25 | /** 26 | * This class provides a log formatter that filters log statements from a logging context not on the whitelist. 27 | * 28 | * A log formatter can be added to any logger to format and/or filter its output. 29 | * You can learn more about log formatters here: 30 | * Documentation/CustomFormatters.md 31 | * 32 | * You can learn more about logging context's here: 33 | * Documentation/CustomContext.md 34 | * 35 | * But here's a quick overview / refresher: 36 | * 37 | * Every log statement has a logging context. 38 | * These come from the underlying logging macros defined in DDLog.h. 39 | * The default logging context is zero. 40 | * You can define multiple logging context's for use in your application. 41 | * For example, logically separate parts of your app each have a different logging context. 42 | * Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context. 43 | **/ 44 | @interface DDContextWhitelistFilterLogFormatter : NSObject 45 | 46 | /** 47 | * Designated default initializer 48 | */ 49 | - (instancetype)init NS_DESIGNATED_INITIALIZER; 50 | 51 | /** 52 | * Add a context to the whitelist 53 | * 54 | * @param loggingContext the context 55 | */ 56 | - (void)addToWhitelist:(NSUInteger)loggingContext; 57 | 58 | /** 59 | * Remove context from whitelist 60 | * 61 | * @param loggingContext the context 62 | */ 63 | - (void)removeFromWhitelist:(NSUInteger)loggingContext; 64 | 65 | /** 66 | * Return the whitelist 67 | */ 68 | @property (readonly, copy) NSArray *whitelist; 69 | 70 | /** 71 | * Check if a context is on the whitelist 72 | * 73 | * @param loggingContext the context 74 | */ 75 | - (BOOL)isOnWhitelist:(NSUInteger)loggingContext; 76 | 77 | @end 78 | 79 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 80 | #pragma mark - 81 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 82 | 83 | /** 84 | * This class provides a log formatter that filters log statements from a logging context on the blacklist. 85 | **/ 86 | @interface DDContextBlacklistFilterLogFormatter : NSObject 87 | 88 | - (instancetype)init NS_DESIGNATED_INITIALIZER; 89 | 90 | /** 91 | * Add a context to the blacklist 92 | * 93 | * @param loggingContext the context 94 | */ 95 | - (void)addToBlacklist:(NSUInteger)loggingContext; 96 | 97 | /** 98 | * Remove context from blacklist 99 | * 100 | * @param loggingContext the context 101 | */ 102 | - (void)removeFromBlacklist:(NSUInteger)loggingContext; 103 | 104 | /** 105 | * Return the blacklist 106 | */ 107 | @property (readonly, copy) NSArray *blacklist; 108 | 109 | 110 | /** 111 | * Check if a context is on the blacklist 112 | * 113 | * @param loggingContext the context 114 | */ 115 | - (BOOL)isOnBlacklist:(NSUInteger)loggingContext; 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/Extensions/DDContextFilterLogFormatter.m: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import "DDContextFilterLogFormatter.h" 17 | #import 18 | 19 | #if !__has_feature(objc_arc) 20 | #error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 21 | #endif 22 | 23 | @interface DDLoggingContextSet : NSObject 24 | 25 | - (void)addToSet:(NSUInteger)loggingContext; 26 | - (void)removeFromSet:(NSUInteger)loggingContext; 27 | 28 | @property (readonly, copy) NSArray *currentSet; 29 | 30 | - (BOOL)isInSet:(NSUInteger)loggingContext; 31 | 32 | @end 33 | 34 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 35 | #pragma mark - 36 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 37 | 38 | @interface DDContextWhitelistFilterLogFormatter () { 39 | DDLoggingContextSet *_contextSet; 40 | } 41 | 42 | @end 43 | 44 | 45 | @implementation DDContextWhitelistFilterLogFormatter 46 | 47 | - (instancetype)init { 48 | if ((self = [super init])) { 49 | _contextSet = [[DDLoggingContextSet alloc] init]; 50 | } 51 | 52 | return self; 53 | } 54 | 55 | - (void)addToWhitelist:(NSUInteger)loggingContext { 56 | [_contextSet addToSet:loggingContext]; 57 | } 58 | 59 | - (void)removeFromWhitelist:(NSUInteger)loggingContext { 60 | [_contextSet removeFromSet:loggingContext]; 61 | } 62 | 63 | - (NSArray *)whitelist { 64 | return [_contextSet currentSet]; 65 | } 66 | 67 | - (BOOL)isOnWhitelist:(NSUInteger)loggingContext { 68 | return [_contextSet isInSet:loggingContext]; 69 | } 70 | 71 | - (NSString *)formatLogMessage:(DDLogMessage *)logMessage { 72 | if ([self isOnWhitelist:logMessage->_context]) { 73 | return logMessage->_message; 74 | } else { 75 | return nil; 76 | } 77 | } 78 | 79 | @end 80 | 81 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 82 | #pragma mark - 83 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 84 | 85 | @interface DDContextBlacklistFilterLogFormatter () { 86 | DDLoggingContextSet *_contextSet; 87 | } 88 | 89 | @end 90 | 91 | 92 | @implementation DDContextBlacklistFilterLogFormatter 93 | 94 | - (instancetype)init { 95 | if ((self = [super init])) { 96 | _contextSet = [[DDLoggingContextSet alloc] init]; 97 | } 98 | 99 | return self; 100 | } 101 | 102 | - (void)addToBlacklist:(NSUInteger)loggingContext { 103 | [_contextSet addToSet:loggingContext]; 104 | } 105 | 106 | - (void)removeFromBlacklist:(NSUInteger)loggingContext { 107 | [_contextSet removeFromSet:loggingContext]; 108 | } 109 | 110 | - (NSArray *)blacklist { 111 | return [_contextSet currentSet]; 112 | } 113 | 114 | - (BOOL)isOnBlacklist:(NSUInteger)loggingContext { 115 | return [_contextSet isInSet:loggingContext]; 116 | } 117 | 118 | - (NSString *)formatLogMessage:(DDLogMessage *)logMessage { 119 | if ([self isOnBlacklist:logMessage->_context]) { 120 | return nil; 121 | } else { 122 | return logMessage->_message; 123 | } 124 | } 125 | 126 | @end 127 | 128 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 129 | #pragma mark - 130 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 131 | 132 | 133 | @interface DDLoggingContextSet () { 134 | pthread_mutex_t _mutex; 135 | NSMutableSet *_set; 136 | } 137 | 138 | @end 139 | 140 | 141 | @implementation DDLoggingContextSet 142 | 143 | - (instancetype)init { 144 | if ((self = [super init])) { 145 | _set = [[NSMutableSet alloc] init]; 146 | pthread_mutex_init(&_mutex, NULL); 147 | } 148 | 149 | return self; 150 | } 151 | 152 | - (void)dealloc { 153 | pthread_mutex_destroy(&_mutex); 154 | } 155 | 156 | - (void)addToSet:(NSUInteger)loggingContext { 157 | pthread_mutex_lock(&_mutex); 158 | { 159 | [_set addObject:@(loggingContext)]; 160 | } 161 | pthread_mutex_unlock(&_mutex); 162 | } 163 | 164 | - (void)removeFromSet:(NSUInteger)loggingContext { 165 | pthread_mutex_lock(&_mutex); 166 | { 167 | [_set removeObject:@(loggingContext)]; 168 | } 169 | pthread_mutex_unlock(&_mutex); 170 | } 171 | 172 | - (NSArray *)currentSet { 173 | NSArray *result = nil; 174 | 175 | pthread_mutex_lock(&_mutex); 176 | { 177 | result = [_set allObjects]; 178 | } 179 | pthread_mutex_unlock(&_mutex); 180 | 181 | return result; 182 | } 183 | 184 | - (BOOL)isInSet:(NSUInteger)loggingContext { 185 | BOOL result = NO; 186 | 187 | pthread_mutex_lock(&_mutex); 188 | { 189 | result = [_set containsObject:@(loggingContext)]; 190 | } 191 | pthread_mutex_unlock(&_mutex); 192 | 193 | return result; 194 | } 195 | 196 | @end 197 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/Extensions/DDDispatchQueueLogFormatter.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import 17 | #import 18 | 19 | // Disable legacy macros 20 | #ifndef DD_LEGACY_MACROS 21 | #define DD_LEGACY_MACROS 0 22 | #endif 23 | 24 | #import "DDLog.h" 25 | 26 | /** 27 | * Log formatter mode 28 | */ 29 | typedef NS_ENUM(NSUInteger, DDDispatchQueueLogFormatterMode){ 30 | /** 31 | * This is the default option, means the formatter can be reused between multiple loggers and therefore is thread-safe. 32 | * There is, of course, a performance cost for the thread-safety 33 | */ 34 | DDDispatchQueueLogFormatterModeShareble = 0, 35 | /** 36 | * If the formatter will only be used by a single logger, then the thread-safety can be removed 37 | * @note: there is an assert checking if the formatter is added to multiple loggers and the mode is non-shareble 38 | */ 39 | DDDispatchQueueLogFormatterModeNonShareble, 40 | }; 41 | 42 | 43 | /** 44 | * This class provides a log formatter that prints the dispatch_queue label instead of the mach_thread_id. 45 | * 46 | * A log formatter can be added to any logger to format and/or filter its output. 47 | * You can learn more about log formatters here: 48 | * Documentation/CustomFormatters.md 49 | * 50 | * A typical `NSLog` (or `DDTTYLogger`) prints detailed info as `[:]`. 51 | * For example: 52 | * 53 | * `2011-10-17 20:21:45.435 AppName[19928:5207] Your log message here` 54 | * 55 | * Where: 56 | * `- 19928 = process id` 57 | * `- 5207 = thread id (mach_thread_id printed in hex)` 58 | * 59 | * When using grand central dispatch (GCD), this information is less useful. 60 | * This is because a single serial dispatch queue may be run on any thread from an internally managed thread pool. 61 | * For example: 62 | * 63 | * `2011-10-17 20:32:31.111 AppName[19954:4d07] Message from my_serial_dispatch_queue` 64 | * `2011-10-17 20:32:31.112 AppName[19954:5207] Message from my_serial_dispatch_queue` 65 | * `2011-10-17 20:32:31.113 AppName[19954:2c55] Message from my_serial_dispatch_queue` 66 | * 67 | * This formatter allows you to replace the standard `[box:info]` with the dispatch_queue name. 68 | * For example: 69 | * 70 | * `2011-10-17 20:32:31.111 AppName[img-scaling] Message from my_serial_dispatch_queue` 71 | * `2011-10-17 20:32:31.112 AppName[img-scaling] Message from my_serial_dispatch_queue` 72 | * `2011-10-17 20:32:31.113 AppName[img-scaling] Message from my_serial_dispatch_queue` 73 | * 74 | * If the dispatch_queue doesn't have a set name, then it falls back to the thread name. 75 | * If the current thread doesn't have a set name, then it falls back to the mach_thread_id in hex (like normal). 76 | * 77 | * Note: If manually creating your own background threads (via `NSThread/alloc/init` or `NSThread/detachNeThread`), 78 | * you can use `[[NSThread currentThread] setName:(NSString *)]`. 79 | **/ 80 | @interface DDDispatchQueueLogFormatter : NSObject 81 | 82 | /** 83 | * Standard init method. 84 | * Configure using properties as desired. 85 | **/ 86 | - (instancetype)init NS_DESIGNATED_INITIALIZER; 87 | 88 | /** 89 | * Initializer with ability to set the queue mode 90 | * 91 | * @param mode choose between DDDispatchQueueLogFormatterModeShareble and DDDispatchQueueLogFormatterModeNonShareble, depending if the formatter is shared between several loggers or not 92 | */ 93 | - (instancetype)initWithMode:(DDDispatchQueueLogFormatterMode)mode; 94 | 95 | /** 96 | * The minQueueLength restricts the minimum size of the [detail box]. 97 | * If the minQueueLength is set to 0, there is no restriction. 98 | * 99 | * For example, say a dispatch_queue has a label of "diskIO": 100 | * 101 | * If the minQueueLength is 0: [diskIO] 102 | * If the minQueueLength is 4: [diskIO] 103 | * If the minQueueLength is 5: [diskIO] 104 | * If the minQueueLength is 6: [diskIO] 105 | * If the minQueueLength is 7: [diskIO ] 106 | * If the minQueueLength is 8: [diskIO ] 107 | * 108 | * The default minQueueLength is 0 (no minimum, so [detail box] won't be padded). 109 | * 110 | * If you want every [detail box] to have the exact same width, 111 | * set both minQueueLength and maxQueueLength to the same value. 112 | **/ 113 | @property (assign, atomic) NSUInteger minQueueLength; 114 | 115 | /** 116 | * The maxQueueLength restricts the number of characters that will be inside the [detail box]. 117 | * If the maxQueueLength is 0, there is no restriction. 118 | * 119 | * For example, say a dispatch_queue has a label of "diskIO": 120 | * 121 | * If the maxQueueLength is 0: [diskIO] 122 | * If the maxQueueLength is 4: [disk] 123 | * If the maxQueueLength is 5: [diskI] 124 | * If the maxQueueLength is 6: [diskIO] 125 | * If the maxQueueLength is 7: [diskIO] 126 | * If the maxQueueLength is 8: [diskIO] 127 | * 128 | * The default maxQueueLength is 0 (no maximum, so [detail box] won't be truncated). 129 | * 130 | * If you want every [detail box] to have the exact same width, 131 | * set both minQueueLength and maxQueueLength to the same value. 132 | **/ 133 | @property (assign, atomic) NSUInteger maxQueueLength; 134 | 135 | /** 136 | * Sometimes queue labels have long names like "com.apple.main-queue", 137 | * but you'd prefer something shorter like simply "main". 138 | * 139 | * This method allows you to set such preferred replacements. 140 | * The above example is set by default. 141 | * 142 | * To remove/undo a previous replacement, invoke this method with nil for the 'shortLabel' parameter. 143 | **/ 144 | - (NSString *)replacementStringForQueueLabel:(NSString *)longLabel; 145 | 146 | /** 147 | * See the `replacementStringForQueueLabel:` description 148 | */ 149 | - (void)setReplacementString:(NSString *)shortLabel forQueueLabel:(NSString *)longLabel; 150 | 151 | @end 152 | 153 | /** 154 | * Category on `DDDispatchQueueLogFormatter` to make method declarations easier to extend/modify 155 | **/ 156 | @interface DDDispatchQueueLogFormatter (OverridableMethods) 157 | 158 | /** 159 | * Date formatter default configuration 160 | */ 161 | - (void)configureDateFormatter:(NSDateFormatter *)dateFormatter; 162 | 163 | /** 164 | * Formatter method to transfrom from date to string 165 | */ 166 | - (NSString *)stringFromDate:(NSDate *)date; 167 | 168 | /** 169 | * Method to compute the queue thread label 170 | */ 171 | - (NSString *)queueThreadLabelForLogMessage:(DDLogMessage *)logMessage; 172 | 173 | /** 174 | * The actual method that formats a message (transforms a `DDLogMessage` model into a printable string) 175 | */ 176 | - (NSString *)formatLogMessage:(DDLogMessage *)logMessage; 177 | 178 | @end 179 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/Extensions/DDMultiFormatter.h: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import 17 | 18 | // Disable legacy macros 19 | #ifndef DD_LEGACY_MACROS 20 | #define DD_LEGACY_MACROS 0 21 | #endif 22 | 23 | #import "DDLog.h" 24 | 25 | /** 26 | * This formatter can be used to chain different formatters together. 27 | * The log message will processed in the order of the formatters added. 28 | **/ 29 | @interface DDMultiFormatter : NSObject 30 | 31 | /** 32 | * Array of chained formatters 33 | */ 34 | @property (readonly) NSArray> *formatters; 35 | 36 | /** 37 | * Add a new formatter 38 | */ 39 | - (void)addFormatter:(id)formatter NS_SWIFT_NAME(add(_:)); 40 | 41 | /** 42 | * Remove a formatter 43 | */ 44 | - (void)removeFormatter:(id)formatter NS_SWIFT_NAME(remove(_:)); 45 | 46 | /** 47 | * Remove all existing formatters 48 | */ 49 | - (void)removeAllFormatters NS_SWIFT_NAME(removeAll()); 50 | 51 | /** 52 | * Check if a certain formatter is used 53 | */ 54 | - (BOOL)isFormattingWithFormatter:(id)formatter; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/Extensions/DDMultiFormatter.m: -------------------------------------------------------------------------------- 1 | // Software License Agreement (BSD License) 2 | // 3 | // Copyright (c) 2010-2016, Deusty, LLC 4 | // All rights reserved. 5 | // 6 | // Redistribution and use of this software in source and binary forms, 7 | // with or without modification, are permitted provided that the following conditions are met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // * Neither the name of Deusty nor the names of its contributors may be used 13 | // to endorse or promote products derived from this software without specific 14 | // prior written permission of Deusty, LLC. 15 | 16 | #import "DDMultiFormatter.h" 17 | 18 | 19 | #if TARGET_OS_IOS 20 | // Compiling for iOS 21 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later 22 | #define NEEDS_DISPATCH_RETAIN_RELEASE 0 23 | #else // iOS 5.X or earlier 24 | #define NEEDS_DISPATCH_RETAIN_RELEASE 1 25 | #endif 26 | #elif TARGET_OS_WATCH || TARGET_OS_TV 27 | // Compiling for watchOS, tvOS 28 | #define NEEDS_DISPATCH_RETAIN_RELEASE 0 29 | #else 30 | // Compiling for Mac OS X 31 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later 32 | #define NEEDS_DISPATCH_RETAIN_RELEASE 0 33 | #else // Mac OS X 10.7 or earlier 34 | #define NEEDS_DISPATCH_RETAIN_RELEASE 1 35 | #endif 36 | #endif 37 | 38 | 39 | #if !__has_feature(objc_arc) 40 | #error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). 41 | #endif 42 | 43 | 44 | @interface DDMultiFormatter () { 45 | dispatch_queue_t _queue; 46 | NSMutableArray *_formatters; 47 | } 48 | 49 | - (DDLogMessage *)logMessageForLine:(NSString *)line originalMessage:(DDLogMessage *)message; 50 | 51 | @end 52 | 53 | 54 | @implementation DDMultiFormatter 55 | 56 | - (instancetype)init { 57 | self = [super init]; 58 | 59 | if (self) { 60 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 61 | _queue = dispatch_queue_create("cocoa.lumberjack.multiformatter", DISPATCH_QUEUE_CONCURRENT); 62 | #else 63 | _queue = dispatch_queue_create("cocoa.lumberjack.multiformatter", NULL); 64 | #endif 65 | _formatters = [NSMutableArray new]; 66 | } 67 | 68 | return self; 69 | } 70 | 71 | #if NEEDS_DISPATCH_RETAIN_RELEASE 72 | - (void)dealloc { 73 | dispatch_release(_queue); 74 | } 75 | 76 | #endif 77 | 78 | #pragma mark Processing 79 | 80 | - (NSString *)formatLogMessage:(DDLogMessage *)logMessage { 81 | __block NSString *line = logMessage->_message; 82 | 83 | dispatch_sync(_queue, ^{ 84 | for (id formatter in self->_formatters) { 85 | DDLogMessage *message = [self logMessageForLine:line originalMessage:logMessage]; 86 | line = [formatter formatLogMessage:message]; 87 | 88 | if (!line) { 89 | break; 90 | } 91 | } 92 | }); 93 | 94 | return line; 95 | } 96 | 97 | - (DDLogMessage *)logMessageForLine:(NSString *)line originalMessage:(DDLogMessage *)message { 98 | DDLogMessage *newMessage = [message copy]; 99 | 100 | newMessage->_message = line; 101 | return newMessage; 102 | } 103 | 104 | #pragma mark Formatters 105 | 106 | - (NSArray *)formatters { 107 | __block NSArray *formatters; 108 | 109 | dispatch_sync(_queue, ^{ 110 | formatters = [self->_formatters copy]; 111 | }); 112 | 113 | return formatters; 114 | } 115 | 116 | - (void)addFormatter:(id)formatter { 117 | dispatch_barrier_async(_queue, ^{ 118 | [self->_formatters addObject:formatter]; 119 | }); 120 | } 121 | 122 | - (void)removeFormatter:(id)formatter { 123 | dispatch_barrier_async(_queue, ^{ 124 | [self->_formatters removeObject:formatter]; 125 | }); 126 | } 127 | 128 | - (void)removeAllFormatters { 129 | dispatch_barrier_async(_queue, ^{ 130 | [self->_formatters removeAllObjects]; 131 | }); 132 | } 133 | 134 | - (BOOL)isFormattingWithFormatter:(id)formatter { 135 | __block BOOL hasFormatter; 136 | 137 | dispatch_sync(_queue, ^{ 138 | hasFormatter = [self->_formatters containsObject:formatter]; 139 | }); 140 | 141 | return hasFormatter; 142 | } 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Framework/Lumberjack/CocoaLumberjack.modulemap: -------------------------------------------------------------------------------- 1 | framework module CocoaLumberjack { 2 | umbrella header "CocoaLumberjack.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | textual header "DDLogMacros.h" 8 | 9 | exclude header "DDLog+LOGV.h" 10 | exclude header "DDLegacyMacros.h" 11 | 12 | explicit module DDContextFilterLogFormatter { 13 | header "DDContextFilterLogFormatter.h" 14 | export * 15 | } 16 | 17 | explicit module DDDispatchQueueLogFormatter { 18 | header "DDDispatchQueueLogFormatter.h" 19 | export * 20 | } 21 | 22 | explicit module DDMultiFormatter { 23 | header "DDMultiFormatter.h" 24 | export * 25 | } 26 | 27 | explicit module DDASLLogCapture { 28 | header "DDASLLogCapture.h" 29 | export * 30 | } 31 | 32 | explicit module DDAbstractDatabaseLogger { 33 | header "DDAbstractDatabaseLogger.h" 34 | export * 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2010-2016, Deusty, LLC 4 | All rights reserved. 5 | 6 | Redistribution and use of this software in source and binary forms, 7 | with or without modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above 10 | copyright notice, this list of conditions and the 11 | following disclaimer. 12 | 13 | * Neither the name of Deusty nor the names of its 14 | contributors may be used to endorse or promote products 15 | derived from this software without specific prior 16 | written permission of Deusty, LLC. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaAsyncSocket/GCDAsyncSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaAsyncSocket/GCDAsyncUdpSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/DAVConnection.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/DAVResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/DDData.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Categories/DDData.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/DDNumber.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Categories/DDNumber.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/DDRange.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Categories/DDRange.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/DELETEResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPAsyncFileResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPAuthenticationRequest.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPAuthenticationRequest.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPConnection.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPConnection.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPDataResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPDataResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPDynamicFileResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPFileResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPFileResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPLogging.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPLogging.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPMessage.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPMessage.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPRedirectResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/HTTPServer.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPServer.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/MultipartFormDataParser.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/MultipartMessageHeader.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/MultipartMessageHeaderField.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/PUTResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaHTTPServer/WebSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/WebSocket.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/CocoaLumberjack.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/CocoaLumberjack.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDASLLogCapture.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDASLLogCapture.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDASLLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDASLLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDAbstractDatabaseLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDAssertMacros.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDAssertMacros.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDContextFilterLogFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/Extensions/DDContextFilterLogFormatter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDDispatchQueueLogFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/Extensions/DDDispatchQueueLogFormatter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDFileLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDFileLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDLegacyMacros.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLegacyMacros.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDLog+LOGV.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLog+LOGV.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDLog.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLog.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDLogMacros.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLogMacros.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDMultiFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/Extensions/DDMultiFormatter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDOSLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDOSLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Private/CocoaLumberjack/DDTTYLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDTTYLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaAsyncSocket/GCDAsyncSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaAsyncSocket/GCDAsyncUdpSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/DAVConnection.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/DAVResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/DDData.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Categories/DDData.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/DDNumber.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Categories/DDNumber.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/DDRange.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Categories/DDRange.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/DELETEResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPAsyncFileResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPAuthenticationRequest.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPAuthenticationRequest.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPConnection.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPConnection.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPDataResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPDataResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPDynamicFileResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPFileResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPFileResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPLogging.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPLogging.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPMessage.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPMessage.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPRedirectResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/HTTPServer.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/HTTPServer.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/MultipartFormDataParser.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/MultipartMessageHeader.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/MultipartMessageHeaderField.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/PUTResponse.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaHTTPServer/WebSocket.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaHTTPServer/Core/WebSocket.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/CocoaLumberjack.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/CocoaLumberjack.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDASLLogCapture.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDASLLogCapture.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDASLLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDASLLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDAbstractDatabaseLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDAbstractDatabaseLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDAssertMacros.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDAssertMacros.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDContextFilterLogFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/Extensions/DDContextFilterLogFormatter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDDispatchQueueLogFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/Extensions/DDDispatchQueueLogFormatter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDFileLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDFileLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDLegacyMacros.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLegacyMacros.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDLog+LOGV.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLog+LOGV.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDLog.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLog.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDLogMacros.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDLogMacros.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDMultiFormatter.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/Extensions/DDMultiFormatter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDOSLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDOSLogger.h -------------------------------------------------------------------------------- /Pods/Headers/Public/CocoaLumberjack/DDTTYLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDTTYLogger.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.6.3) 3 | - CocoaHTTPServer (2.3): 4 | - CocoaAsyncSocket 5 | - CocoaLumberjack 6 | - CocoaLumberjack (3.4.2): 7 | - CocoaLumberjack/Default (= 3.4.2) 8 | - CocoaLumberjack/Extensions (= 3.4.2) 9 | - CocoaLumberjack/Default (3.4.2) 10 | - CocoaLumberjack/Extensions (3.4.2): 11 | - CocoaLumberjack/Default 12 | 13 | DEPENDENCIES: 14 | - CocoaHTTPServer (~> 2.3) 15 | 16 | SPEC REPOS: 17 | https://github.com/cocoapods/specs.git: 18 | - CocoaAsyncSocket 19 | - CocoaHTTPServer 20 | - CocoaLumberjack 21 | 22 | SPEC CHECKSUMS: 23 | CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 24 | CocoaHTTPServer: 5624681fc3473d43b18202f635f9b3abb013b530 25 | CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd 26 | 27 | PODFILE CHECKSUM: 20570141ba42d7941e54b3201c3e0949478c04fa 28 | 29 | COCOAPODS: 1.5.3 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_CocoaAsyncSocket : NSObject 3 | @end 4 | @implementation PodsDummy_CocoaAsyncSocket 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaAsyncSocket/CocoaAsyncSocket.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" 4 | OTHER_LDFLAGS = -framework "CFNetwork" -framework "Security" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/CocoaAsyncSocket 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaHTTPServer/CocoaHTTPServer-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_CocoaHTTPServer : NSObject 3 | @end 4 | @implementation PodsDummy_CocoaHTTPServer 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaHTTPServer/CocoaHTTPServer-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaHTTPServer/CocoaHTTPServer.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaHTTPServer 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaHTTPServer" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "$(SDKROOT)/usr/include/libxml2" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" 5 | OTHER_LDFLAGS = -l"xml2" -framework "CFNetwork" -framework "Security" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/CocoaHTTPServer 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaLumberjack/CocoaLumberjack-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_CocoaLumberjack : NSObject 3 | @end 4 | @implementation PodsDummy_CocoaLumberjack 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaLumberjack/CocoaLumberjack-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/CocoaLumberjack/CocoaLumberjack.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaLumberjack" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/CocoaLumberjack 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Desktop/Pods-Desktop-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## CocoaAsyncSocket 5 | 6 | Public Domain License 7 | 8 | The CocoaAsyncSocket project is in the public domain. 9 | 10 | The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003. 11 | Updated and maintained by Deusty LLC and the Apple development community. 12 | 13 | 14 | ## CocoaHTTPServer 15 | 16 | Software License Agreement (BSD License) 17 | 18 | Copyright (c) 2011, Deusty, LLC 19 | All rights reserved. 20 | 21 | Redistribution and use of this software in source and binary forms, 22 | with or without modification, are permitted provided that the following conditions are met: 23 | 24 | * Redistributions of source code must retain the above 25 | copyright notice, this list of conditions and the 26 | following disclaimer. 27 | 28 | * Neither the name of Deusty nor the names of its 29 | contributors may be used to endorse or promote products 30 | derived from this software without specific prior 31 | written permission of Deusty, LLC. 32 | 33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | ## CocoaLumberjack 36 | 37 | Software License Agreement (BSD License) 38 | 39 | Copyright (c) 2010-2016, Deusty, LLC 40 | All rights reserved. 41 | 42 | Redistribution and use of this software in source and binary forms, 43 | with or without modification, are permitted provided that the following conditions are met: 44 | 45 | * Redistributions of source code must retain the above 46 | copyright notice, this list of conditions and the 47 | following disclaimer. 48 | 49 | * Neither the name of Deusty nor the names of its 50 | contributors may be used to endorse or promote products 51 | derived from this software without specific prior 52 | written permission of Deusty, LLC. 53 | 54 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55 | Generated by CocoaPods - https://cocoapods.org 56 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Desktop/Pods-Desktop-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Public Domain License 18 | 19 | The CocoaAsyncSocket project is in the public domain. 20 | 21 | The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003. 22 | Updated and maintained by Deusty LLC and the Apple development community. 23 | 24 | License 25 | public domain 26 | Title 27 | CocoaAsyncSocket 28 | Type 29 | PSGroupSpecifier 30 | 31 | 32 | FooterText 33 | Software License Agreement (BSD License) 34 | 35 | Copyright (c) 2011, Deusty, LLC 36 | All rights reserved. 37 | 38 | Redistribution and use of this software in source and binary forms, 39 | with or without modification, are permitted provided that the following conditions are met: 40 | 41 | * Redistributions of source code must retain the above 42 | copyright notice, this list of conditions and the 43 | following disclaimer. 44 | 45 | * Neither the name of Deusty nor the names of its 46 | contributors may be used to endorse or promote products 47 | derived from this software without specific prior 48 | written permission of Deusty, LLC. 49 | 50 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 | License 52 | BSD 53 | Title 54 | CocoaHTTPServer 55 | Type 56 | PSGroupSpecifier 57 | 58 | 59 | FooterText 60 | Software License Agreement (BSD License) 61 | 62 | Copyright (c) 2010-2016, Deusty, LLC 63 | All rights reserved. 64 | 65 | Redistribution and use of this software in source and binary forms, 66 | with or without modification, are permitted provided that the following conditions are met: 67 | 68 | * Redistributions of source code must retain the above 69 | copyright notice, this list of conditions and the 70 | following disclaimer. 71 | 72 | * Neither the name of Deusty nor the names of its 73 | contributors may be used to endorse or promote products 74 | derived from this software without specific prior 75 | written permission of Deusty, LLC. 76 | 77 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 78 | License 79 | BSD 80 | Title 81 | CocoaLumberjack 82 | Type 83 | PSGroupSpecifier 84 | 85 | 86 | FooterText 87 | Generated by CocoaPods - https://cocoapods.org 88 | Title 89 | 90 | Type 91 | PSGroupSpecifier 92 | 93 | 94 | StringsTable 95 | Acknowledgements 96 | Title 97 | Acknowledgements 98 | 99 | 100 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Desktop/Pods-Desktop-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Desktop : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Desktop 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Desktop/Pods-Desktop-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Desktop/Pods-Desktop.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "$(SDKROOT)/usr/include/libxml2" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaHTTPServer" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" -isystem "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -l"CocoaHTTPServer" -l"CocoaLumberjack" -l"xml2" -framework "CFNetwork" -framework "Security" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Desktop/Pods-Desktop.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "$(SDKROOT)/usr/include/libxml2" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaHTTPServer" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" -isystem "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -l"CocoaHTTPServer" -l"CocoaLumberjack" -l"xml2" -framework "CFNetwork" -framework "Security" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | --------------------------------------------------------------------------------