├── Podfile ├── Podfile.lock ├── Pods ├── CocoaAsyncSocket │ ├── 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 │ │ ├── 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 │ │ │ └── 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 │ │ └── DDTTYLogger.h ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── calvin.xcuserdatad │ │ └── xcschemes │ │ ├── CocoaAsyncSocket.xcscheme │ │ ├── CocoaHTTPServer.xcscheme │ │ ├── CocoaLumberjack.xcscheme │ │ ├── Pods-WifiTransferFiles.xcscheme │ │ └── xcschememanagement.plist └── 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-WifiTransferFiles │ ├── Pods-WifiTransferFiles-acknowledgements.markdown │ ├── Pods-WifiTransferFiles-acknowledgements.plist │ ├── Pods-WifiTransferFiles-dummy.m │ ├── Pods-WifiTransferFiles-frameworks.sh │ ├── Pods-WifiTransferFiles-resources.sh │ ├── Pods-WifiTransferFiles.debug.xcconfig │ └── Pods-WifiTransferFiles.release.xcconfig ├── README.md ├── WifiTransferFiles.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── calvin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── calvin.xcuserdatad │ └── xcschemes │ ├── WifiTransferFiles.xcscheme │ └── xcschememanagement.plist ├── WifiTransferFiles.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── calvin.xcuserdatad │ └── UserInterfaceState.xcuserstate └── WifiTransferFiles ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── CustomAlert ├── CustomAlertView.h └── CustomAlertView.m ├── DHIPAdress.h ├── DHIPAdress.m ├── Info.plist ├── MyHTTPConnection.h ├── MyHTTPConnection.m ├── RootViewController.h ├── RootViewController.m ├── index.html ├── main.m └── upload.html /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, ‘8.0’ 3 | 4 | target ‘WifiTransferFiles’ do 5 | # Uncomment this line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for WifiTransferFiles 9 | 10 | pod 'CocoaHTTPServer' 11 | 12 | end 13 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.6.0) 3 | - CocoaHTTPServer (2.3): 4 | - CocoaAsyncSocket 5 | - CocoaLumberjack 6 | - CocoaLumberjack (3.1.0): 7 | - CocoaLumberjack/Default (= 3.1.0) 8 | - CocoaLumberjack/Extensions (= 3.1.0) 9 | - CocoaLumberjack/Default (3.1.0) 10 | - CocoaLumberjack/Extensions (3.1.0): 11 | - CocoaLumberjack/Default 12 | 13 | DEPENDENCIES: 14 | - CocoaHTTPServer 15 | 16 | SPEC CHECKSUMS: 17 | CocoaAsyncSocket: b9d5589f07baf9de8f34cc25abd4fcba28f13805 18 | CocoaHTTPServer: 5624681fc3473d43b18202f635f9b3abb013b530 19 | CocoaLumberjack: 8311463ddf9ee86a06ef92a071dd656c89244500 20 | 21 | PODFILE CHECKSUM: f718d334e3f20a670732a48e1b3455551225913c 22 | 23 | COCOAPODS: 1.2.0 24 | -------------------------------------------------------------------------------- /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 | 82 | // CLI 83 | #if __has_include("CLIColor.h") && TARGET_OS_OSX 84 | #import "CLIColor.h" 85 | #endif 86 | -------------------------------------------------------------------------------- /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 = str.substring(from: idx) 90 | } 91 | if let idx = str.range(of: ".", options: .backwards)?.lowerBound { 92 | str = str.substring(to: idx) 93 | } 94 | return str 95 | } 96 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDASLLogCapture.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 "DDASLLogger.h" 17 | 18 | @protocol DDLogger; 19 | 20 | /** 21 | * This class provides the ability to capture the ASL (Apple System Logs) 22 | */ 23 | @interface DDASLLogCapture : NSObject 24 | 25 | /** 26 | * Start capturing logs 27 | */ 28 | + (void)start; 29 | 30 | /** 31 | * Stop capturing logs 32 | */ 33 | + (void)stop; 34 | 35 | /** 36 | * The current capture level. 37 | * @note Default log level: DDLogLevelVerbose (i.e. capture all ASL messages). 38 | */ 39 | @property (class) DDLogLevel captureLevel; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Pods/CocoaLumberjack/Classes/DDASLLogger.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 | // 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/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 | OSSpinLock _lock; 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 | _lock = OS_SPINLOCK_INIT; 147 | } 148 | 149 | return self; 150 | } 151 | 152 | - (void)addToSet:(NSUInteger)loggingContext { 153 | OSSpinLockLock(&_lock); 154 | { 155 | [_set addObject:@(loggingContext)]; 156 | } 157 | OSSpinLockUnlock(&_lock); 158 | } 159 | 160 | - (void)removeFromSet:(NSUInteger)loggingContext { 161 | OSSpinLockLock(&_lock); 162 | { 163 | [_set removeObject:@(loggingContext)]; 164 | } 165 | OSSpinLockUnlock(&_lock); 166 | } 167 | 168 | - (NSArray *)currentSet { 169 | NSArray *result = nil; 170 | 171 | OSSpinLockLock(&_lock); 172 | { 173 | result = [_set allObjects]; 174 | } 175 | OSSpinLockUnlock(&_lock); 176 | 177 | return result; 178 | } 179 | 180 | - (BOOL)isInSet:(NSUInteger)loggingContext { 181 | BOOL result = NO; 182 | 183 | OSSpinLockLock(&_lock); 184 | { 185 | result = [_set containsObject:@(loggingContext)]; 186 | } 187 | OSSpinLockUnlock(&_lock); 188 | 189 | return result; 190 | } 191 | 192 | @end 193 | -------------------------------------------------------------------------------- /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 _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 = [_formatters copy]; 111 | }); 112 | 113 | return formatters; 114 | } 115 | 116 | - (void)addFormatter:(id)formatter { 117 | dispatch_barrier_async(_queue, ^{ 118 | [_formatters addObject:formatter]; 119 | }); 120 | } 121 | 122 | - (void)removeFormatter:(id)formatter { 123 | dispatch_barrier_async(_queue, ^{ 124 | [_formatters removeObject:formatter]; 125 | }); 126 | } 127 | 128 | - (void)removeAllFormatters { 129 | dispatch_barrier_async(_queue, ^{ 130 | [_formatters removeAllObjects]; 131 | }); 132 | } 133 | 134 | - (BOOL)isFormattingWithFormatter:(id)formatter { 135 | __block BOOL hasFormatter; 136 | 137 | dispatch_sync(_queue, ^{ 138 | hasFormatter = [_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/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/DDTTYLogger.h: -------------------------------------------------------------------------------- 1 | ../../../CocoaLumberjack/Classes/DDTTYLogger.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.6.0) 3 | - CocoaHTTPServer (2.3): 4 | - CocoaAsyncSocket 5 | - CocoaLumberjack 6 | - CocoaLumberjack (3.1.0): 7 | - CocoaLumberjack/Default (= 3.1.0) 8 | - CocoaLumberjack/Extensions (= 3.1.0) 9 | - CocoaLumberjack/Default (3.1.0) 10 | - CocoaLumberjack/Extensions (3.1.0): 11 | - CocoaLumberjack/Default 12 | 13 | DEPENDENCIES: 14 | - CocoaHTTPServer 15 | 16 | SPEC CHECKSUMS: 17 | CocoaAsyncSocket: b9d5589f07baf9de8f34cc25abd4fcba28f13805 18 | CocoaHTTPServer: 5624681fc3473d43b18202f635f9b3abb013b530 19 | CocoaLumberjack: 8311463ddf9ee86a06ef92a071dd656c89244500 20 | 21 | PODFILE CHECKSUM: f718d334e3f20a670732a48e1b3455551225913c 22 | 23 | COCOAPODS: 1.2.0 24 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/CocoaAsyncSocket.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/CocoaHTTPServer.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/CocoaLumberjack.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/Pods-WifiTransferFiles.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CocoaAsyncSocket.xcscheme 8 | 9 | isShown 10 | 11 | 12 | CocoaHTTPServer.xcscheme 13 | 14 | isShown 15 | 16 | 17 | CocoaLumberjack.xcscheme 18 | 19 | isShown 20 | 21 | 22 | Pods-WifiTransferFiles.xcscheme 23 | 24 | isShown 25 | 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | 23D7DA26C40DEA0CBB49A7825C7CD4F1 31 | 32 | primary 33 | 34 | 35 | C92FE3681884E565A5AB3C622863B4C8 36 | 37 | primary 38 | 39 | 40 | E8FBAB4723C6E41DC74C7005DD429DBE 41 | 42 | primary 43 | 44 | 45 | FB08FC789BEA6EA5940DC48DC67E3B57 46 | 47 | primary 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /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 = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" 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 = "${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 = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaLumberjack" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaHTTPServer" "${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-WifiTransferFiles/Pods-WifiTransferFiles-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-WifiTransferFiles/Pods-WifiTransferFiles-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-WifiTransferFiles/Pods-WifiTransferFiles-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_WifiTransferFiles : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_WifiTransferFiles 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-WifiTransferFiles/Pods-WifiTransferFiles-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-WifiTransferFiles/Pods-WifiTransferFiles-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | 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}" 45 | 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} 46 | ;; 47 | *.xib) 48 | 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}" 49 | 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} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | 80 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 83 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | fi 86 | rm -f "$RESOURCES_TO_COPY" 87 | 88 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 89 | then 90 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 91 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 92 | while read line; do 93 | if [[ $line != "${PODS_ROOT}*" ]]; then 94 | XCASSET_FILES+=("$line") 95 | fi 96 | done <<<"$OTHER_XCASSETS" 97 | 98 | 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}" 99 | fi 100 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-WifiTransferFiles/Pods-WifiTransferFiles.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2" $(inherited) "${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_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-WifiTransferFiles/Pods-WifiTransferFiles.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2" $(inherited) "${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_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WifiTransferFiles 2 | iOS App 创建本地服务器,在电脑实现使用 Wifi 传输文件 3 | 4 | [博客:iOS 实现 WiFi 局域网传输文件到 App Demo](http://zhangdinghao.cn/2017/05/05/iOS-Wifi-Transfer-Files/) 5 | 6 | -------------------------------------------------------------------------------- /WifiTransferFiles.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WifiTransferFiles.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalvinCheungCoder/WifiTransferFiles/e9d8ffc77011849a037ed7ca8e9302639d21c992/WifiTransferFiles.xcodeproj/project.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WifiTransferFiles.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/WifiTransferFiles.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /WifiTransferFiles.xcodeproj/xcuserdata/calvin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | WifiTransferFiles.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 3EEB46B51EBC5C7700081C8A 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /WifiTransferFiles.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /WifiTransferFiles.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalvinCheungCoder/WifiTransferFiles/e9d8ffc77011849a037ed7ca8e9302639d21c992/WifiTransferFiles.xcworkspace/xcuserdata/calvin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WifiTransferFiles/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. 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 | -------------------------------------------------------------------------------- /WifiTransferFiles/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "RootViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | RootViewController *root = [[RootViewController alloc]init]; 23 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:root]; 24 | self.window.rootViewController = nav; 25 | return YES; 26 | } 27 | 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 | } 33 | 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application { 36 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /WifiTransferFiles/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /WifiTransferFiles/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 | 27 | 28 | -------------------------------------------------------------------------------- /WifiTransferFiles/Base.lproj/Main.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 | 27 | -------------------------------------------------------------------------------- /WifiTransferFiles/CustomAlert/CustomAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomAlertView.h 3 | // CustomAlertView 4 | // 5 | // Created by CalvinCheung on 2017/1/3. 6 | // Copyright © 2017年 CalvinCheung. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | UIKIT_EXTERN NSString *const CustomAlertViewWillShowNotification; 12 | UIKIT_EXTERN NSString *const CustomAlertViewDidShowNotification; 13 | UIKIT_EXTERN NSString *const CustomAlertViewWillDismissNotification; 14 | UIKIT_EXTERN NSString *const CustomAlertViewDidDismissNotification; 15 | 16 | typedef void(^clickHandle)(void); 17 | 18 | typedef void(^clickHandleWithIndex)(NSInteger index); 19 | 20 | typedef NS_ENUM(NSInteger, CustomAlertViewButtonType) { 21 | CustomAlertViewButtonTypeDefault = 0, 22 | CustomAlertViewButtonTypeCancel, 23 | CustomAlertViewButtonTypeWarn 24 | }; 25 | 26 | typedef NS_ENUM(NSInteger, SMBSide){ 27 | 28 | kSMBSideLeft = 0, 29 | kSMBSideRight, 30 | kSMBSideUp, 31 | }; 32 | 33 | @interface CustomAlertView : UIView 34 | 35 | // show alertView with 1 button 36 | + (void)showOneButtonWithTitle:(NSString *)title Message:(NSString *)message ButtonType:(CustomAlertViewButtonType)buttonType ButtonTitle:(NSString *)buttonTitle Click:(clickHandle)click; 37 | 38 | // show alertView with 2 buttons 39 | + (void)showTwoButtonsWithTitle:(NSString *)title Message:(NSString *)message ButtonType:(CustomAlertViewButtonType)buttonType ButtonTitle:(NSString *)buttonTitle Click:(clickHandle)click ButtonType:(CustomAlertViewButtonType)buttonType ButtonTitle:(NSString *)buttonType Click:(clickHandle)click; 40 | 41 | // show alertView with greater than or equal to 3 buttons 42 | // parameter of 'buttons' , pass by NSDictionary like @{CustomAlertViewButtonTypeDefault : @"ok"} 43 | + (void)showMultipleButtonsWithTitle:(NSString *)title Message:(NSString *)message Click:(clickHandleWithIndex)click Buttons:(NSDictionary *)buttons,... NS_REQUIRES_NIL_TERMINATION; 44 | 45 | // ------------------------Show AlertView with customView----------------------------- 46 | 47 | // create a alertView with customView. 48 | // 'dismissWhenTouchBackground' : If you don't want to add a button on customView to call 'dismiss' method manually, set this property to 'YES'. 49 | - (instancetype)initWithCustomView:(UIView *)customView dismissWhenTouchedBackground:(BOOL)dismissWhenTouchBackground; 50 | 51 | - (void)configAlertViewPropertyWithTitle:(NSString *)title Message:(NSString *)message Buttons:(NSArray *)buttons Clicks:(NSArray *)clicks ClickWithIndex:(clickHandleWithIndex)clickWithIndex; 52 | 53 | - (void)show; 54 | 55 | // alert will resign keywindow in the completion. 56 | - (void)dismissWithCompletion:(void(^)(void))completion; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /WifiTransferFiles/DHIPAdress.h: -------------------------------------------------------------------------------- 1 | // 2 | // DHIPAdress.h 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. All rights reserved. 7 | // 8 | 9 | #import 10 | #include 11 | #include 12 | 13 | @interface DHIPAdress : NSObject 14 | 15 | /*! 16 | * get device ip address 17 | */ 18 | + (NSString *)deviceIPAdress; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WifiTransferFiles/DHIPAdress.m: -------------------------------------------------------------------------------- 1 | // 2 | // DHIPAdress.m 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. All rights reserved. 7 | // 8 | 9 | #import "DHIPAdress.h" 10 | 11 | @implementation DHIPAdress 12 | 13 | + (NSString *)deviceIPAdress { 14 | NSString *address = @"an error occurred when obtaining ip address"; 15 | struct ifaddrs *interfaces = NULL; 16 | struct ifaddrs *temp_addr = NULL; 17 | int success = 0; 18 | 19 | success = getifaddrs(&interfaces); 20 | 21 | if (success == 0) { // 0 表示获取成功 22 | 23 | temp_addr = interfaces; 24 | while (temp_addr != NULL) { 25 | if( temp_addr->ifa_addr->sa_family == AF_INET) { 26 | // Check if interface is en0 which is the wifi connection on the iPhone 27 | if ([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"]) { 28 | // Get NSString from C String 29 | address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)]; 30 | } 31 | } 32 | temp_addr = temp_addr->ifa_next; 33 | } 34 | } 35 | freeifaddrs(interfaces); 36 | return address; 37 | } 38 | 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /WifiTransferFiles/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /WifiTransferFiles/MyHTTPConnection.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyHTTPConnection.h 3 | // iRead 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. All rights reserved. 7 | // 8 | 9 | 10 | #import "HTTPConnection.h" 11 | 12 | @class MultipartFormDataParser; 13 | 14 | @interface MyHTTPConnection : HTTPConnection { 15 | MultipartFormDataParser* parser; 16 | NSFileHandle* storeFile; 17 | 18 | NSMutableArray* uploadedFiles; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WifiTransferFiles/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RootViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WifiTransferFiles/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | #import "HTTPServer.h" 11 | #import "DDLog.h" 12 | #import "DDTTYLogger.h" 13 | #import "MyHTTPConnection.h" 14 | #import "DHIPAdress.h" 15 | #import "CustomAlertView.h" 16 | 17 | @interface RootViewController () 18 | { 19 | HTTPServer *httpServer; 20 | } 21 | 22 | @property (nonatomic, strong) UITableView *tableView; 23 | 24 | @property (nonatomic, strong) NSArray *dataArr; 25 | 26 | 27 | 28 | @end 29 | 30 | @implementation RootViewController 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | // Do any additional setup after loading the view. 35 | self.title = @"Wifi Transfer Files"; 36 | [self createAddFileBtn]; 37 | self.view.backgroundColor = [UIColor whiteColor]; 38 | [self createTableView]; 39 | [self readLocalData]; 40 | } 41 | 42 | - (void)readLocalData 43 | { 44 | NSFileManager *fileManager = [NSFileManager defaultManager]; 45 | // 在这里获取应用程序Documents文件夹里的文件及文件夹列表 46 | NSString *documentDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 47 | // fileList便是包含有该文件夹下所有文件的文件名及文件夹名的数组 48 | self.dataArr = [fileManager contentsOfDirectoryAtPath:documentDir error:nil]; 49 | 50 | NSLog(@"fileList == %@",self.dataArr); 51 | [self.tableView reloadData]; 52 | } 53 | 54 | - (void)createTableView 55 | { 56 | self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) style:UITableViewStylePlain]; 57 | self.tableView.delegate = self; 58 | self.tableView.dataSource = self; 59 | [self.view addSubview:self.tableView]; 60 | } 61 | 62 | - (void)createAddFileBtn 63 | { 64 | 65 | UIButton *addbtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; 66 | [addbtn setTitle:@"+" forState:UIControlStateNormal]; 67 | [addbtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 68 | [addbtn addTarget:self action:@selector(addBtnEvent) forControlEvents:UIControlEventTouchUpInside]; 69 | 70 | UIBarButtonItem *rightCunstomButtonView = [[UIBarButtonItem alloc] initWithCustomView:addbtn]; 71 | self.navigationItem.rightBarButtonItem = rightCunstomButtonView; 72 | } 73 | 74 | - (void)addBtnEvent 75 | { 76 | 77 | httpServer = [[HTTPServer alloc] init]; 78 | [httpServer setType:@"_http._tcp."]; 79 | // webPath是server搜寻HTML等文件的路径 80 | NSString *webPath = [[NSBundle mainBundle] resourcePath]; 81 | [httpServer setDocumentRoot:webPath]; 82 | [httpServer setConnectionClass:[MyHTTPConnection class]]; 83 | NSError *err; 84 | NSString *IPAdress = [DHIPAdress deviceIPAdress]; 85 | 86 | if ([httpServer start:&err] && [httpServer isRunning]) { 87 | NSLog(@"http://%@:%hu",IPAdress,[httpServer listeningPort]); 88 | }else{ 89 | NSLog(@"%@",err); 90 | } 91 | 92 | NSString *uploadDirPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 93 | NSLog(@"文件地址:%@",uploadDirPath); 94 | 95 | NSString *str = [NSString stringWithFormat:@"http://%@:%hu",IPAdress,[httpServer listeningPort]]; 96 | NSString *msg = [NSString stringWithFormat:@"请在电脑浏览器中输入以下地址:\n%@\n注意:电脑和手机要保持在同一局域网,并在文件传输结束后点击关闭按钮",str]; 97 | 98 | [CustomAlertView showOneButtonWithTitle:@"提示" Message:msg ButtonType:CustomAlertViewButtonTypeDefault ButtonTitle:@"关闭" Click:^{ 99 | 100 | [httpServer stop]; 101 | [self readLocalData]; 102 | }]; 103 | } 104 | 105 | #pragma mark -- 106 | #pragma mark -- TableViewDele & DataSource 107 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 108 | 109 | return 1; 110 | } 111 | 112 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 113 | { 114 | return self.dataArr.count; 115 | } 116 | 117 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 118 | 119 | return 55; 120 | } 121 | 122 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 123 | 124 | static NSString *homeTwoCell = @"HomeThreeCell"; 125 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:homeTwoCell]; 126 | if (!cell) { 127 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:homeTwoCell]; 128 | } 129 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 130 | cell.textLabel.text = self.dataArr[indexPath.row]; 131 | return cell; 132 | } 133 | 134 | 135 | 136 | @end 137 | -------------------------------------------------------------------------------- /WifiTransferFiles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
    9 |
    10 |
    11 | 12 |
    13 | 14 | 15 | -------------------------------------------------------------------------------- /WifiTransferFiles/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WifiTransferFiles 4 | // 5 | // Created by 张丁豪 on 2017/5/5. 6 | // Copyright © 2017年 zhangdinghao. 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 | -------------------------------------------------------------------------------- /WifiTransferFiles/upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %MyFiles% 9 | 10 | 11 | --------------------------------------------------------------------------------