diff --git a/iOSProject/Podfile b/iOSProject/Podfile
index 24a5fc9f..68f7c389 100644
--- a/iOSProject/Podfile
+++ b/iOSProject/Podfile
@@ -7,7 +7,8 @@ inhibit_all_warnings!
# 网络请求
pod 'AFNetworking'
-pod 'ASIHTTPRequest'
+#pod 'ASIHTTPRequest'
+
# 网络监控
pod 'Reachability'
@@ -17,6 +18,8 @@ pod 'MJExtension'
pod 'MJRefresh'
# 图片加载
pod 'SDWebImage'
+pod 'SDWebImage/GIF'
+
#用于适配
pod 'Masonry'
@@ -28,22 +31,14 @@ pod 'UMengUShare/Social/ReducedWeChat'
pod 'UMengUShare/Social/QQ'
pod 'UMengUShare/Social/Sina'
-
#百度地图SDK
-pod 'BaiduMapKit'
-
-# 环信连天包含实时语音版本
-# pod 'Hyphenate'
-# pod 'EaseUI', :git => 'https://github.com/easemob/easeui-ios-hyphenate-cocoapods.git'
-
-pod 'CYLTabBarController'
+pod 'BaiduMapKit', '4.1.1'
# 表情键盘
-pod 'HMEmoticon'
+#pod 'HMEmoticon'
# 正则匹配点击
pod 'KILabel'
-
# YYKit
#pod 'YYKit'
pod 'YYImage'
@@ -51,22 +46,16 @@ pod 'YYText'
pod 'YYAsyncLayer'
pod 'YYCategories'
-# 通用链接跳转
-pod 'MagicWindowSDK'
-
-# 数据库 新浪微博用
+# 数据库
pod 'FMDB'
# 蒙版
pod 'MBProgressHUD'
-# h5交互
-pod 'WebViewJavascriptBridge'
-
# 进度
pod 'M13ProgressSuite'
-# 无线轮播
+# 无限轮播
pod 'SDCycleScrollView'
# 键盘管理
@@ -75,19 +64,13 @@ pod 'IQKeyboardManager'
# 唯一设备标识
pod 'FCUUID'
-# 指纹识别
-pod 'TDTouchID'
# 三级联动 时间 地址
pod 'MOFSPickerManager'
-
# 全局滑动
pod 'FDFullscreenPopGesture'
-# 数据存储
-pod 'GVUserDefaults'
-
# toast
pod 'Toast'
@@ -97,21 +80,27 @@ pod 'HMQRCodeScanner'
# 照片
pod 'TZImagePickerController'
-# 动态 collectionView
-pod 'LxGridView'
-
-# 脸部识别
-pod 'iflyMSC'
-
# scrollpageView
pod 'ZJScrollPageView'
# 列表视频
-pod 'ZFPlayer'
-pod 'ZFDownload'
+pod 'ZFPlayer', '2.1.6'
+#pod 'ZFDownload'
# mark- 好玩的
# 泡泡uibutton
pod 'DWBubbleMenuButton'
+# 动态 collectionView
+#pod 'LxGridView'
+# 指纹识别
+#pod 'TDTouchID'
+# h5交互
+#pod 'WebViewJavascriptBridge'
+# 脸部识别
+#pod 'iflyMSC'
+# 环信连天包含实时语音版本
+# pod 'Hyphenate'
+# pod 'EaseUI', :git => 'https://github.com/easemob/easeui-ios-hyphenate-cocoapods.git'
+
end
diff --git a/iOSProject/Podfile.lock b/iOSProject/Podfile.lock
index 157a6d08..9d9c96ef 100644
--- a/iOSProject/Podfile.lock
+++ b/iOSProject/Podfile.lock
@@ -1,86 +1,67 @@
PODS:
- - AFNetworking (3.1.0):
- - AFNetworking/NSURLSession (= 3.1.0)
- - AFNetworking/Reachability (= 3.1.0)
- - AFNetworking/Security (= 3.1.0)
- - AFNetworking/Serialization (= 3.1.0)
- - AFNetworking/UIKit (= 3.1.0)
- - AFNetworking/NSURLSession (3.1.0):
+ - AFNetworking (4.0.1):
+ - AFNetworking/NSURLSession (= 4.0.1)
+ - AFNetworking/Reachability (= 4.0.1)
+ - AFNetworking/Security (= 4.0.1)
+ - AFNetworking/Serialization (= 4.0.1)
+ - AFNetworking/UIKit (= 4.0.1)
+ - AFNetworking/NSURLSession (4.0.1):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- - AFNetworking/Reachability (3.1.0)
- - AFNetworking/Security (3.1.0)
- - AFNetworking/Serialization (3.1.0)
- - AFNetworking/UIKit (3.1.0):
+ - AFNetworking/Reachability (4.0.1)
+ - AFNetworking/Security (4.0.1)
+ - AFNetworking/Serialization (4.0.1)
+ - AFNetworking/UIKit (4.0.1):
- AFNetworking/NSURLSession
- - ASIHTTPRequest (1.8.2):
- - ASIHTTPRequest/ASIWebPageRequest (= 1.8.2)
- - ASIHTTPRequest/CloudFiles (= 1.8.2)
- - ASIHTTPRequest/Core (= 1.8.2)
- - ASIHTTPRequest/S3 (= 1.8.2)
- - ASIHTTPRequest/ASIWebPageRequest (1.8.2):
- - ASIHTTPRequest/Core
- - ASIHTTPRequest/CloudFiles (1.8.2):
- - ASIHTTPRequest/Core
- - ASIHTTPRequest/Core (1.8.2):
- - Reachability
- - ASIHTTPRequest/S3 (1.8.2):
- - ASIHTTPRequest/Core
- - BaiduMapKit (3.4.2)
- - CYLTabBarController (1.17.6)
+ - BaiduMapKit (4.1.1)
- DWBubbleMenuButton (1.0.1)
- FCUUID (1.3.1):
- UICKeyChainStore (~> 2.1.0)
- FDFullscreenPopGesture (1.1)
- - FMDB (2.7.2):
- - FMDB/standard (= 2.7.2)
- - FMDB/standard (2.7.2)
- - GVUserDefaults (1.0.2)
- - HMEmoticon (1.0.12)
+ - FLAnimatedImage (1.0.12)
+ - FMDB (2.7.5):
+ - FMDB/standard (= 2.7.5)
+ - FMDB/standard (2.7.5)
- HMQRCodeScanner (1.0.6)
- - iflyMSC (1.144)
- - IQKeyboardManager (5.0.7)
+ - IQKeyboardManager (6.5.6)
- KILabel (1.0.1)
- - LxGridView (1.0.0)
- M13ProgressSuite (1.2.9)
- - MagicWindowSDK (4.2.171115):
- - WechatOpenSDK
- Masonry (1.1.0)
- - MBProgressHUD (1.1.0)
- - MJExtension (3.0.13)
- - MJRefresh (3.1.15.1)
- - MOFSPickerManager (1.0.6)
+ - MBProgressHUD (1.2.0)
+ - MJExtension (3.2.2)
+ - MJRefresh (3.5.0)
+ - MOFSPickerManager (2.2.4)
- Reachability (3.2)
- SDCycleScrollView (1.75):
- SDWebImage (>= 4.0.0)
- - SDWebImage (4.2.3):
- - SDWebImage/Core (= 4.2.3)
- - SDWebImage/Core (4.2.3)
- - TDTouchID (1.0.2)
+ - SDWebImage (4.4.8):
+ - SDWebImage/Core (= 4.4.8)
+ - SDWebImage/Core (4.4.8)
+ - SDWebImage/GIF (4.4.8):
+ - FLAnimatedImage (~> 1.0)
+ - SDWebImage/Core
- Toast (4.0.0)
- - TZImagePickerController (1.9.8)
- - UICKeyChainStore (2.1.1)
+ - TZImagePickerController (3.4.2)
+ - UICKeyChainStore (2.1.2)
- UMengAnalytics (4.2.4)
- - UMengUShare/Core (6.4.8):
+ - UMengUShare/Core (6.4.8.2):
- UMengUShare/Network
- - UMengUShare/Network (6.4.8)
- - UMengUShare/Social/QQ (6.4.8):
+ - UMengUShare/Network (6.4.8.2)
+ - UMengUShare/Social/QQ (6.4.8.2):
- UMengUShare/Core
- UMengUShare/Social/ReducedQQ
- - UMengUShare/Social/ReducedQQ (6.4.8):
+ - UMengUShare/Social/ReducedQQ (6.4.8.2):
- UMengUShare/Core
- - UMengUShare/Social/ReducedSina (6.4.8):
+ - UMengUShare/Social/ReducedSina (6.4.8.2):
- UMengUShare/Core
- - UMengUShare/Social/ReducedWeChat (6.4.8):
+ - UMengUShare/Social/ReducedWeChat (6.4.8.2):
- UMengUShare/Core
- - UMengUShare/Social/Sina (6.4.8):
+ - UMengUShare/Social/Sina (6.4.8.2):
- UMengUShare/Core
- UMengUShare/Social/ReducedSina
- - UMengUShare/UI (6.4.8):
+ - UMengUShare/UI (6.4.8.2):
- UMengUShare/Core
- - WebViewJavascriptBridge (6.0.3)
- - WechatOpenSDK (1.8.1)
- YYAsyncLayer (1.0)
- YYCategories (1.0.4):
- YYCategories/no-arc (= 1.0.4)
@@ -89,30 +70,21 @@ PODS:
- YYImage/Core (= 1.0.4)
- YYImage/Core (1.0.4)
- YYText (1.0.7)
- - ZFDownload (1.0.2):
- - ASIHTTPRequest
- - ZFPlayer (2.1.5):
+ - ZFPlayer (2.1.6):
- Masonry
- ZJScrollPageView (0.4.0)
DEPENDENCIES:
- AFNetworking
- - ASIHTTPRequest
- - BaiduMapKit
- - CYLTabBarController
+ - BaiduMapKit (= 4.1.1)
- DWBubbleMenuButton
- FCUUID
- FDFullscreenPopGesture
- FMDB
- - GVUserDefaults
- - HMEmoticon
- HMQRCodeScanner
- - iflyMSC
- IQKeyboardManager
- KILabel
- - LxGridView
- M13ProgressSuite
- - MagicWindowSDK
- Masonry
- MBProgressHUD
- MJExtension
@@ -121,7 +93,7 @@ DEPENDENCIES:
- Reachability
- SDCycleScrollView
- SDWebImage
- - TDTouchID
+ - SDWebImage/GIF
- Toast
- TZImagePickerController
- UMengAnalytics
@@ -129,57 +101,78 @@ DEPENDENCIES:
- UMengUShare/Social/ReducedWeChat
- UMengUShare/Social/Sina
- UMengUShare/UI
- - WebViewJavascriptBridge
- YYAsyncLayer
- YYCategories
- YYImage
- YYText
- - ZFDownload
- - ZFPlayer
+ - ZFPlayer (= 2.1.6)
- ZJScrollPageView
+SPEC REPOS:
+ https://github.com/cocoapods/specs.git:
+ - AFNetworking
+ - BaiduMapKit
+ - DWBubbleMenuButton
+ - FCUUID
+ - FDFullscreenPopGesture
+ - FLAnimatedImage
+ - FMDB
+ - HMQRCodeScanner
+ - IQKeyboardManager
+ - KILabel
+ - M13ProgressSuite
+ - Masonry
+ - MBProgressHUD
+ - MJExtension
+ - MJRefresh
+ - MOFSPickerManager
+ - Reachability
+ - SDCycleScrollView
+ - SDWebImage
+ - Toast
+ - TZImagePickerController
+ - UICKeyChainStore
+ - UMengAnalytics
+ - UMengUShare
+ - YYAsyncLayer
+ - YYCategories
+ - YYImage
+ - YYText
+ - ZFPlayer
+ - ZJScrollPageView
+
SPEC CHECKSUMS:
- AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
- ASIHTTPRequest: ec013992946676b7978dcbde6396d57312d21db4
- BaiduMapKit: f61b19ecf07a3f2deede72b221b366bf698739ed
- CYLTabBarController: c374643dea6dadece8bdff9c70f7387f8ffd7d08
+ AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
+ BaiduMapKit: 51bba432a28316680676b4d453a70e5031f3a7eb
DWBubbleMenuButton: 4d9bdbb9d662bdf65c93ceb7fc65901871143d1e
FCUUID: bb054fc90cd7cd99320f9f6ff8e130fe607fba05
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
- FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa
- GVUserDefaults: 52d48cf8ba578b40a1a76312b196dfc9134ba36a
- HMEmoticon: 7cac18c01b74a2eaf833e2083c0238cb3c29b6a8
+ FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
+ FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
HMQRCodeScanner: 8db2d317c0e5cbe3b4709fe2b9f26c107d66554e
- iflyMSC: 7631cefeb1493b4bf0812a2a9b4fcdc6fe9f782e
- IQKeyboardManager: 0bfa4607d39924116b5c0c8b55b5d789288b5cba
+ IQKeyboardManager: 2a6e97afdafc7becf0cb17a9a8d795e3a980717f
KILabel: 4797807cdc0b4992dad8bf91175ddc973c3b569b
- LxGridView: af7b9360cce8eec2bcb11aa9d3cb7b9674372b74
M13ProgressSuite: ea9f7263e73e9215e6849dfa54e29ee0ad6a145c
- MagicWindowSDK: aa91ae646bb8b1ccd9479ea7fb0f4f7277ef31de
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
- MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
- MJExtension: 5932755f451458eefa24239358817f8d291240c7
- MJRefresh: 5f8552bc25ca8751c010f621c1098dbdaacbccd6
- MOFSPickerManager: 9eafa3d0230e24a79f6f0d9cf191d7f089d31ee9
+ MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
+ MJExtension: d9b9c74cbdeb724c1e9ecbb157b318276e62e876
+ MJRefresh: 6afc955813966afb08305477dd7a0d9ad5e79a16
+ MOFSPickerManager: 24c0a437874696622f132c47a351b89df5030f19
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SDCycleScrollView: 884b88f0266dd4708a0e1934975c69cb971707b1
- SDWebImage: 791bb72962b3492327ddcac4b1880bd1b5458431
- TDTouchID: d40027ed36e3d9f528b9b3f6bb6cf46f4f26f954
+ SDWebImage: 783af2c3fa36291a250030c4752ee370a9a51d13
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
- TZImagePickerController: 3b9413ae5d049b1fdc5b0c720ad283f35b679a50
- UICKeyChainStore: 239558492fa260531a0774cfc611ea83a6eaff3a
+ TZImagePickerController: cc0b74d5f01ab4cddcc24dcdfc3c7d68e6261056
+ UICKeyChainStore: 85db518bb1d294366d15ec9b92a416c4e670518f
UMengAnalytics: ef8d45f94c0e5771dc364cf6a5731d9d3b101da2
- UMengUShare: 7a0ab762ccd445ccfcf11bde8e7f81b29b9f5e1c
- WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
- WechatOpenSDK: 491d965d79335070328571d3e79f714549e79a5e
+ UMengUShare: 370d180101e13ee0227ae657ab119ba97243d2b3
YYAsyncLayer: df6b01ebc695c5f6b4c15dd5c23fa3e081eb25c0
YYCategories: 6bcd4314c6661a561410dce4a793379ebd306abd
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
- ZFDownload: a52f94ebb080833b8a8ceb19a409f2941343fe7f
- ZFPlayer: 8a80bf8eb4638b97fbceaefcd3ca9978e9f17c9d
+ ZFPlayer: 833cb3974b619bfd01a0ec1ebaabfe6f629e85b4
ZJScrollPageView: dd8778909cb2413782616ab156e873956f6b0682
-PODFILE CHECKSUM: 5804247614eaead164978ecf12f2683816f723b7
+PODFILE CHECKSUM: eb944b8090833ced99eac8c062404fd534cd2707
-COCOAPODS: 1.2.0
+COCOAPODS: 1.7.1
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h
deleted file mode 100644
index 5ce279a6..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h
+++ /dev/null
@@ -1,295 +0,0 @@
-// AFHTTPSessionManager.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-#if !TARGET_OS_WATCH
-#import
-#endif
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
-#import
-#else
-#import
-#endif
-
-#import "AFURLSessionManager.h"
-
-/**
- `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths.
-
- ## Subclassing Notes
-
- Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.
-
- For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect.
-
- ## Methods to Override
-
- To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`.
-
- ## Serialization
-
- Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``.
-
- Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to ``
-
- ## URL Construction Using Relative Paths
-
- For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`.
-
- Below are a few examples of how `baseURL` and relative paths interact:
-
- NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];
- [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo
- [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz
- [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo
- [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo
- [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/
- [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/
-
- Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.
-
- @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
- */
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface AFHTTPSessionManager : AFURLSessionManager
-
-/**
- The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.
- */
-@property (readonly, nonatomic, strong, nullable) NSURL *baseURL;
-
-/**
- Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.
-
- @warning `requestSerializer` must not be `nil`.
- */
-@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer;
-
-/**
- Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
-
- @warning `responseSerializer` must not be `nil`.
- */
-@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer;
-
-///---------------------
-/// @name Initialization
-///---------------------
-
-/**
- Creates and returns an `AFHTTPSessionManager` object.
- */
-+ (instancetype)manager;
-
-/**
- Initializes an `AFHTTPSessionManager` object with the specified base URL.
-
- @param url The base URL for the HTTP client.
-
- @return The newly-initialized HTTP client
- */
-- (instancetype)initWithBaseURL:(nullable NSURL *)url;
-
-/**
- Initializes an `AFHTTPSessionManager` object with the specified base URL.
-
- This is the designated initializer.
-
- @param url The base URL for the HTTP client.
- @param configuration The configuration used to create the managed session.
-
- @return The newly-initialized HTTP client
- */
-- (instancetype)initWithBaseURL:(nullable NSURL *)url
- sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
-
-///---------------------------
-/// @name Making HTTP Requests
-///---------------------------
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `GET` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
- parameters:(nullable id)parameters
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
-
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `GET` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
- parameters:(nullable id)parameters
- progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
- parameters:(nullable id)parameters
- success:(nullable void (^)(NSURLSessionDataTask *task))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `POST` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(nullable id)parameters
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `POST` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(nullable id)parameters
- progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(nullable id)parameters
- constructingBodyWithBlock:(nullable void (^)(id formData))block
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
- @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(nullable id)parameters
- constructingBodyWithBlock:(nullable void (^)(id formData))block
- progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `PUT` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
- parameters:(nullable id)parameters
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `PATCH` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
- parameters:(nullable id)parameters
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-/**
- Creates and runs an `NSURLSessionDataTask` with a `DELETE` request.
-
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded according to the client request serializer.
- @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer.
- @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred.
-
- @see -dataTaskWithRequest:completionHandler:
- */
-- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
- parameters:(nullable id)parameters
- success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
-
-@end
-
-NS_ASSUME_NONNULL_END
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m b/iOSProject/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m
deleted file mode 100644
index 25910706..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m
+++ /dev/null
@@ -1,361 +0,0 @@
-// AFHTTPSessionManager.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFHTTPSessionManager.h"
-
-#import "AFURLRequestSerialization.h"
-#import "AFURLResponseSerialization.h"
-
-#import
-#import
-#import
-
-#import
-#import
-#import
-#import
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-#import
-#elif TARGET_OS_WATCH
-#import
-#endif
-
-@interface AFHTTPSessionManager ()
-@property (readwrite, nonatomic, strong) NSURL *baseURL;
-@end
-
-@implementation AFHTTPSessionManager
-@dynamic responseSerializer;
-
-+ (instancetype)manager {
- return [[[self class] alloc] initWithBaseURL:nil];
-}
-
-- (instancetype)init {
- return [self initWithBaseURL:nil];
-}
-
-- (instancetype)initWithBaseURL:(NSURL *)url {
- return [self initWithBaseURL:url sessionConfiguration:nil];
-}
-
-- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
- return [self initWithBaseURL:nil sessionConfiguration:configuration];
-}
-
-- (instancetype)initWithBaseURL:(NSURL *)url
- sessionConfiguration:(NSURLSessionConfiguration *)configuration
-{
- self = [super initWithSessionConfiguration:configuration];
- if (!self) {
- return nil;
- }
-
- // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected
- if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) {
- url = [url URLByAppendingPathComponent:@""];
- }
-
- self.baseURL = url;
-
- self.requestSerializer = [AFHTTPRequestSerializer serializer];
- self.responseSerializer = [AFJSONResponseSerializer serializer];
-
- return self;
-}
-
-#pragma mark -
-
-- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer {
- NSParameterAssert(requestSerializer);
-
- _requestSerializer = requestSerializer;
-}
-
-- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer {
- NSParameterAssert(responseSerializer);
-
- [super setResponseSerializer:responseSerializer];
-}
-
-#pragma mark -
-
-- (NSURLSessionDataTask *)GET:(NSString *)URLString
- parameters:(id)parameters
- success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
-
- return [self GET:URLString parameters:parameters progress:nil success:success failure:failure];
-}
-
-- (NSURLSessionDataTask *)GET:(NSString *)URLString
- parameters:(id)parameters
- progress:(void (^)(NSProgress * _Nonnull))downloadProgress
- success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
- failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
-{
-
- NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET"
- URLString:URLString
- parameters:parameters
- uploadProgress:nil
- downloadProgress:downloadProgress
- success:success
- failure:failure];
-
- [dataTask resume];
-
- return dataTask;
-}
-
-- (NSURLSessionDataTask *)HEAD:(NSString *)URLString
- parameters:(id)parameters
- success:(void (^)(NSURLSessionDataTask *task))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
- NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) {
- if (success) {
- success(task);
- }
- } failure:failure];
-
- [dataTask resume];
-
- return dataTask;
-}
-
-- (NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(id)parameters
- success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
- return [self POST:URLString parameters:parameters progress:nil success:success failure:failure];
-}
-
-- (NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(id)parameters
- progress:(void (^)(NSProgress * _Nonnull))uploadProgress
- success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
- failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
-{
- NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure];
-
- [dataTask resume];
-
- return dataTask;
-}
-
-- (NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(nullable id)parameters
- constructingBodyWithBlock:(nullable void (^)(id _Nonnull))block
- success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
-{
- return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure];
-}
-
-- (NSURLSessionDataTask *)POST:(NSString *)URLString
- parameters:(id)parameters
- constructingBodyWithBlock:(void (^)(id formData))block
- progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
- success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
- NSError *serializationError = nil;
- NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError];
- if (serializationError) {
- if (failure) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
- failure(nil, serializationError);
- });
-#pragma clang diagnostic pop
- }
-
- return nil;
- }
-
- __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
- if (error) {
- if (failure) {
- failure(task, error);
- }
- } else {
- if (success) {
- success(task, responseObject);
- }
- }
- }];
-
- [task resume];
-
- return task;
-}
-
-- (NSURLSessionDataTask *)PUT:(NSString *)URLString
- parameters:(id)parameters
- success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
- NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
-
- [dataTask resume];
-
- return dataTask;
-}
-
-- (NSURLSessionDataTask *)PATCH:(NSString *)URLString
- parameters:(id)parameters
- success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
- NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
-
- [dataTask resume];
-
- return dataTask;
-}
-
-- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
- parameters:(id)parameters
- success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
- failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
-{
- NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
-
- [dataTask resume];
-
- return dataTask;
-}
-
-- (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method
- URLString:(NSString *)URLString
- parameters:(id)parameters
- uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress
- downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress
- success:(void (^)(NSURLSessionDataTask *, id))success
- failure:(void (^)(NSURLSessionDataTask *, NSError *))failure
-{
- NSError *serializationError = nil;
- NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError];
- if (serializationError) {
- if (failure) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
- failure(nil, serializationError);
- });
-#pragma clang diagnostic pop
- }
-
- return nil;
- }
-
- __block NSURLSessionDataTask *dataTask = nil;
- dataTask = [self dataTaskWithRequest:request
- uploadProgress:uploadProgress
- downloadProgress:downloadProgress
- completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
- if (error) {
- if (failure) {
- failure(dataTask, error);
- }
- } else {
- if (success) {
- success(dataTask, responseObject);
- }
- }
- }];
-
- return dataTask;
-}
-
-#pragma mark - NSObject
-
-- (NSString *)description {
- return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue];
-}
-
-#pragma mark - NSSecureCoding
-
-+ (BOOL)supportsSecureCoding {
- return YES;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))];
- NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"];
- if (!configuration) {
- NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"];
- if (configurationIdentifier) {
-#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100)
- configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier];
-#else
- configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier];
-#endif
- }
- }
-
- self = [self initWithBaseURL:baseURL sessionConfiguration:configuration];
- if (!self) {
- return nil;
- }
-
- self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
- self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
- AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
- if (decodedPolicy) {
- self.securityPolicy = decodedPolicy;
- }
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))];
- if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) {
- [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"];
- } else {
- [coder encodeObject:self.session.configuration.identifier forKey:@"identifier"];
- }
- [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];
- [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];
- [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration];
-
- HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
- HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
- HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];
- return HTTPClient;
-}
-
-@end
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
deleted file mode 100644
index 0feb18d3..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
+++ /dev/null
@@ -1,206 +0,0 @@
-// AFNetworkReachabilityManager.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#if !TARGET_OS_WATCH
-#import
-
-typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
- AFNetworkReachabilityStatusUnknown = -1,
- AFNetworkReachabilityStatusNotReachable = 0,
- AFNetworkReachabilityStatusReachableViaWWAN = 1,
- AFNetworkReachabilityStatusReachableViaWiFi = 2,
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
-
- Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
-
- See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
-
- @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
- */
-@interface AFNetworkReachabilityManager : NSObject
-
-/**
- The current network reachability status.
- */
-@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
-
-/**
- Whether or not the network is currently reachable.
- */
-@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;
-
-/**
- Whether or not the network is currently reachable via WWAN.
- */
-@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;
-
-/**
- Whether or not the network is currently reachable via WiFi.
- */
-@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;
-
-///---------------------
-/// @name Initialization
-///---------------------
-
-/**
- Returns the shared network reachability manager.
- */
-+ (instancetype)sharedManager;
-
-/**
- Creates and returns a network reachability manager with the default socket address.
-
- @return An initialized network reachability manager, actively monitoring the default socket address.
- */
-+ (instancetype)manager;
-
-/**
- Creates and returns a network reachability manager for the specified domain.
-
- @param domain The domain used to evaluate network reachability.
-
- @return An initialized network reachability manager, actively monitoring the specified domain.
- */
-+ (instancetype)managerForDomain:(NSString *)domain;
-
-/**
- Creates and returns a network reachability manager for the socket address.
-
- @param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
-
- @return An initialized network reachability manager, actively monitoring the specified socket address.
- */
-+ (instancetype)managerForAddress:(const void *)address;
-
-/**
- Initializes an instance of a network reachability manager from the specified reachability object.
-
- @param reachability The reachability object to monitor.
-
- @return An initialized network reachability manager, actively monitoring the specified reachability.
- */
-- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
-
-///--------------------------------------------------
-/// @name Starting & Stopping Reachability Monitoring
-///--------------------------------------------------
-
-/**
- Starts monitoring for changes in network reachability status.
- */
-- (void)startMonitoring;
-
-/**
- Stops monitoring for changes in network reachability status.
- */
-- (void)stopMonitoring;
-
-///-------------------------------------------------
-/// @name Getting Localized Reachability Description
-///-------------------------------------------------
-
-/**
- Returns a localized string representation of the current network reachability status.
- */
-- (NSString *)localizedNetworkReachabilityStatusString;
-
-///---------------------------------------------------
-/// @name Setting Network Reachability Change Callback
-///---------------------------------------------------
-
-/**
- Sets a callback to be executed when the network availability of the `baseURL` host changes.
-
- @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.
- */
-- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;
-
-@end
-
-///----------------
-/// @name Constants
-///----------------
-
-/**
- ## Network Reachability
-
- The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
-
- enum {
- AFNetworkReachabilityStatusUnknown,
- AFNetworkReachabilityStatusNotReachable,
- AFNetworkReachabilityStatusReachableViaWWAN,
- AFNetworkReachabilityStatusReachableViaWiFi,
- }
-
- `AFNetworkReachabilityStatusUnknown`
- The `baseURL` host reachability is not known.
-
- `AFNetworkReachabilityStatusNotReachable`
- The `baseURL` host cannot be reached.
-
- `AFNetworkReachabilityStatusReachableViaWWAN`
- The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
-
- `AFNetworkReachabilityStatusReachableViaWiFi`
- The `baseURL` host can be reached via a Wi-Fi connection.
-
- ### Keys for Notification UserInfo Dictionary
-
- Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
-
- `AFNetworkingReachabilityNotificationStatusItem`
- A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
- The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
- */
-
-///--------------------
-/// @name Notifications
-///--------------------
-
-/**
- Posted when network reachability changes.
- This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
-
- @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`).
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
-FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
-
-///--------------------
-/// @name Functions
-///--------------------
-
-/**
- Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
- */
-FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
-
-NS_ASSUME_NONNULL_END
-#endif
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m b/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m
deleted file mode 100644
index d4583648..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m
+++ /dev/null
@@ -1,263 +0,0 @@
-// AFNetworkReachabilityManager.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFNetworkReachabilityManager.h"
-#if !TARGET_OS_WATCH
-
-#import
-#import
-#import
-#import
-#import
-
-NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";
-NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem";
-
-typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);
-
-NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) {
- switch (status) {
- case AFNetworkReachabilityStatusNotReachable:
- return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil);
- case AFNetworkReachabilityStatusReachableViaWWAN:
- return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil);
- case AFNetworkReachabilityStatusReachableViaWiFi:
- return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil);
- case AFNetworkReachabilityStatusUnknown:
- default:
- return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil);
- }
-}
-
-static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) {
- BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
- BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
- BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0));
- BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0);
- BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction));
-
- AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown;
- if (isNetworkReachable == NO) {
- status = AFNetworkReachabilityStatusNotReachable;
- }
-#if TARGET_OS_IPHONE
- else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
- status = AFNetworkReachabilityStatusReachableViaWWAN;
- }
-#endif
- else {
- status = AFNetworkReachabilityStatusReachableViaWiFi;
- }
-
- return status;
-}
-
-/**
- * Queue a status change notification for the main thread.
- *
- * This is done to ensure that the notifications are received in the same order
- * as they are sent. If notifications are sent directly, it is possible that
- * a queued notification (for an earlier status condition) is processed after
- * the later update, resulting in the listener being left in the wrong state.
- */
-static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block) {
- AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags);
- dispatch_async(dispatch_get_main_queue(), ^{
- if (block) {
- block(status);
- }
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
- NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) };
- [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];
- });
-}
-
-static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {
- AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info);
-}
-
-
-static const void * AFNetworkReachabilityRetainCallback(const void *info) {
- return Block_copy(info);
-}
-
-static void AFNetworkReachabilityReleaseCallback(const void *info) {
- if (info) {
- Block_release(info);
- }
-}
-
-@interface AFNetworkReachabilityManager ()
-@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability;
-@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
-@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock;
-@end
-
-@implementation AFNetworkReachabilityManager
-
-+ (instancetype)sharedManager {
- static AFNetworkReachabilityManager *_sharedManager = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- _sharedManager = [self manager];
- });
-
- return _sharedManager;
-}
-
-+ (instancetype)managerForDomain:(NSString *)domain {
- SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);
-
- AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
-
- CFRelease(reachability);
-
- return manager;
-}
-
-+ (instancetype)managerForAddress:(const void *)address {
- SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);
- AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
-
- CFRelease(reachability);
-
- return manager;
-}
-
-+ (instancetype)manager
-{
-#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
- struct sockaddr_in6 address;
- bzero(&address, sizeof(address));
- address.sin6_len = sizeof(address);
- address.sin6_family = AF_INET6;
-#else
- struct sockaddr_in address;
- bzero(&address, sizeof(address));
- address.sin_len = sizeof(address);
- address.sin_family = AF_INET;
-#endif
- return [self managerForAddress:&address];
-}
-
-- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- _networkReachability = CFRetain(reachability);
- self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown;
-
- return self;
-}
-
-- (instancetype)init NS_UNAVAILABLE
-{
- return nil;
-}
-
-- (void)dealloc {
- [self stopMonitoring];
-
- if (_networkReachability != NULL) {
- CFRelease(_networkReachability);
- }
-}
-
-#pragma mark -
-
-- (BOOL)isReachable {
- return [self isReachableViaWWAN] || [self isReachableViaWiFi];
-}
-
-- (BOOL)isReachableViaWWAN {
- return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN;
-}
-
-- (BOOL)isReachableViaWiFi {
- return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi;
-}
-
-#pragma mark -
-
-- (void)startMonitoring {
- [self stopMonitoring];
-
- if (!self.networkReachability) {
- return;
- }
-
- __weak __typeof(self)weakSelf = self;
- AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
-
- strongSelf.networkReachabilityStatus = status;
- if (strongSelf.networkReachabilityStatusBlock) {
- strongSelf.networkReachabilityStatusBlock(status);
- }
-
- };
-
- SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL};
- SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context);
- SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
-
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{
- SCNetworkReachabilityFlags flags;
- if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) {
- AFPostReachabilityStatusChange(flags, callback);
- }
- });
-}
-
-- (void)stopMonitoring {
- if (!self.networkReachability) {
- return;
- }
-
- SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
-}
-
-#pragma mark -
-
-- (NSString *)localizedNetworkReachabilityStatusString {
- return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus);
-}
-
-#pragma mark -
-
-- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block {
- self.networkReachabilityStatusBlock = block;
-}
-
-#pragma mark - NSKeyValueObserving
-
-+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
- if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) {
- return [NSSet setWithObject:@"networkReachabilityStatus"];
- }
-
- return [super keyPathsForValuesAffectingValueForKey:key];
-}
-
-@end
-#endif
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworking.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworking.h
deleted file mode 100644
index e2fb2f44..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFNetworking.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// AFNetworking.h
-//
-// Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-#import
-#import
-
-#ifndef _AFNETWORKING_
- #define _AFNETWORKING_
-
- #import "AFURLRequestSerialization.h"
- #import "AFURLResponseSerialization.h"
- #import "AFSecurityPolicy.h"
-
-#if !TARGET_OS_WATCH
- #import "AFNetworkReachabilityManager.h"
-#endif
-
- #import "AFURLSessionManager.h"
- #import "AFHTTPSessionManager.h"
-
-#endif /* _AFNETWORKING_ */
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h
deleted file mode 100644
index c005efa8..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// AFSecurityPolicy.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-#import
-
-typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
- AFSSLPinningModeNone,
- AFSSLPinningModePublicKey,
- AFSSLPinningModeCertificate,
-};
-
-/**
- `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
-
- Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
- */
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface AFSecurityPolicy : NSObject
-
-/**
- The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
- */
-@property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
-
-/**
- The certificates used to evaluate server trust according to the SSL pinning mode.
-
- By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`.
-
- Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.
- */
-@property (nonatomic, strong, nullable) NSSet *pinnedCertificates;
-
-/**
- Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.
- */
-@property (nonatomic, assign) BOOL allowInvalidCertificates;
-
-/**
- Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.
- */
-@property (nonatomic, assign) BOOL validatesDomainName;
-
-///-----------------------------------------
-/// @name Getting Certificates from the Bundle
-///-----------------------------------------
-
-/**
- Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`.
-
- @return The certificates included in the given bundle.
- */
-+ (NSSet *)certificatesInBundle:(NSBundle *)bundle;
-
-///-----------------------------------------
-/// @name Getting Specific Security Policies
-///-----------------------------------------
-
-/**
- Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.
-
- @return The default security policy.
- */
-+ (instancetype)defaultPolicy;
-
-///---------------------
-/// @name Initialization
-///---------------------
-
-/**
- Creates and returns a security policy with the specified pinning mode.
-
- @param pinningMode The SSL pinning mode.
-
- @return A new security policy.
- */
-+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode;
-
-/**
- Creates and returns a security policy with the specified pinning mode.
-
- @param pinningMode The SSL pinning mode.
- @param pinnedCertificates The certificates to pin against.
-
- @return A new security policy.
- */
-+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates;
-
-///------------------------------
-/// @name Evaluating Server Trust
-///------------------------------
-
-/**
- Whether or not the specified server trust should be accepted, based on the security policy.
-
- This method should be used when responding to an authentication challenge from a server.
-
- @param serverTrust The X.509 certificate trust of the server.
- @param domain The domain of serverTrust. If `nil`, the domain will not be validated.
-
- @return Whether or not to trust the server.
- */
-- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
- forDomain:(nullable NSString *)domain;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-///----------------
-/// @name Constants
-///----------------
-
-/**
- ## SSL Pinning Modes
-
- The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes.
-
- enum {
- AFSSLPinningModeNone,
- AFSSLPinningModePublicKey,
- AFSSLPinningModeCertificate,
- }
-
- `AFSSLPinningModeNone`
- Do not used pinned certificates to validate servers.
-
- `AFSSLPinningModePublicKey`
- Validate host certificates against public keys of pinned certificates.
-
- `AFSSLPinningModeCertificate`
- Validate host certificates against pinned certificates.
-*/
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m b/iOSProject/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m
deleted file mode 100644
index ec81d377..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m
+++ /dev/null
@@ -1,353 +0,0 @@
-// AFSecurityPolicy.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFSecurityPolicy.h"
-
-#import
-
-#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV
-static NSData * AFSecKeyGetData(SecKeyRef key) {
- CFDataRef data = NULL;
-
- __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out);
-
- return (__bridge_transfer NSData *)data;
-
-_out:
- if (data) {
- CFRelease(data);
- }
-
- return nil;
-}
-#endif
-
-static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {
-#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
- return [(__bridge id)key1 isEqual:(__bridge id)key2];
-#else
- return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)];
-#endif
-}
-
-static id AFPublicKeyForCertificate(NSData *certificate) {
- id allowedPublicKey = nil;
- SecCertificateRef allowedCertificate;
- SecCertificateRef allowedCertificates[1];
- CFArrayRef tempCertificates = nil;
- SecPolicyRef policy = nil;
- SecTrustRef allowedTrust = nil;
- SecTrustResultType result;
-
- allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate);
- __Require_Quiet(allowedCertificate != NULL, _out);
-
- allowedCertificates[0] = allowedCertificate;
- tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL);
-
- policy = SecPolicyCreateBasicX509();
- __Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out);
- __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);
-
- allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);
-
-_out:
- if (allowedTrust) {
- CFRelease(allowedTrust);
- }
-
- if (policy) {
- CFRelease(policy);
- }
-
- if (tempCertificates) {
- CFRelease(tempCertificates);
- }
-
- if (allowedCertificate) {
- CFRelease(allowedCertificate);
- }
-
- return allowedPublicKey;
-}
-
-static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) {
- BOOL isValid = NO;
- SecTrustResultType result;
- __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out);
-
- isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
-
-_out:
- return isValid;
-}
-
-static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) {
- CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
- NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];
-
- for (CFIndex i = 0; i < certificateCount; i++) {
- SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);
- [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)];
- }
-
- return [NSArray arrayWithArray:trustChain];
-}
-
-static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
- SecPolicyRef policy = SecPolicyCreateBasicX509();
- CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
- NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount];
- for (CFIndex i = 0; i < certificateCount; i++) {
- SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i);
-
- SecCertificateRef someCertificates[] = {certificate};
- CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL);
-
- SecTrustRef trust;
- __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out);
-
- SecTrustResultType result;
- __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out);
-
- [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)];
-
- _out:
- if (trust) {
- CFRelease(trust);
- }
-
- if (certificates) {
- CFRelease(certificates);
- }
-
- continue;
- }
- CFRelease(policy);
-
- return [NSArray arrayWithArray:trustChain];
-}
-
-#pragma mark -
-
-@interface AFSecurityPolicy()
-@property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode;
-@property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys;
-@end
-
-@implementation AFSecurityPolicy
-
-+ (NSSet *)certificatesInBundle:(NSBundle *)bundle {
- NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."];
-
- NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]];
- for (NSString *path in paths) {
- NSData *certificateData = [NSData dataWithContentsOfFile:path];
- [certificates addObject:certificateData];
- }
-
- return [NSSet setWithSet:certificates];
-}
-
-+ (NSSet *)defaultPinnedCertificates {
- static NSSet *_defaultPinnedCertificates = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- _defaultPinnedCertificates = [self certificatesInBundle:bundle];
- });
-
- return _defaultPinnedCertificates;
-}
-
-+ (instancetype)defaultPolicy {
- AFSecurityPolicy *securityPolicy = [[self alloc] init];
- securityPolicy.SSLPinningMode = AFSSLPinningModeNone;
-
- return securityPolicy;
-}
-
-+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode {
- return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]];
-}
-
-+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates {
- AFSecurityPolicy *securityPolicy = [[self alloc] init];
- securityPolicy.SSLPinningMode = pinningMode;
-
- [securityPolicy setPinnedCertificates:pinnedCertificates];
-
- return securityPolicy;
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.validatesDomainName = YES;
-
- return self;
-}
-
-- (void)setPinnedCertificates:(NSSet *)pinnedCertificates {
- _pinnedCertificates = pinnedCertificates;
-
- if (self.pinnedCertificates) {
- NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]];
- for (NSData *certificate in self.pinnedCertificates) {
- id publicKey = AFPublicKeyForCertificate(certificate);
- if (!publicKey) {
- continue;
- }
- [mutablePinnedPublicKeys addObject:publicKey];
- }
- self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys];
- } else {
- self.pinnedPublicKeys = nil;
- }
-}
-
-#pragma mark -
-
-- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust
- forDomain:(NSString *)domain
-{
- if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) {
- // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html
- // According to the docs, you should only trust your provided certs for evaluation.
- // Pinned certificates are added to the trust. Without pinned certificates,
- // there is nothing to evaluate against.
- //
- // From Apple Docs:
- // "Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors).
- // Instead, add your own (self-signed) CA certificate to the list of trusted anchors."
- NSLog(@"In order to validate a domain name for self signed certificates, you MUST use pinning.");
- return NO;
- }
-
- NSMutableArray *policies = [NSMutableArray array];
- if (self.validatesDomainName) {
- [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)];
- } else {
- [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()];
- }
-
- SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);
-
- if (self.SSLPinningMode == AFSSLPinningModeNone) {
- return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust);
- } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) {
- return NO;
- }
-
- switch (self.SSLPinningMode) {
- case AFSSLPinningModeNone:
- default:
- return NO;
- case AFSSLPinningModeCertificate: {
- NSMutableArray *pinnedCertificates = [NSMutableArray array];
- for (NSData *certificateData in self.pinnedCertificates) {
- [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)];
- }
- SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates);
-
- if (!AFServerTrustIsValid(serverTrust)) {
- return NO;
- }
-
- // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA)
- NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust);
-
- for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) {
- if ([self.pinnedCertificates containsObject:trustChainCertificate]) {
- return YES;
- }
- }
-
- return NO;
- }
- case AFSSLPinningModePublicKey: {
- NSUInteger trustedPublicKeyCount = 0;
- NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust);
-
- for (id trustChainPublicKey in publicKeys) {
- for (id pinnedPublicKey in self.pinnedPublicKeys) {
- if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) {
- trustedPublicKeyCount += 1;
- }
- }
- }
- return trustedPublicKeyCount > 0;
- }
- }
-
- return NO;
-}
-
-#pragma mark - NSKeyValueObserving
-
-+ (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys {
- return [NSSet setWithObject:@"pinnedCertificates"];
-}
-
-#pragma mark - NSSecureCoding
-
-+ (BOOL)supportsSecureCoding {
- return YES;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
-
- self = [self init];
- if (!self) {
- return nil;
- }
-
- self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue];
- self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
- self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))];
- self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))];
- [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
- [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))];
- [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];
- securityPolicy.SSLPinningMode = self.SSLPinningMode;
- securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates;
- securityPolicy.validatesDomainName = self.validatesDomainName;
- securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone];
-
- return securityPolicy;
-}
-
-@end
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h
deleted file mode 100644
index 694696b9..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h
+++ /dev/null
@@ -1,479 +0,0 @@
-// AFURLRequestSerialization.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-#import
-#elif TARGET_OS_WATCH
-#import
-#endif
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- Returns a percent-escaped string following RFC 3986 for a query string key or value.
- RFC 3986 states that the following characters are "reserved" characters.
- - General Delimiters: ":", "#", "[", "]", "@", "?", "/"
- - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
-
- In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
- query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
- should be percent-escaped in the query string.
-
- @param string The string to be percent-escaped.
-
- @return The percent-escaped string.
- */
-FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string);
-
-/**
- A helper method to generate encoded url query parameters for appending to the end of a URL.
-
- @param parameters A dictionary of key/values to be encoded.
-
- @return A url encoded query string
- */
-FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters);
-
-/**
- The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.
-
- For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`.
- */
-@protocol AFURLRequestSerialization
-
-/**
- Returns a request with the specified parameters encoded into a copy of the original request.
-
- @param request The original request.
- @param parameters The parameters to be encoded.
- @param error The error that occurred while attempting to encode the request parameters.
-
- @return A serialized request.
- */
-- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
- withParameters:(nullable id)parameters
- error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;
-
-@end
-
-#pragma mark -
-
-/**
-
- */
-typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) {
- AFHTTPRequestQueryStringDefaultStyle = 0,
-};
-
-@protocol AFMultipartFormData;
-
-/**
- `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
-
- Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior.
- */
-@interface AFHTTPRequestSerializer : NSObject
-
-/**
- The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default.
- */
-@property (nonatomic, assign) NSStringEncoding stringEncoding;
-
-/**
- Whether created requests can use the device’s cellular radio (if present). `YES` by default.
-
- @see NSMutableURLRequest -setAllowsCellularAccess:
- */
-@property (nonatomic, assign) BOOL allowsCellularAccess;
-
-/**
- The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default.
-
- @see NSMutableURLRequest -setCachePolicy:
- */
-@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;
-
-/**
- Whether created requests should use the default cookie handling. `YES` by default.
-
- @see NSMutableURLRequest -setHTTPShouldHandleCookies:
- */
-@property (nonatomic, assign) BOOL HTTPShouldHandleCookies;
-
-/**
- Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default
-
- @see NSMutableURLRequest -setHTTPShouldUsePipelining:
- */
-@property (nonatomic, assign) BOOL HTTPShouldUsePipelining;
-
-/**
- The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default.
-
- @see NSMutableURLRequest -setNetworkServiceType:
- */
-@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType;
-
-/**
- The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds.
-
- @see NSMutableURLRequest -setTimeoutInterval:
- */
-@property (nonatomic, assign) NSTimeInterval timeoutInterval;
-
-///---------------------------------------
-/// @name Configuring HTTP Request Headers
-///---------------------------------------
-
-/**
- Default HTTP header field values to be applied to serialized requests. By default, these include the following:
-
- - `Accept-Language` with the contents of `NSLocale +preferredLanguages`
- - `User-Agent` with the contents of various bundle identifiers and OS designations
-
- @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`.
- */
-@property (readonly, nonatomic, strong) NSDictionary *HTTPRequestHeaders;
-
-/**
- Creates and returns a serializer with default configuration.
- */
-+ (instancetype)serializer;
-
-/**
- Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header.
-
- @param field The HTTP header to set a default value for
- @param value The value set as default for the specified header, or `nil`
- */
-- (void)setValue:(nullable NSString *)value
-forHTTPHeaderField:(NSString *)field;
-
-/**
- Returns the value for the HTTP headers set in the request serializer.
-
- @param field The HTTP header to retrieve the default value for
-
- @return The value set as default for the specified header, or `nil`
- */
-- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field;
-
-/**
- Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
-
- @param username The HTTP basic auth username
- @param password The HTTP basic auth password
- */
-- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
- password:(NSString *)password;
-
-/**
- Clears any existing value for the "Authorization" HTTP header.
- */
-- (void)clearAuthorizationHeader;
-
-///-------------------------------------------------------
-/// @name Configuring Query String Parameter Serialization
-///-------------------------------------------------------
-
-/**
- HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default.
- */
-@property (nonatomic, strong) NSSet *HTTPMethodsEncodingParametersInURI;
-
-/**
- Set the method of query string serialization according to one of the pre-defined styles.
-
- @param style The serialization style.
-
- @see AFHTTPRequestQueryStringSerializationStyle
- */
-- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style;
-
-/**
- Set the a custom method of query string serialization according to the specified block.
-
- @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request.
- */
-- (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block;
-
-///-------------------------------
-/// @name Creating Request Objects
-///-------------------------------
-
-/**
- Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string.
-
- If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body.
-
- @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.
- @param error The error that occurred while constructing the request.
-
- @return An `NSMutableURLRequest` object.
- */
-- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
- URLString:(NSString *)URLString
- parameters:(nullable id)parameters
- error:(NSError * _Nullable __autoreleasing *)error;
-
-/**
- Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2
-
- Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream.
-
- @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`.
- @param URLString The URL string used to create the request URL.
- @param parameters The parameters to be encoded and set in the request HTTP body.
- @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol.
- @param error The error that occurred while constructing the request.
-
- @return An `NSMutableURLRequest` object
- */
-- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
- URLString:(NSString *)URLString
- parameters:(nullable NSDictionary *)parameters
- constructingBodyWithBlock:(nullable void (^)(id formData))block
- error:(NSError * _Nullable __autoreleasing *)error;
-
-/**
- Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished.
-
- @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`.
- @param fileURL The file URL to write multipart form contents to.
- @param handler A handler block to execute.
-
- @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.
-
- @see https://github.com/AFNetworking/AFNetworking/issues/1398
- */
-- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
- writingStreamContentsToFile:(NSURL *)fileURL
- completionHandler:(nullable void (^)(NSError * _Nullable error))handler;
-
-@end
-
-#pragma mark -
-
-/**
- The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`.
- */
-@protocol AFMultipartFormData
-
-/**
- Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary.
-
- The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively.
-
- @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
- @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
-
- @return `YES` if the file data was successfully appended, otherwise `NO`.
- */
-- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
- name:(NSString *)name
- error:(NSError * _Nullable __autoreleasing *)error;
-
-/**
- Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
-
- @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
- @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`.
- @param mimeType The declared MIME type of the file data. This parameter must not be `nil`.
- @param error If an error occurs, upon return contains an `NSError` object that describes the problem.
-
- @return `YES` if the file data was successfully appended otherwise `NO`.
- */
-- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
- name:(NSString *)name
- fileName:(NSString *)fileName
- mimeType:(NSString *)mimeType
- error:(NSError * _Nullable __autoreleasing *)error;
-
-/**
- Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary.
-
- @param inputStream The input stream to be appended to the form data
- @param name The name to be associated with the specified input stream. This parameter must not be `nil`.
- @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`.
- @param length The length of the specified input stream in bytes.
- @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
- */
-- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream
- name:(NSString *)name
- fileName:(NSString *)fileName
- length:(int64_t)length
- mimeType:(NSString *)mimeType;
-
-/**
- Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary.
-
- @param data The data to be encoded and appended to the form data.
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
- @param fileName The filename to be associated with the specified data. This parameter must not be `nil`.
- @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.
- */
-- (void)appendPartWithFileData:(NSData *)data
- name:(NSString *)name
- fileName:(NSString *)fileName
- mimeType:(NSString *)mimeType;
-
-/**
- Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.
-
- @param data The data to be encoded and appended to the form data.
- @param name The name to be associated with the specified data. This parameter must not be `nil`.
- */
-
-- (void)appendPartWithFormData:(NSData *)data
- name:(NSString *)name;
-
-
-/**
- Appends HTTP headers, followed by the encoded data and the multipart form boundary.
-
- @param headers The HTTP headers to be appended to the form data.
- @param body The data to be encoded and appended to the form data. This parameter must not be `nil`.
- */
-- (void)appendPartWithHeaders:(nullable NSDictionary *)headers
- body:(NSData *)body;
-
-/**
- Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream.
-
- When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth.
-
- @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb.
- @param delay Duration of delay each time a packet is read. By default, no delay is set.
- */
-- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
- delay:(NSTimeInterval)delay;
-
-@end
-
-#pragma mark -
-
-/**
- `AFJSONRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`.
- */
-@interface AFJSONRequestSerializer : AFHTTPRequestSerializer
-
-/**
- Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default.
- */
-@property (nonatomic, assign) NSJSONWritingOptions writingOptions;
-
-/**
- Creates and returns a JSON serializer with specified reading and writing options.
-
- @param writingOptions The specified JSON writing options.
- */
-+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions;
-
-@end
-
-#pragma mark -
-
-/**
- `AFPropertyListRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`.
- */
-@interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer
-
-/**
- The property list format. Possible values are described in "NSPropertyListFormat".
- */
-@property (nonatomic, assign) NSPropertyListFormat format;
-
-/**
- @warning The `writeOptions` property is currently unused.
- */
-@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions;
-
-/**
- Creates and returns a property list serializer with a specified format, read options, and write options.
-
- @param format The property list format.
- @param writeOptions The property list write options.
-
- @warning The `writeOptions` property is currently unused.
- */
-+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
- writeOptions:(NSPropertyListWriteOptions)writeOptions;
-
-@end
-
-#pragma mark -
-
-///----------------
-/// @name Constants
-///----------------
-
-/**
- ## Error Domains
-
- The following error domain is predefined.
-
- - `NSString * const AFURLRequestSerializationErrorDomain`
-
- ### Constants
-
- `AFURLRequestSerializationErrorDomain`
- AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
- */
-FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain;
-
-/**
- ## User info dictionary keys
-
- These keys may exist in the user info dictionary, in addition to those defined for NSError.
-
- - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey`
-
- ### Constants
-
- `AFNetworkingOperationFailingURLRequestErrorKey`
- The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
-
-/**
- ## Throttling Bandwidth for HTTP Request Input Streams
-
- @see -throttleBandwidthWithPacketSize:delay:
-
- ### Constants
-
- `kAFUploadStream3GSuggestedPacketSize`
- Maximum packet size, in number of bytes. Equal to 16kb.
-
- `kAFUploadStream3GSuggestedDelay`
- Duration of delay each time a packet is read. Equal to 0.2 seconds.
- */
-FOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize;
-FOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay;
-
-NS_ASSUME_NONNULL_END
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m b/iOSProject/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m
deleted file mode 100644
index 9a2ac980..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m
+++ /dev/null
@@ -1,1376 +0,0 @@
-// AFURLRequestSerialization.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFURLRequestSerialization.h"
-
-#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
-#import
-#else
-#import
-#endif
-
-NSString * const AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request";
-NSString * const AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response";
-
-typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error);
-
-/**
- Returns a percent-escaped string following RFC 3986 for a query string key or value.
- RFC 3986 states that the following characters are "reserved" characters.
- - General Delimiters: ":", "#", "[", "]", "@", "?", "/"
- - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="
-
- In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
- query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
- should be percent-escaped in the query string.
- - parameter string: The string to be percent-escaped.
- - returns: The percent-escaped string.
- */
-NSString * AFPercentEscapedStringFromString(NSString *string) {
- static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4
- static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;=";
-
- NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy];
- [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]];
-
- // FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028
- // return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
-
- static NSUInteger const batchSize = 50;
-
- NSUInteger index = 0;
- NSMutableString *escaped = @"".mutableCopy;
-
- while (index < string.length) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wgnu"
- NSUInteger length = MIN(string.length - index, batchSize);
-#pragma GCC diagnostic pop
- NSRange range = NSMakeRange(index, length);
-
- // To avoid breaking up character sequences such as 👴🏻👮🏽
- range = [string rangeOfComposedCharacterSequencesForRange:range];
-
- NSString *substring = [string substringWithRange:range];
- NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
- [escaped appendString:encoded];
-
- index += range.length;
- }
-
- return escaped;
-}
-
-#pragma mark -
-
-@interface AFQueryStringPair : NSObject
-@property (readwrite, nonatomic, strong) id field;
-@property (readwrite, nonatomic, strong) id value;
-
-- (instancetype)initWithField:(id)field value:(id)value;
-
-- (NSString *)URLEncodedStringValue;
-@end
-
-@implementation AFQueryStringPair
-
-- (instancetype)initWithField:(id)field value:(id)value {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.field = field;
- self.value = value;
-
- return self;
-}
-
-- (NSString *)URLEncodedStringValue {
- if (!self.value || [self.value isEqual:[NSNull null]]) {
- return AFPercentEscapedStringFromString([self.field description]);
- } else {
- return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedStringFromString([self.field description]), AFPercentEscapedStringFromString([self.value description])];
- }
-}
-
-@end
-
-#pragma mark -
-
-FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary);
-FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value);
-
-NSString * AFQueryStringFromParameters(NSDictionary *parameters) {
- NSMutableArray *mutablePairs = [NSMutableArray array];
- for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {
- [mutablePairs addObject:[pair URLEncodedStringValue]];
- }
-
- return [mutablePairs componentsJoinedByString:@"&"];
-}
-
-NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) {
- return AFQueryStringPairsFromKeyAndValue(nil, dictionary);
-}
-
-NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
- NSMutableArray *mutableQueryStringComponents = [NSMutableArray array];
-
- NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(compare:)];
-
- if ([value isKindOfClass:[NSDictionary class]]) {
- NSDictionary *dictionary = value;
- // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
- for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
- id nestedValue = dictionary[nestedKey];
- if (nestedValue) {
- [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
- }
- }
- } else if ([value isKindOfClass:[NSArray class]]) {
- NSArray *array = value;
- for (id nestedValue in array) {
- [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
- }
- } else if ([value isKindOfClass:[NSSet class]]) {
- NSSet *set = value;
- for (id obj in [set sortedArrayUsingDescriptors:@[ sortDescriptor ]]) {
- [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)];
- }
- } else {
- [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]];
- }
-
- return mutableQueryStringComponents;
-}
-
-#pragma mark -
-
-@interface AFStreamingMultipartFormData : NSObject
-- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest
- stringEncoding:(NSStringEncoding)encoding;
-
-- (NSMutableURLRequest *)requestByFinalizingMultipartFormData;
-@end
-
-#pragma mark -
-
-static NSArray * AFHTTPRequestSerializerObservedKeyPaths() {
- static NSArray *_AFHTTPRequestSerializerObservedKeyPaths = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- _AFHTTPRequestSerializerObservedKeyPaths = @[NSStringFromSelector(@selector(allowsCellularAccess)), NSStringFromSelector(@selector(cachePolicy)), NSStringFromSelector(@selector(HTTPShouldHandleCookies)), NSStringFromSelector(@selector(HTTPShouldUsePipelining)), NSStringFromSelector(@selector(networkServiceType)), NSStringFromSelector(@selector(timeoutInterval))];
- });
-
- return _AFHTTPRequestSerializerObservedKeyPaths;
-}
-
-static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext;
-
-@interface AFHTTPRequestSerializer ()
-@property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths;
-@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders;
-@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle;
-@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization;
-@end
-
-@implementation AFHTTPRequestSerializer
-
-+ (instancetype)serializer {
- return [[self alloc] init];
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.stringEncoding = NSUTF8StringEncoding;
-
- self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary];
-
- // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
- NSMutableArray *acceptLanguagesComponents = [NSMutableArray array];
- [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- float q = 1.0f - (idx * 0.1f);
- [acceptLanguagesComponents addObject:[NSString stringWithFormat:@"%@;q=%0.1g", obj, q]];
- *stop = q <= 0.5f;
- }];
- [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"];
-
- NSString *userAgent = nil;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
-#if TARGET_OS_IOS
- // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
- userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];
-#elif TARGET_OS_WATCH
- // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
- userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]];
-#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
- userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];
-#endif
-#pragma clang diagnostic pop
- if (userAgent) {
- if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {
- NSMutableString *mutableUserAgent = [userAgent mutableCopy];
- if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) {
- userAgent = mutableUserAgent;
- }
- }
- [self setValue:userAgent forHTTPHeaderField:@"User-Agent"];
- }
-
- // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
- self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@"GET", @"HEAD", @"DELETE", nil];
-
- self.mutableObservedChangedKeyPaths = [NSMutableSet set];
- for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
- if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {
- [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:AFHTTPRequestSerializerObserverContext];
- }
- }
-
- return self;
-}
-
-- (void)dealloc {
- for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
- if ([self respondsToSelector:NSSelectorFromString(keyPath)]) {
- [self removeObserver:self forKeyPath:keyPath context:AFHTTPRequestSerializerObserverContext];
- }
- }
-}
-
-#pragma mark -
-
-// Workarounds for crashing behavior using Key-Value Observing with XCTest
-// See https://github.com/AFNetworking/AFNetworking/issues/2523
-
-- (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess {
- [self willChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];
- _allowsCellularAccess = allowsCellularAccess;
- [self didChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))];
-}
-
-- (void)setCachePolicy:(NSURLRequestCachePolicy)cachePolicy {
- [self willChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];
- _cachePolicy = cachePolicy;
- [self didChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))];
-}
-
-- (void)setHTTPShouldHandleCookies:(BOOL)HTTPShouldHandleCookies {
- [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];
- _HTTPShouldHandleCookies = HTTPShouldHandleCookies;
- [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))];
-}
-
-- (void)setHTTPShouldUsePipelining:(BOOL)HTTPShouldUsePipelining {
- [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];
- _HTTPShouldUsePipelining = HTTPShouldUsePipelining;
- [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))];
-}
-
-- (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType {
- [self willChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];
- _networkServiceType = networkServiceType;
- [self didChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))];
-}
-
-- (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval {
- [self willChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];
- _timeoutInterval = timeoutInterval;
- [self didChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))];
-}
-
-#pragma mark -
-
-- (NSDictionary *)HTTPRequestHeaders {
- return [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];
-}
-
-- (void)setValue:(NSString *)value
-forHTTPHeaderField:(NSString *)field
-{
- [self.mutableHTTPRequestHeaders setValue:value forKey:field];
-}
-
-- (NSString *)valueForHTTPHeaderField:(NSString *)field {
- return [self.mutableHTTPRequestHeaders valueForKey:field];
-}
-
-- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
- password:(NSString *)password
-{
- NSData *basicAuthCredentials = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding];
- NSString *base64AuthCredentials = [basicAuthCredentials base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
- [self setValue:[NSString stringWithFormat:@"Basic %@", base64AuthCredentials] forHTTPHeaderField:@"Authorization"];
-}
-
-- (void)clearAuthorizationHeader {
- [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"];
-}
-
-#pragma mark -
-
-- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style {
- self.queryStringSerializationStyle = style;
- self.queryStringSerialization = nil;
-}
-
-- (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, id, NSError *__autoreleasing *))block {
- self.queryStringSerialization = block;
-}
-
-#pragma mark -
-
-- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
- URLString:(NSString *)URLString
- parameters:(id)parameters
- error:(NSError *__autoreleasing *)error
-{
- NSParameterAssert(method);
- NSParameterAssert(URLString);
-
- NSURL *url = [NSURL URLWithString:URLString];
-
- NSParameterAssert(url);
-
- NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];
- mutableRequest.HTTPMethod = method;
-
- for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) {
- if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) {
- [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath];
- }
- }
-
- mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy];
-
- return mutableRequest;
-}
-
-- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
- URLString:(NSString *)URLString
- parameters:(NSDictionary *)parameters
- constructingBodyWithBlock:(void (^)(id formData))block
- error:(NSError *__autoreleasing *)error
-{
- NSParameterAssert(method);
- NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]);
-
- NSMutableURLRequest *mutableRequest = [self requestWithMethod:method URLString:URLString parameters:nil error:error];
-
- __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:mutableRequest stringEncoding:NSUTF8StringEncoding];
-
- if (parameters) {
- for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) {
- NSData *data = nil;
- if ([pair.value isKindOfClass:[NSData class]]) {
- data = pair.value;
- } else if ([pair.value isEqual:[NSNull null]]) {
- data = [NSData data];
- } else {
- data = [[pair.value description] dataUsingEncoding:self.stringEncoding];
- }
-
- if (data) {
- [formData appendPartWithFormData:data name:[pair.field description]];
- }
- }
- }
-
- if (block) {
- block(formData);
- }
-
- return [formData requestByFinalizingMultipartFormData];
-}
-
-- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request
- writingStreamContentsToFile:(NSURL *)fileURL
- completionHandler:(void (^)(NSError *error))handler
-{
- NSParameterAssert(request.HTTPBodyStream);
- NSParameterAssert([fileURL isFileURL]);
-
- NSInputStream *inputStream = request.HTTPBodyStream;
- NSOutputStream *outputStream = [[NSOutputStream alloc] initWithURL:fileURL append:NO];
- __block NSError *error = nil;
-
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
- [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
-
- [inputStream open];
- [outputStream open];
-
- while ([inputStream hasBytesAvailable] && [outputStream hasSpaceAvailable]) {
- uint8_t buffer[1024];
-
- NSInteger bytesRead = [inputStream read:buffer maxLength:1024];
- if (inputStream.streamError || bytesRead < 0) {
- error = inputStream.streamError;
- break;
- }
-
- NSInteger bytesWritten = [outputStream write:buffer maxLength:(NSUInteger)bytesRead];
- if (outputStream.streamError || bytesWritten < 0) {
- error = outputStream.streamError;
- break;
- }
-
- if (bytesRead == 0 && bytesWritten == 0) {
- break;
- }
- }
-
- [outputStream close];
- [inputStream close];
-
- if (handler) {
- dispatch_async(dispatch_get_main_queue(), ^{
- handler(error);
- });
- }
- });
-
- NSMutableURLRequest *mutableRequest = [request mutableCopy];
- mutableRequest.HTTPBodyStream = nil;
-
- return mutableRequest;
-}
-
-#pragma mark - AFURLRequestSerialization
-
-- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
- withParameters:(id)parameters
- error:(NSError *__autoreleasing *)error
-{
- NSParameterAssert(request);
-
- NSMutableURLRequest *mutableRequest = [request mutableCopy];
-
- [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
- if (![request valueForHTTPHeaderField:field]) {
- [mutableRequest setValue:value forHTTPHeaderField:field];
- }
- }];
-
- NSString *query = nil;
- if (parameters) {
- if (self.queryStringSerialization) {
- NSError *serializationError;
- query = self.queryStringSerialization(request, parameters, &serializationError);
-
- if (serializationError) {
- if (error) {
- *error = serializationError;
- }
-
- return nil;
- }
- } else {
- switch (self.queryStringSerializationStyle) {
- case AFHTTPRequestQueryStringDefaultStyle:
- query = AFQueryStringFromParameters(parameters);
- break;
- }
- }
- }
-
- if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
- if (query && query.length > 0) {
- mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]];
- }
- } else {
- // #2864: an empty string is a valid x-www-form-urlencoded payload
- if (!query) {
- query = @"";
- }
- if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
- [mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
- }
- [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]];
- }
-
- return mutableRequest;
-}
-
-#pragma mark - NSKeyValueObserving
-
-+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {
- if ([AFHTTPRequestSerializerObservedKeyPaths() containsObject:key]) {
- return NO;
- }
-
- return [super automaticallyNotifiesObserversForKey:key];
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath
- ofObject:(__unused id)object
- change:(NSDictionary *)change
- context:(void *)context
-{
- if (context == AFHTTPRequestSerializerObserverContext) {
- if ([change[NSKeyValueChangeNewKey] isEqual:[NSNull null]]) {
- [self.mutableObservedChangedKeyPaths removeObject:keyPath];
- } else {
- [self.mutableObservedChangedKeyPaths addObject:keyPath];
- }
- }
-}
-
-#pragma mark - NSSecureCoding
-
-+ (BOOL)supportsSecureCoding {
- return YES;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [self init];
- if (!self) {
- return nil;
- }
-
- self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy];
- self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];
- [coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init];
- serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone];
- serializer.queryStringSerializationStyle = self.queryStringSerializationStyle;
- serializer.queryStringSerialization = self.queryStringSerialization;
-
- return serializer;
-}
-
-@end
-
-#pragma mark -
-
-static NSString * AFCreateMultipartFormBoundary() {
- return [NSString stringWithFormat:@"Boundary+%08X%08X", arc4random(), arc4random()];
-}
-
-static NSString * const kAFMultipartFormCRLF = @"\r\n";
-
-static inline NSString * AFMultipartFormInitialBoundary(NSString *boundary) {
- return [NSString stringWithFormat:@"--%@%@", boundary, kAFMultipartFormCRLF];
-}
-
-static inline NSString * AFMultipartFormEncapsulationBoundary(NSString *boundary) {
- return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];
-}
-
-static inline NSString * AFMultipartFormFinalBoundary(NSString *boundary) {
- return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF];
-}
-
-static inline NSString * AFContentTypeForPathExtension(NSString *extension) {
- NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL);
- NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType);
- if (!contentType) {
- return @"application/octet-stream";
- } else {
- return contentType;
- }
-}
-
-NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16;
-NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
-
-@interface AFHTTPBodyPart : NSObject
-@property (nonatomic, assign) NSStringEncoding stringEncoding;
-@property (nonatomic, strong) NSDictionary *headers;
-@property (nonatomic, copy) NSString *boundary;
-@property (nonatomic, strong) id body;
-@property (nonatomic, assign) unsigned long long bodyContentLength;
-@property (nonatomic, strong) NSInputStream *inputStream;
-
-@property (nonatomic, assign) BOOL hasInitialBoundary;
-@property (nonatomic, assign) BOOL hasFinalBoundary;
-
-@property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable;
-@property (readonly, nonatomic, assign) unsigned long long contentLength;
-
-- (NSInteger)read:(uint8_t *)buffer
- maxLength:(NSUInteger)length;
-@end
-
-@interface AFMultipartBodyStream : NSInputStream
-@property (nonatomic, assign) NSUInteger numberOfBytesInPacket;
-@property (nonatomic, assign) NSTimeInterval delay;
-@property (nonatomic, strong) NSInputStream *inputStream;
-@property (readonly, nonatomic, assign) unsigned long long contentLength;
-@property (readonly, nonatomic, assign, getter = isEmpty) BOOL empty;
-
-- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding;
-- (void)setInitialAndFinalBoundaries;
-- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart;
-@end
-
-#pragma mark -
-
-@interface AFStreamingMultipartFormData ()
-@property (readwrite, nonatomic, copy) NSMutableURLRequest *request;
-@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;
-@property (readwrite, nonatomic, copy) NSString *boundary;
-@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream;
-@end
-
-@implementation AFStreamingMultipartFormData
-
-- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest
- stringEncoding:(NSStringEncoding)encoding
-{
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.request = urlRequest;
- self.stringEncoding = encoding;
- self.boundary = AFCreateMultipartFormBoundary();
- self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding];
-
- return self;
-}
-
-- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
- name:(NSString *)name
- error:(NSError * __autoreleasing *)error
-{
- NSParameterAssert(fileURL);
- NSParameterAssert(name);
-
- NSString *fileName = [fileURL lastPathComponent];
- NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]);
-
- return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error];
-}
-
-- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
- name:(NSString *)name
- fileName:(NSString *)fileName
- mimeType:(NSString *)mimeType
- error:(NSError * __autoreleasing *)error
-{
- NSParameterAssert(fileURL);
- NSParameterAssert(name);
- NSParameterAssert(fileName);
- NSParameterAssert(mimeType);
-
- if (![fileURL isFileURL]) {
- NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil)};
- if (error) {
- *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
- }
-
- return NO;
- } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) {
- NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil)};
- if (error) {
- *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo];
- }
-
- return NO;
- }
-
- NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:error];
- if (!fileAttributes) {
- return NO;
- }
-
- NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
- [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
- [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
-
- AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
- bodyPart.stringEncoding = self.stringEncoding;
- bodyPart.headers = mutableHeaders;
- bodyPart.boundary = self.boundary;
- bodyPart.body = fileURL;
- bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue];
- [self.bodyStream appendHTTPBodyPart:bodyPart];
-
- return YES;
-}
-
-- (void)appendPartWithInputStream:(NSInputStream *)inputStream
- name:(NSString *)name
- fileName:(NSString *)fileName
- length:(int64_t)length
- mimeType:(NSString *)mimeType
-{
- NSParameterAssert(name);
- NSParameterAssert(fileName);
- NSParameterAssert(mimeType);
-
- NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
- [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
- [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
-
- AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
- bodyPart.stringEncoding = self.stringEncoding;
- bodyPart.headers = mutableHeaders;
- bodyPart.boundary = self.boundary;
- bodyPart.body = inputStream;
-
- bodyPart.bodyContentLength = (unsigned long long)length;
-
- [self.bodyStream appendHTTPBodyPart:bodyPart];
-}
-
-- (void)appendPartWithFileData:(NSData *)data
- name:(NSString *)name
- fileName:(NSString *)fileName
- mimeType:(NSString *)mimeType
-{
- NSParameterAssert(name);
- NSParameterAssert(fileName);
- NSParameterAssert(mimeType);
-
- NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
- [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"];
- [mutableHeaders setValue:mimeType forKey:@"Content-Type"];
-
- [self appendPartWithHeaders:mutableHeaders body:data];
-}
-
-- (void)appendPartWithFormData:(NSData *)data
- name:(NSString *)name
-{
- NSParameterAssert(name);
-
- NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
- [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"];
-
- [self appendPartWithHeaders:mutableHeaders body:data];
-}
-
-- (void)appendPartWithHeaders:(NSDictionary *)headers
- body:(NSData *)body
-{
- NSParameterAssert(body);
-
- AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init];
- bodyPart.stringEncoding = self.stringEncoding;
- bodyPart.headers = headers;
- bodyPart.boundary = self.boundary;
- bodyPart.bodyContentLength = [body length];
- bodyPart.body = body;
-
- [self.bodyStream appendHTTPBodyPart:bodyPart];
-}
-
-- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
- delay:(NSTimeInterval)delay
-{
- self.bodyStream.numberOfBytesInPacket = numberOfBytes;
- self.bodyStream.delay = delay;
-}
-
-- (NSMutableURLRequest *)requestByFinalizingMultipartFormData {
- if ([self.bodyStream isEmpty]) {
- return self.request;
- }
-
- // Reset the initial and final boundaries to ensure correct Content-Length
- [self.bodyStream setInitialAndFinalBoundaries];
- [self.request setHTTPBodyStream:self.bodyStream];
-
- [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", self.boundary] forHTTPHeaderField:@"Content-Type"];
- [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"];
-
- return self.request;
-}
-
-@end
-
-#pragma mark -
-
-@interface NSStream ()
-@property (readwrite) NSStreamStatus streamStatus;
-@property (readwrite, copy) NSError *streamError;
-@end
-
-@interface AFMultipartBodyStream ()
-@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding;
-@property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts;
-@property (readwrite, nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator;
-@property (readwrite, nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart;
-@property (readwrite, nonatomic, strong) NSOutputStream *outputStream;
-@property (readwrite, nonatomic, strong) NSMutableData *buffer;
-@end
-
-@implementation AFMultipartBodyStream
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wimplicit-atomic-properties"
-#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100)
-@synthesize delegate;
-#endif
-@synthesize streamStatus;
-@synthesize streamError;
-#pragma clang diagnostic pop
-
-- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.stringEncoding = encoding;
- self.HTTPBodyParts = [NSMutableArray array];
- self.numberOfBytesInPacket = NSIntegerMax;
-
- return self;
-}
-
-- (void)setInitialAndFinalBoundaries {
- if ([self.HTTPBodyParts count] > 0) {
- for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
- bodyPart.hasInitialBoundary = NO;
- bodyPart.hasFinalBoundary = NO;
- }
-
- [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES];
- [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES];
- }
-}
-
-- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart {
- [self.HTTPBodyParts addObject:bodyPart];
-}
-
-- (BOOL)isEmpty {
- return [self.HTTPBodyParts count] == 0;
-}
-
-#pragma mark - NSInputStream
-
-- (NSInteger)read:(uint8_t *)buffer
- maxLength:(NSUInteger)length
-{
- if ([self streamStatus] == NSStreamStatusClosed) {
- return 0;
- }
-
- NSInteger totalNumberOfBytesRead = 0;
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) {
- if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) {
- if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) {
- break;
- }
- } else {
- NSUInteger maxLength = MIN(length, self.numberOfBytesInPacket) - (NSUInteger)totalNumberOfBytesRead;
- NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength];
- if (numberOfBytesRead == -1) {
- self.streamError = self.currentHTTPBodyPart.inputStream.streamError;
- break;
- } else {
- totalNumberOfBytesRead += numberOfBytesRead;
-
- if (self.delay > 0.0f) {
- [NSThread sleepForTimeInterval:self.delay];
- }
- }
- }
- }
-#pragma clang diagnostic pop
-
- return totalNumberOfBytesRead;
-}
-
-- (BOOL)getBuffer:(__unused uint8_t **)buffer
- length:(__unused NSUInteger *)len
-{
- return NO;
-}
-
-- (BOOL)hasBytesAvailable {
- return [self streamStatus] == NSStreamStatusOpen;
-}
-
-#pragma mark - NSStream
-
-- (void)open {
- if (self.streamStatus == NSStreamStatusOpen) {
- return;
- }
-
- self.streamStatus = NSStreamStatusOpen;
-
- [self setInitialAndFinalBoundaries];
- self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator];
-}
-
-- (void)close {
- self.streamStatus = NSStreamStatusClosed;
-}
-
-- (id)propertyForKey:(__unused NSString *)key {
- return nil;
-}
-
-- (BOOL)setProperty:(__unused id)property
- forKey:(__unused NSString *)key
-{
- return NO;
-}
-
-- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop
- forMode:(__unused NSString *)mode
-{}
-
-- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop
- forMode:(__unused NSString *)mode
-{}
-
-- (unsigned long long)contentLength {
- unsigned long long length = 0;
- for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
- length += [bodyPart contentLength];
- }
-
- return length;
-}
-
-#pragma mark - Undocumented CFReadStream Bridged Methods
-
-- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop
- forMode:(__unused CFStringRef)aMode
-{}
-
-- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop
- forMode:(__unused CFStringRef)aMode
-{}
-
-- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags
- callback:(__unused CFReadStreamClientCallBack)inCallback
- context:(__unused CFStreamClientContext *)inContext {
- return NO;
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding];
-
- for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) {
- [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]];
- }
-
- [bodyStreamCopy setInitialAndFinalBoundaries];
-
- return bodyStreamCopy;
-}
-
-@end
-
-#pragma mark -
-
-typedef enum {
- AFEncapsulationBoundaryPhase = 1,
- AFHeaderPhase = 2,
- AFBodyPhase = 3,
- AFFinalBoundaryPhase = 4,
-} AFHTTPBodyPartReadPhase;
-
-@interface AFHTTPBodyPart () {
- AFHTTPBodyPartReadPhase _phase;
- NSInputStream *_inputStream;
- unsigned long long _phaseReadOffset;
-}
-
-- (BOOL)transitionToNextPhase;
-- (NSInteger)readData:(NSData *)data
- intoBuffer:(uint8_t *)buffer
- maxLength:(NSUInteger)length;
-@end
-
-@implementation AFHTTPBodyPart
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- [self transitionToNextPhase];
-
- return self;
-}
-
-- (void)dealloc {
- if (_inputStream) {
- [_inputStream close];
- _inputStream = nil;
- }
-}
-
-- (NSInputStream *)inputStream {
- if (!_inputStream) {
- if ([self.body isKindOfClass:[NSData class]]) {
- _inputStream = [NSInputStream inputStreamWithData:self.body];
- } else if ([self.body isKindOfClass:[NSURL class]]) {
- _inputStream = [NSInputStream inputStreamWithURL:self.body];
- } else if ([self.body isKindOfClass:[NSInputStream class]]) {
- _inputStream = self.body;
- } else {
- _inputStream = [NSInputStream inputStreamWithData:[NSData data]];
- }
- }
-
- return _inputStream;
-}
-
-- (NSString *)stringForHeaders {
- NSMutableString *headerString = [NSMutableString string];
- for (NSString *field in [self.headers allKeys]) {
- [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]];
- }
- [headerString appendString:kAFMultipartFormCRLF];
-
- return [NSString stringWithString:headerString];
-}
-
-- (unsigned long long)contentLength {
- unsigned long long length = 0;
-
- NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];
- length += [encapsulationBoundaryData length];
-
- NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
- length += [headersData length];
-
- length += _bodyContentLength;
-
- NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);
- length += [closingBoundaryData length];
-
- return length;
-}
-
-- (BOOL)hasBytesAvailable {
- // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer
- if (_phase == AFFinalBoundaryPhase) {
- return YES;
- }
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wcovered-switch-default"
- switch (self.inputStream.streamStatus) {
- case NSStreamStatusNotOpen:
- case NSStreamStatusOpening:
- case NSStreamStatusOpen:
- case NSStreamStatusReading:
- case NSStreamStatusWriting:
- return YES;
- case NSStreamStatusAtEnd:
- case NSStreamStatusClosed:
- case NSStreamStatusError:
- default:
- return NO;
- }
-#pragma clang diagnostic pop
-}
-
-- (NSInteger)read:(uint8_t *)buffer
- maxLength:(NSUInteger)length
-{
- NSInteger totalNumberOfBytesRead = 0;
-
- if (_phase == AFEncapsulationBoundaryPhase) {
- NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding];
- totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
- }
-
- if (_phase == AFHeaderPhase) {
- NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding];
- totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
- }
-
- if (_phase == AFBodyPhase) {
- NSInteger numberOfBytesRead = 0;
-
- numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
- if (numberOfBytesRead == -1) {
- return -1;
- } else {
- totalNumberOfBytesRead += numberOfBytesRead;
-
- if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) {
- [self transitionToNextPhase];
- }
- }
- }
-
- if (_phase == AFFinalBoundaryPhase) {
- NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]);
- totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)];
- }
-
- return totalNumberOfBytesRead;
-}
-
-- (NSInteger)readData:(NSData *)data
- intoBuffer:(uint8_t *)buffer
- maxLength:(NSUInteger)length
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length));
- [data getBytes:buffer range:range];
-#pragma clang diagnostic pop
-
- _phaseReadOffset += range.length;
-
- if (((NSUInteger)_phaseReadOffset) >= [data length]) {
- [self transitionToNextPhase];
- }
-
- return (NSInteger)range.length;
-}
-
-- (BOOL)transitionToNextPhase {
- if (![[NSThread currentThread] isMainThread]) {
- dispatch_sync(dispatch_get_main_queue(), ^{
- [self transitionToNextPhase];
- });
- return YES;
- }
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wcovered-switch-default"
- switch (_phase) {
- case AFEncapsulationBoundaryPhase:
- _phase = AFHeaderPhase;
- break;
- case AFHeaderPhase:
- [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
- [self.inputStream open];
- _phase = AFBodyPhase;
- break;
- case AFBodyPhase:
- [self.inputStream close];
- _phase = AFFinalBoundaryPhase;
- break;
- case AFFinalBoundaryPhase:
- default:
- _phase = AFEncapsulationBoundaryPhase;
- break;
- }
- _phaseReadOffset = 0;
-#pragma clang diagnostic pop
-
- return YES;
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init];
-
- bodyPart.stringEncoding = self.stringEncoding;
- bodyPart.headers = self.headers;
- bodyPart.bodyContentLength = self.bodyContentLength;
- bodyPart.body = self.body;
- bodyPart.boundary = self.boundary;
-
- return bodyPart;
-}
-
-@end
-
-#pragma mark -
-
-@implementation AFJSONRequestSerializer
-
-+ (instancetype)serializer {
- return [self serializerWithWritingOptions:(NSJSONWritingOptions)0];
-}
-
-+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions
-{
- AFJSONRequestSerializer *serializer = [[self alloc] init];
- serializer.writingOptions = writingOptions;
-
- return serializer;
-}
-
-#pragma mark - AFURLRequestSerialization
-
-- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
- withParameters:(id)parameters
- error:(NSError *__autoreleasing *)error
-{
- NSParameterAssert(request);
-
- if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
- return [super requestBySerializingRequest:request withParameters:parameters error:error];
- }
-
- NSMutableURLRequest *mutableRequest = [request mutableCopy];
-
- [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
- if (![request valueForHTTPHeaderField:field]) {
- [mutableRequest setValue:value forHTTPHeaderField:field];
- }
- }];
-
- if (parameters) {
- if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
- [mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
- }
-
- [mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]];
- }
-
- return mutableRequest;
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
- self.writingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writingOptions))] unsignedIntegerValue];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeInteger:self.writingOptions forKey:NSStringFromSelector(@selector(writingOptions))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFJSONRequestSerializer *serializer = [super copyWithZone:zone];
- serializer.writingOptions = self.writingOptions;
-
- return serializer;
-}
-
-@end
-
-#pragma mark -
-
-@implementation AFPropertyListRequestSerializer
-
-+ (instancetype)serializer {
- return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0];
-}
-
-+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
- writeOptions:(NSPropertyListWriteOptions)writeOptions
-{
- AFPropertyListRequestSerializer *serializer = [[self alloc] init];
- serializer.format = format;
- serializer.writeOptions = writeOptions;
-
- return serializer;
-}
-
-#pragma mark - AFURLRequestSerializer
-
-- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
- withParameters:(id)parameters
- error:(NSError *__autoreleasing *)error
-{
- NSParameterAssert(request);
-
- if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
- return [super requestBySerializingRequest:request withParameters:parameters error:error];
- }
-
- NSMutableURLRequest *mutableRequest = [request mutableCopy];
-
- [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
- if (![request valueForHTTPHeaderField:field]) {
- [mutableRequest setValue:value forHTTPHeaderField:field];
- }
- }];
-
- if (parameters) {
- if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
- [mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"];
- }
-
- [mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]];
- }
-
- return mutableRequest;
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
- self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
- self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeInteger:self.format forKey:NSStringFromSelector(@selector(format))];
- [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFPropertyListRequestSerializer *serializer = [super copyWithZone:zone];
- serializer.format = self.format;
- serializer.writeOptions = self.writeOptions;
-
- return serializer;
-}
-
-@end
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h
deleted file mode 100644
index a9430add..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h
+++ /dev/null
@@ -1,311 +0,0 @@
-// AFURLResponseSerialization.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data.
-
- For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object.
- */
-@protocol AFURLResponseSerialization
-
-/**
- The response object decoded from the data associated with a specified response.
-
- @param response The response to be processed.
- @param data The response data to be decoded.
- @param error The error that occurred while attempting to decode the response data.
-
- @return The object decoded from the specified response data.
- */
-- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response
- data:(nullable NSData *)data
- error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;
-
-@end
-
-#pragma mark -
-
-/**
- `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.
-
- Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior.
- */
-@interface AFHTTPResponseSerializer : NSObject
-
-- (instancetype)init;
-
-/**
- The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default.
- */
-@property (nonatomic, assign) NSStringEncoding stringEncoding;
-
-/**
- Creates and returns a serializer with default configuration.
- */
-+ (instancetype)serializer;
-
-///-----------------------------------------
-/// @name Configuring Response Serialization
-///-----------------------------------------
-
-/**
- The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation.
-
- See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
- */
-@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;
-
-/**
- The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation.
- */
-@property (nonatomic, copy, nullable) NSSet *acceptableContentTypes;
-
-/**
- Validates the specified response and data.
-
- In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks.
-
- @param response The response to be validated.
- @param data The data associated with the response.
- @param error The error that occurred while attempting to validate the response.
-
- @return `YES` if the response is valid, otherwise `NO`.
- */
-- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response
- data:(nullable NSData *)data
- error:(NSError * _Nullable __autoreleasing *)error;
-
-@end
-
-#pragma mark -
-
-
-/**
- `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses.
-
- By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types:
-
- - `application/json`
- - `text/json`
- - `text/javascript`
- */
-@interface AFJSONResponseSerializer : AFHTTPResponseSerializer
-
-- (instancetype)init;
-
-/**
- Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default.
- */
-@property (nonatomic, assign) NSJSONReadingOptions readingOptions;
-
-/**
- Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`.
- */
-@property (nonatomic, assign) BOOL removesKeysWithNullValues;
-
-/**
- Creates and returns a JSON serializer with specified reading and writing options.
-
- @param readingOptions The specified JSON reading options.
- */
-+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions;
-
-@end
-
-#pragma mark -
-
-/**
- `AFXMLParserResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects.
-
- By default, `AFXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:
-
- - `application/xml`
- - `text/xml`
- */
-@interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer
-
-@end
-
-#pragma mark -
-
-#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
-
-/**
- `AFXMLDocumentResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.
-
- By default, `AFXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:
-
- - `application/xml`
- - `text/xml`
- */
-@interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer
-
-- (instancetype)init;
-
-/**
- Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default.
- */
-@property (nonatomic, assign) NSUInteger options;
-
-/**
- Creates and returns an XML document serializer with the specified options.
-
- @param mask The XML document options.
- */
-+ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask;
-
-@end
-
-#endif
-
-#pragma mark -
-
-/**
- `AFPropertyListResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.
-
- By default, `AFPropertyListResponseSerializer` accepts the following MIME types:
-
- - `application/x-plist`
- */
-@interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer
-
-- (instancetype)init;
-
-/**
- The property list format. Possible values are described in "NSPropertyListFormat".
- */
-@property (nonatomic, assign) NSPropertyListFormat format;
-
-/**
- The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions."
- */
-@property (nonatomic, assign) NSPropertyListReadOptions readOptions;
-
-/**
- Creates and returns a property list serializer with a specified format, read options, and write options.
-
- @param format The property list format.
- @param readOptions The property list reading options.
- */
-+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
- readOptions:(NSPropertyListReadOptions)readOptions;
-
-@end
-
-#pragma mark -
-
-/**
- `AFImageResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses.
-
- By default, `AFImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:
-
- - `image/tiff`
- - `image/jpeg`
- - `image/gif`
- - `image/png`
- - `image/ico`
- - `image/x-icon`
- - `image/bmp`
- - `image/x-bmp`
- - `image/x-xbitmap`
- - `image/x-win-bitmap`
- */
-@interface AFImageResponseSerializer : AFHTTPResponseSerializer
-
-#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
-/**
- The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.
- */
-@property (nonatomic, assign) CGFloat imageScale;
-
-/**
- Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default.
- */
-@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage;
-#endif
-
-@end
-
-#pragma mark -
-
-/**
- `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer.
- */
-@interface AFCompoundResponseSerializer : AFHTTPResponseSerializer
-
-/**
- The component response serializers.
- */
-@property (readonly, nonatomic, copy) NSArray > *responseSerializers;
-
-/**
- Creates and returns a compound serializer comprised of the specified response serializers.
-
- @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`.
- */
-+ (instancetype)compoundSerializerWithResponseSerializers:(NSArray > *)responseSerializers;
-
-@end
-
-///----------------
-/// @name Constants
-///----------------
-
-/**
- ## Error Domains
-
- The following error domain is predefined.
-
- - `NSString * const AFURLResponseSerializationErrorDomain`
-
- ### Constants
-
- `AFURLResponseSerializationErrorDomain`
- AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
- */
-FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain;
-
-/**
- ## User info dictionary keys
-
- These keys may exist in the user info dictionary, in addition to those defined for NSError.
-
- - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey`
- - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey`
-
- ### Constants
-
- `AFNetworkingOperationFailingURLResponseErrorKey`
- The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
-
- `AFNetworkingOperationFailingURLResponseDataErrorKey`
- The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey;
-
-FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey;
-
-NS_ASSUME_NONNULL_END
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m b/iOSProject/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m
deleted file mode 100755
index 5e467992..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m
+++ /dev/null
@@ -1,805 +0,0 @@
-// AFURLResponseSerialization.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFURLResponseSerialization.h"
-
-#import
-
-#if TARGET_OS_IOS
-#import
-#elif TARGET_OS_WATCH
-#import
-#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-#import
-#endif
-
-NSString * const AFURLResponseSerializationErrorDomain = @"com.alamofire.error.serialization.response";
-NSString * const AFNetworkingOperationFailingURLResponseErrorKey = @"com.alamofire.serialization.response.error.response";
-NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey = @"com.alamofire.serialization.response.error.data";
-
-static NSError * AFErrorWithUnderlyingError(NSError *error, NSError *underlyingError) {
- if (!error) {
- return underlyingError;
- }
-
- if (!underlyingError || error.userInfo[NSUnderlyingErrorKey]) {
- return error;
- }
-
- NSMutableDictionary *mutableUserInfo = [error.userInfo mutableCopy];
- mutableUserInfo[NSUnderlyingErrorKey] = underlyingError;
-
- return [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:mutableUserInfo];
-}
-
-static BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger code, NSString *domain) {
- if ([error.domain isEqualToString:domain] && error.code == code) {
- return YES;
- } else if (error.userInfo[NSUnderlyingErrorKey]) {
- return AFErrorOrUnderlyingErrorHasCodeInDomain(error.userInfo[NSUnderlyingErrorKey], code, domain);
- }
-
- return NO;
-}
-
-static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) {
- if ([JSONObject isKindOfClass:[NSArray class]]) {
- NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[(NSArray *)JSONObject count]];
- for (id value in (NSArray *)JSONObject) {
- [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)];
- }
-
- return (readingOptions & NSJSONReadingMutableContainers) ? mutableArray : [NSArray arrayWithArray:mutableArray];
- } else if ([JSONObject isKindOfClass:[NSDictionary class]]) {
- NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithDictionary:JSONObject];
- for (id key in [(NSDictionary *)JSONObject allKeys]) {
- id value = (NSDictionary *)JSONObject[key];
- if (!value || [value isEqual:[NSNull null]]) {
- [mutableDictionary removeObjectForKey:key];
- } else if ([value isKindOfClass:[NSArray class]] || [value isKindOfClass:[NSDictionary class]]) {
- mutableDictionary[key] = AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions);
- }
- }
-
- return (readingOptions & NSJSONReadingMutableContainers) ? mutableDictionary : [NSDictionary dictionaryWithDictionary:mutableDictionary];
- }
-
- return JSONObject;
-}
-
-@implementation AFHTTPResponseSerializer
-
-+ (instancetype)serializer {
- return [[self alloc] init];
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.stringEncoding = NSUTF8StringEncoding;
-
- self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];
- self.acceptableContentTypes = nil;
-
- return self;
-}
-
-#pragma mark -
-
-- (BOOL)validateResponse:(NSHTTPURLResponse *)response
- data:(NSData *)data
- error:(NSError * __autoreleasing *)error
-{
- BOOL responseIsValid = YES;
- NSError *validationError = nil;
-
- if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) {
- if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]] &&
- !([response MIMEType] == nil && [data length] == 0)) {
-
- if ([data length] > 0 && [response URL]) {
- NSMutableDictionary *mutableUserInfo = [@{
- NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]],
- NSURLErrorFailingURLErrorKey:[response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
- } mutableCopy];
- if (data) {
- mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
- }
-
- validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError);
- }
-
- responseIsValid = NO;
- }
-
- if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) {
- NSMutableDictionary *mutableUserInfo = [@{
- NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
- NSURLErrorFailingURLErrorKey:[response URL],
- AFNetworkingOperationFailingURLResponseErrorKey: response,
- } mutableCopy];
-
- if (data) {
- mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data;
- }
-
- validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError);
-
- responseIsValid = NO;
- }
- }
-
- if (error && !responseIsValid) {
- *error = validationError;
- }
-
- return responseIsValid;
-}
-
-#pragma mark - AFURLResponseSerialization
-
-- (id)responseObjectForResponse:(NSURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- [self validateResponse:(NSHTTPURLResponse *)response data:data error:error];
-
- return data;
-}
-
-#pragma mark - NSSecureCoding
-
-+ (BOOL)supportsSecureCoding {
- return YES;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [self init];
- if (!self) {
- return nil;
- }
-
- self.acceptableStatusCodes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableStatusCodes))];
- self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [coder encodeObject:self.acceptableStatusCodes forKey:NSStringFromSelector(@selector(acceptableStatusCodes))];
- [coder encodeObject:self.acceptableContentTypes forKey:NSStringFromSelector(@selector(acceptableContentTypes))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFHTTPResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
- serializer.acceptableStatusCodes = [self.acceptableStatusCodes copyWithZone:zone];
- serializer.acceptableContentTypes = [self.acceptableContentTypes copyWithZone:zone];
-
- return serializer;
-}
-
-@end
-
-#pragma mark -
-
-@implementation AFJSONResponseSerializer
-
-+ (instancetype)serializer {
- return [self serializerWithReadingOptions:(NSJSONReadingOptions)0];
-}
-
-+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions {
- AFJSONResponseSerializer *serializer = [[self alloc] init];
- serializer.readingOptions = readingOptions;
-
- return serializer;
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
-
- return self;
-}
-
-#pragma mark - AFURLResponseSerialization
-
-- (id)responseObjectForResponse:(NSURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
- return nil;
- }
- }
-
- id responseObject = nil;
- NSError *serializationError = nil;
- // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization.
- // See https://github.com/rails/rails/issues/1742
- BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]];
- if (data.length > 0 && !isSpace) {
- responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];
- } else {
- return nil;
- }
-
- if (self.removesKeysWithNullValues && responseObject) {
- responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);
- }
-
- if (error) {
- *error = AFErrorWithUnderlyingError(serializationError, *error);
- }
-
- return responseObject;
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
- self.readingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readingOptions))] unsignedIntegerValue];
- self.removesKeysWithNullValues = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))] boolValue];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeObject:@(self.readingOptions) forKey:NSStringFromSelector(@selector(readingOptions))];
- [coder encodeObject:@(self.removesKeysWithNullValues) forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
- serializer.readingOptions = self.readingOptions;
- serializer.removesKeysWithNullValues = self.removesKeysWithNullValues;
-
- return serializer;
-}
-
-@end
-
-#pragma mark -
-
-@implementation AFXMLParserResponseSerializer
-
-+ (instancetype)serializer {
- AFXMLParserResponseSerializer *serializer = [[self alloc] init];
-
- return serializer;
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil];
-
- return self;
-}
-
-#pragma mark - AFURLResponseSerialization
-
-- (id)responseObjectForResponse:(NSHTTPURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
- return nil;
- }
- }
-
- return [[NSXMLParser alloc] initWithData:data];
-}
-
-@end
-
-#pragma mark -
-
-#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
-
-@implementation AFXMLDocumentResponseSerializer
-
-+ (instancetype)serializer {
- return [self serializerWithXMLDocumentOptions:0];
-}
-
-+ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask {
- AFXMLDocumentResponseSerializer *serializer = [[self alloc] init];
- serializer.options = mask;
-
- return serializer;
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil];
-
- return self;
-}
-
-#pragma mark - AFURLResponseSerialization
-
-- (id)responseObjectForResponse:(NSURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
- return nil;
- }
- }
-
- NSError *serializationError = nil;
- NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError];
-
- if (error) {
- *error = AFErrorWithUnderlyingError(serializationError, *error);
- }
-
- return document;
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
- self.options = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(options))] unsignedIntegerValue];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeObject:@(self.options) forKey:NSStringFromSelector(@selector(options))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
- serializer.options = self.options;
-
- return serializer;
-}
-
-@end
-
-#endif
-
-#pragma mark -
-
-@implementation AFPropertyListResponseSerializer
-
-+ (instancetype)serializer {
- return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 readOptions:0];
-}
-
-+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format
- readOptions:(NSPropertyListReadOptions)readOptions
-{
- AFPropertyListResponseSerializer *serializer = [[self alloc] init];
- serializer.format = format;
- serializer.readOptions = readOptions;
-
- return serializer;
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/x-plist", nil];
-
- return self;
-}
-
-#pragma mark - AFURLResponseSerialization
-
-- (id)responseObjectForResponse:(NSURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
- return nil;
- }
- }
-
- id responseObject;
- NSError *serializationError = nil;
-
- if (data) {
- responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError];
- }
-
- if (error) {
- *error = AFErrorWithUnderlyingError(serializationError, *error);
- }
-
- return responseObject;
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
- self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
- self.readOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readOptions))] unsignedIntegerValue];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))];
- [coder encodeObject:@(self.readOptions) forKey:NSStringFromSelector(@selector(readOptions))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
- serializer.format = self.format;
- serializer.readOptions = self.readOptions;
-
- return serializer;
-}
-
-@end
-
-#pragma mark -
-
-#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
-#import
-#import
-
-@interface UIImage (AFNetworkingSafeImageLoading)
-+ (UIImage *)af_safeImageWithData:(NSData *)data;
-@end
-
-static NSLock* imageLock = nil;
-
-@implementation UIImage (AFNetworkingSafeImageLoading)
-
-+ (UIImage *)af_safeImageWithData:(NSData *)data {
- UIImage* image = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- imageLock = [[NSLock alloc] init];
- });
-
- [imageLock lock];
- image = [UIImage imageWithData:data];
- [imageLock unlock];
- return image;
-}
-
-@end
-
-static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) {
- UIImage *image = [UIImage af_safeImageWithData:data];
- if (image.images) {
- return image;
- }
-
- return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation];
-}
-
-static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) {
- if (!data || [data length] == 0) {
- return nil;
- }
-
- CGImageRef imageRef = NULL;
- CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
-
- if ([response.MIMEType isEqualToString:@"image/png"]) {
- imageRef = CGImageCreateWithPNGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
- } else if ([response.MIMEType isEqualToString:@"image/jpeg"]) {
- imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
-
- if (imageRef) {
- CGColorSpaceRef imageColorSpace = CGImageGetColorSpace(imageRef);
- CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(imageColorSpace);
-
- // CGImageCreateWithJPEGDataProvider does not properly handle CMKY, so fall back to AFImageWithDataAtScale
- if (imageColorSpaceModel == kCGColorSpaceModelCMYK) {
- CGImageRelease(imageRef);
- imageRef = NULL;
- }
- }
- }
-
- CGDataProviderRelease(dataProvider);
-
- UIImage *image = AFImageWithDataAtScale(data, scale);
- if (!imageRef) {
- if (image.images || !image) {
- return image;
- }
-
- imageRef = CGImageCreateCopy([image CGImage]);
- if (!imageRef) {
- return nil;
- }
- }
-
- size_t width = CGImageGetWidth(imageRef);
- size_t height = CGImageGetHeight(imageRef);
- size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);
-
- if (width * height > 1024 * 1024 || bitsPerComponent > 8) {
- CGImageRelease(imageRef);
-
- return image;
- }
-
- // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate
- size_t bytesPerRow = 0;
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace);
- CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
-
- if (colorSpaceModel == kCGColorSpaceModelRGB) {
- uint32_t alpha = (bitmapInfo & kCGBitmapAlphaInfoMask);
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wassign-enum"
- if (alpha == kCGImageAlphaNone) {
- bitmapInfo &= ~kCGBitmapAlphaInfoMask;
- bitmapInfo |= kCGImageAlphaNoneSkipFirst;
- } else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) {
- bitmapInfo &= ~kCGBitmapAlphaInfoMask;
- bitmapInfo |= kCGImageAlphaPremultipliedFirst;
- }
-#pragma clang diagnostic pop
- }
-
- CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
-
- CGColorSpaceRelease(colorSpace);
-
- if (!context) {
- CGImageRelease(imageRef);
-
- return image;
- }
-
- CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), imageRef);
- CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context);
-
- CGContextRelease(context);
-
- UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:image.imageOrientation];
-
- CGImageRelease(inflatedImageRef);
- CGImageRelease(imageRef);
-
- return inflatedImage;
-}
-#endif
-
-
-@implementation AFImageResponseSerializer
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil];
-
-#if TARGET_OS_IOS || TARGET_OS_TV
- self.imageScale = [[UIScreen mainScreen] scale];
- self.automaticallyInflatesResponseImage = YES;
-#elif TARGET_OS_WATCH
- self.imageScale = [[WKInterfaceDevice currentDevice] screenScale];
- self.automaticallyInflatesResponseImage = YES;
-#endif
-
- return self;
-}
-
-#pragma mark - AFURLResponseSerializer
-
-- (id)responseObjectForResponse:(NSURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) {
- if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) {
- return nil;
- }
- }
-
-#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
- if (self.automaticallyInflatesResponseImage) {
- return AFInflatedImageFromResponseWithDataAtScale((NSHTTPURLResponse *)response, data, self.imageScale);
- } else {
- return AFImageWithDataAtScale(data, self.imageScale);
- }
-#else
- // Ensure that the image is set to it's correct pixel width and height
- NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:data];
- NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])];
- [image addRepresentation:bitimage];
-
- return image;
-#endif
-
- return nil;
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
-#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
- NSNumber *imageScale = [decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(imageScale))];
-#if CGFLOAT_IS_DOUBLE
- self.imageScale = [imageScale doubleValue];
-#else
- self.imageScale = [imageScale floatValue];
-#endif
-
- self.automaticallyInflatesResponseImage = [decoder decodeBoolForKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))];
-#endif
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
-#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
- [coder encodeObject:@(self.imageScale) forKey:NSStringFromSelector(@selector(imageScale))];
- [coder encodeBool:self.automaticallyInflatesResponseImage forKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))];
-#endif
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
-
-#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
- serializer.imageScale = self.imageScale;
- serializer.automaticallyInflatesResponseImage = self.automaticallyInflatesResponseImage;
-#endif
-
- return serializer;
-}
-
-@end
-
-#pragma mark -
-
-@interface AFCompoundResponseSerializer ()
-@property (readwrite, nonatomic, copy) NSArray *responseSerializers;
-@end
-
-@implementation AFCompoundResponseSerializer
-
-+ (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers {
- AFCompoundResponseSerializer *serializer = [[self alloc] init];
- serializer.responseSerializers = responseSerializers;
-
- return serializer;
-}
-
-#pragma mark - AFURLResponseSerialization
-
-- (id)responseObjectForResponse:(NSURLResponse *)response
- data:(NSData *)data
- error:(NSError *__autoreleasing *)error
-{
- for (id serializer in self.responseSerializers) {
- if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) {
- continue;
- }
-
- NSError *serializerError = nil;
- id responseObject = [serializer responseObjectForResponse:response data:data error:&serializerError];
- if (responseObject) {
- if (error) {
- *error = AFErrorWithUnderlyingError(serializerError, *error);
- }
-
- return responseObject;
- }
- }
-
- return [super responseObjectForResponse:response data:data error:error];
-}
-
-#pragma mark - NSSecureCoding
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- self = [super initWithCoder:decoder];
- if (!self) {
- return nil;
- }
-
- self.responseSerializers = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(responseSerializers))];
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [super encodeWithCoder:coder];
-
- [coder encodeObject:self.responseSerializers forKey:NSStringFromSelector(@selector(responseSerializers))];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init];
- serializer.responseSerializers = self.responseSerializers;
-
- return serializer;
-}
-
-@end
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h b/iOSProject/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h
deleted file mode 100644
index 89909fe4..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h
+++ /dev/null
@@ -1,500 +0,0 @@
-// AFURLSessionManager.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-
-#import
-
-#import "AFURLResponseSerialization.h"
-#import "AFURLRequestSerialization.h"
-#import "AFSecurityPolicy.h"
-#if !TARGET_OS_WATCH
-#import "AFNetworkReachabilityManager.h"
-#endif
-
-/**
- `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``.
-
- ## Subclassing Notes
-
- This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead.
-
- ## NSURLSession & NSURLSessionTask Delegate Methods
-
- `AFURLSessionManager` implements the following delegate methods:
-
- ### `NSURLSessionDelegate`
-
- - `URLSession:didBecomeInvalidWithError:`
- - `URLSession:didReceiveChallenge:completionHandler:`
- - `URLSessionDidFinishEventsForBackgroundURLSession:`
-
- ### `NSURLSessionTaskDelegate`
-
- - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`
- - `URLSession:task:didReceiveChallenge:completionHandler:`
- - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`
- - `URLSession:task:needNewBodyStream:`
- - `URLSession:task:didCompleteWithError:`
-
- ### `NSURLSessionDataDelegate`
-
- - `URLSession:dataTask:didReceiveResponse:completionHandler:`
- - `URLSession:dataTask:didBecomeDownloadTask:`
- - `URLSession:dataTask:didReceiveData:`
- - `URLSession:dataTask:willCacheResponse:completionHandler:`
-
- ### `NSURLSessionDownloadDelegate`
-
- - `URLSession:downloadTask:didFinishDownloadingToURL:`
- - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`
- - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`
-
- If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.
-
- ## Network Reachability Monitoring
-
- Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details.
-
- ## NSCoding Caveats
-
- - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`.
-
- ## NSCopying Caveats
-
- - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original.
- - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied.
-
- @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
- */
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface AFURLSessionManager : NSObject
-
-/**
- The managed session.
- */
-@property (readonly, nonatomic, strong) NSURLSession *session;
-
-/**
- The operation queue on which delegate callbacks are run.
- */
-@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;
-
-/**
- Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
-
- @warning `responseSerializer` must not be `nil`.
- */
-@property (nonatomic, strong) id responseSerializer;
-
-///-------------------------------
-/// @name Managing Security Policy
-///-------------------------------
-
-/**
- The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified.
- */
-@property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
-
-#if !TARGET_OS_WATCH
-///--------------------------------------
-/// @name Monitoring Network Reachability
-///--------------------------------------
-
-/**
- The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default.
- */
-@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;
-#endif
-
-///----------------------------
-/// @name Getting Session Tasks
-///----------------------------
-
-/**
- The data, upload, and download tasks currently run by the managed session.
- */
-@property (readonly, nonatomic, strong) NSArray *tasks;
-
-/**
- The data tasks currently run by the managed session.
- */
-@property (readonly, nonatomic, strong) NSArray *dataTasks;
-
-/**
- The upload tasks currently run by the managed session.
- */
-@property (readonly, nonatomic, strong) NSArray *uploadTasks;
-
-/**
- The download tasks currently run by the managed session.
- */
-@property (readonly, nonatomic, strong) NSArray *downloadTasks;
-
-///-------------------------------
-/// @name Managing Callback Queues
-///-------------------------------
-
-/**
- The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.
- */
-@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;
-
-/**
- The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.
- */
-@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;
-
-///---------------------------------
-/// @name Working Around System Bugs
-///---------------------------------
-
-/**
- Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default.
-
- @bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, AFNetworking will follow Apple's recommendation to try creating the task again.
-
- @see https://github.com/AFNetworking/AFNetworking/issues/1675
- */
-@property (nonatomic, assign) BOOL attemptsToRecreateUploadTasksForBackgroundSessions;
-
-///---------------------
-/// @name Initialization
-///---------------------
-
-/**
- Creates and returns a manager for a session created with the specified configuration. This is the designated initializer.
-
- @param configuration The configuration used to create the managed session.
-
- @return A manager for a newly-created session.
- */
-- (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;
-
-/**
- Invalidates the managed session, optionally canceling pending tasks.
-
- @param cancelPendingTasks Whether or not to cancel pending tasks.
- */
-- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks;
-
-///-------------------------
-/// @name Running Data Tasks
-///-------------------------
-
-/**
- Creates an `NSURLSessionDataTask` with the specified request.
-
- @param request The HTTP request for the request.
- @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
- */
-- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
- completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
-
-/**
- Creates an `NSURLSessionDataTask` with the specified request.
-
- @param request The HTTP request for the request.
- @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
- @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
- @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
- */
-- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
- uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
- downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
- completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
-
-///---------------------------
-/// @name Running Upload Tasks
-///---------------------------
-
-/**
- Creates an `NSURLSessionUploadTask` with the specified request for a local file.
-
- @param request The HTTP request for the request.
- @param fileURL A URL to the local file to be uploaded.
- @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
- @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
-
- @see `attemptsToRecreateUploadTasksForBackgroundSessions`
- */
-- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
- fromFile:(NSURL *)fileURL
- progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
- completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
-
-/**
- Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body.
-
- @param request The HTTP request for the request.
- @param bodyData A data object containing the HTTP body to be uploaded.
- @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
- @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
- */
-- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
- fromData:(nullable NSData *)bodyData
- progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
- completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
-
-/**
- Creates an `NSURLSessionUploadTask` with the specified streaming request.
-
- @param request The HTTP request for the request.
- @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue.
- @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any.
- */
-- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request
- progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock
- completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;
-
-///-----------------------------
-/// @name Running Download Tasks
-///-----------------------------
-
-/**
- Creates an `NSURLSessionDownloadTask` with the specified request.
-
- @param request The HTTP request for the request.
- @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
- @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL.
- @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any.
-
- @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method.
- */
-- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request
- progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
- destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
- completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;
-
-/**
- Creates an `NSURLSessionDownloadTask` with the specified resume data.
-
- @param resumeData The data used to resume downloading.
- @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue.
- @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL.
- @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any.
- */
-- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData
- progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
- destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
- completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;
-
-///---------------------------------
-/// @name Getting Progress for Tasks
-///---------------------------------
-
-/**
- Returns the upload progress of the specified task.
-
- @param task The session task. Must not be `nil`.
-
- @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable.
- */
-- (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task;
-
-/**
- Returns the download progress of the specified task.
-
- @param task The session task. Must not be `nil`.
-
- @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable.
- */
-- (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task;
-
-///-----------------------------------------
-/// @name Setting Session Delegate Callbacks
-///-----------------------------------------
-
-/**
- Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`.
-
- @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation.
- */
-- (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block;
-
-/**
- Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`.
-
- @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge.
- */
-- (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;
-
-///--------------------------------------
-/// @name Setting Task Delegate Callbacks
-///--------------------------------------
-
-/**
- Sets a block to be executed when a task requires a new request body stream to send to the remote server, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:needNewBodyStream:`.
-
- @param block A block object to be executed when a task requires a new request body stream.
- */
-- (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block;
-
-/**
- Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`.
-
- @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response.
- */
-- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;
-
-/**
- Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`.
-
- @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge.
- */
-- (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;
-
-/**
- Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`.
-
- @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread.
- */
-- (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block;
-
-/**
- Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`.
-
- @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task.
- */
-- (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block;
-
-///-------------------------------------------
-/// @name Setting Data Task Delegate Callbacks
-///-------------------------------------------
-
-/**
- Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`.
-
- @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response.
- */
-- (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block;
-
-/**
- Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`.
-
- @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become.
- */
-- (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block;
-
-/**
- Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`.
-
- @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue.
- */
-- (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block;
-
-/**
- Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`.
-
- @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response.
- */
-- (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block;
-
-/**
- Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`.
-
- @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session.
- */
-- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block;
-
-///-----------------------------------------------
-/// @name Setting Download Task Delegate Callbacks
-///-----------------------------------------------
-
-/**
- Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`.
-
- @param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error.
- */
-- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;
-
-/**
- Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`.
-
- @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue.
- */
-- (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block;
-
-/**
- Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`.
-
- @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded.
- */
-- (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block;
-
-@end
-
-///--------------------
-/// @name Notifications
-///--------------------
-
-/**
- Posted when a task resumes.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification;
-
-/**
- Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification;
-
-/**
- Posted when a task suspends its execution.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification;
-
-/**
- Posted when a session is invalidated.
- */
-FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification;
-
-/**
- Posted when a session download task encountered an error when moving the temporary download file to a specified destination.
- */
-FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification;
-
-/**
- The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey;
-
-/**
- The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey;
-
-/**
- The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey;
-
-/**
- The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey;
-
-/**
- Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists.
- */
-FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey;
-
-NS_ASSUME_NONNULL_END
diff --git a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m b/iOSProject/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m
deleted file mode 100644
index ef2108cd..00000000
--- a/iOSProject/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m
+++ /dev/null
@@ -1,1244 +0,0 @@
-// AFURLSessionManager.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFURLSessionManager.h"
-#import
-
-#ifndef NSFoundationVersionNumber_iOS_8_0
-#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug 1140.11
-#else
-#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug NSFoundationVersionNumber_iOS_8_0
-#endif
-
-static dispatch_queue_t url_session_manager_creation_queue() {
- static dispatch_queue_t af_url_session_manager_creation_queue;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- af_url_session_manager_creation_queue = dispatch_queue_create("com.alamofire.networking.session.manager.creation", DISPATCH_QUEUE_SERIAL);
- });
-
- return af_url_session_manager_creation_queue;
-}
-
-static void url_session_manager_create_task_safely(dispatch_block_t block) {
- if (NSFoundationVersionNumber < NSFoundationVersionNumber_With_Fixed_5871104061079552_bug) {
- // Fix of bug
- // Open Radar:http://openradar.appspot.com/radar?id=5871104061079552 (status: Fixed in iOS8)
- // Issue about:https://github.com/AFNetworking/AFNetworking/issues/2093
- dispatch_sync(url_session_manager_creation_queue(), block);
- } else {
- block();
- }
-}
-
-static dispatch_queue_t url_session_manager_processing_queue() {
- static dispatch_queue_t af_url_session_manager_processing_queue;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- af_url_session_manager_processing_queue = dispatch_queue_create("com.alamofire.networking.session.manager.processing", DISPATCH_QUEUE_CONCURRENT);
- });
-
- return af_url_session_manager_processing_queue;
-}
-
-static dispatch_group_t url_session_manager_completion_group() {
- static dispatch_group_t af_url_session_manager_completion_group;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- af_url_session_manager_completion_group = dispatch_group_create();
- });
-
- return af_url_session_manager_completion_group;
-}
-
-NSString * const AFNetworkingTaskDidResumeNotification = @"com.alamofire.networking.task.resume";
-NSString * const AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete";
-NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend";
-NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate";
-NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error";
-
-NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse";
-NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamofire.networking.task.complete.responseserializer";
-NSString * const AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata";
-NSString * const AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error";
-NSString * const AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath";
-
-static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock";
-
-static NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3;
-
-static void * AFTaskStateChangedContext = &AFTaskStateChangedContext;
-
-typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error);
-typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);
-
-typedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request);
-typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential);
-typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session);
-
-typedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task);
-typedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend);
-typedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error);
-
-typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response);
-typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask);
-typedef void (^AFURLSessionDataTaskDidReceiveDataBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data);
-typedef NSCachedURLResponse * (^AFURLSessionDataTaskWillCacheResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse);
-
-typedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location);
-typedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);
-typedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes);
-typedef void (^AFURLSessionTaskProgressBlock)(NSProgress *);
-
-typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error);
-
-
-#pragma mark -
-
-@interface AFURLSessionManagerTaskDelegate : NSObject
-@property (nonatomic, weak) AFURLSessionManager *manager;
-@property (nonatomic, strong) NSMutableData *mutableData;
-@property (nonatomic, strong) NSProgress *uploadProgress;
-@property (nonatomic, strong) NSProgress *downloadProgress;
-@property (nonatomic, copy) NSURL *downloadFileURL;
-@property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;
-@property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock;
-@property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock;
-@property (nonatomic, copy) AFURLSessionTaskCompletionHandler completionHandler;
-@end
-
-@implementation AFURLSessionManagerTaskDelegate
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- self.mutableData = [NSMutableData data];
- self.uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
- self.uploadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown;
-
- self.downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil];
- self.downloadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown;
- return self;
-}
-
-#pragma mark - NSProgress Tracking
-
-- (void)setupProgressForTask:(NSURLSessionTask *)task {
- __weak __typeof__(task) weakTask = task;
-
- self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend;
- self.downloadProgress.totalUnitCount = task.countOfBytesExpectedToReceive;
- [self.uploadProgress setCancellable:YES];
- [self.uploadProgress setCancellationHandler:^{
- __typeof__(weakTask) strongTask = weakTask;
- [strongTask cancel];
- }];
- [self.uploadProgress setPausable:YES];
- [self.uploadProgress setPausingHandler:^{
- __typeof__(weakTask) strongTask = weakTask;
- [strongTask suspend];
- }];
- if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) {
- [self.uploadProgress setResumingHandler:^{
- __typeof__(weakTask) strongTask = weakTask;
- [strongTask resume];
- }];
- }
-
- [self.downloadProgress setCancellable:YES];
- [self.downloadProgress setCancellationHandler:^{
- __typeof__(weakTask) strongTask = weakTask;
- [strongTask cancel];
- }];
- [self.downloadProgress setPausable:YES];
- [self.downloadProgress setPausingHandler:^{
- __typeof__(weakTask) strongTask = weakTask;
- [strongTask suspend];
- }];
-
- if ([self.downloadProgress respondsToSelector:@selector(setResumingHandler:)]) {
- [self.downloadProgress setResumingHandler:^{
- __typeof__(weakTask) strongTask = weakTask;
- [strongTask resume];
- }];
- }
-
- [task addObserver:self
- forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))
- options:NSKeyValueObservingOptionNew
- context:NULL];
- [task addObserver:self
- forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))
- options:NSKeyValueObservingOptionNew
- context:NULL];
-
- [task addObserver:self
- forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))
- options:NSKeyValueObservingOptionNew
- context:NULL];
- [task addObserver:self
- forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))
- options:NSKeyValueObservingOptionNew
- context:NULL];
-
- [self.downloadProgress addObserver:self
- forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
- options:NSKeyValueObservingOptionNew
- context:NULL];
- [self.uploadProgress addObserver:self
- forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
- options:NSKeyValueObservingOptionNew
- context:NULL];
-}
-
-- (void)cleanUpProgressForTask:(NSURLSessionTask *)task {
- [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];
- [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))];
- [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];
- [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))];
- [self.downloadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
- [self.uploadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
- if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) {
- if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
- self.downloadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
- } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) {
- self.downloadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
- } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {
- self.uploadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
- } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) {
- self.uploadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue];
- }
- }
- else if ([object isEqual:self.downloadProgress]) {
- if (self.downloadProgressBlock) {
- self.downloadProgressBlock(object);
- }
- }
- else if ([object isEqual:self.uploadProgress]) {
- if (self.uploadProgressBlock) {
- self.uploadProgressBlock(object);
- }
- }
-}
-
-#pragma mark - NSURLSessionTaskDelegate
-
-- (void)URLSession:(__unused NSURLSession *)session
- task:(NSURLSessionTask *)task
-didCompleteWithError:(NSError *)error
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- __strong AFURLSessionManager *manager = self.manager;
-
- __block id responseObject = nil;
-
- __block NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- userInfo[AFNetworkingTaskDidCompleteResponseSerializerKey] = manager.responseSerializer;
-
- //Performance Improvement from #2672
- NSData *data = nil;
- if (self.mutableData) {
- data = [self.mutableData copy];
- //We no longer need the reference, so nil it out to gain back some memory.
- self.mutableData = nil;
- }
-
- if (self.downloadFileURL) {
- userInfo[AFNetworkingTaskDidCompleteAssetPathKey] = self.downloadFileURL;
- } else if (data) {
- userInfo[AFNetworkingTaskDidCompleteResponseDataKey] = data;
- }
-
- if (error) {
- userInfo[AFNetworkingTaskDidCompleteErrorKey] = error;
-
- dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{
- if (self.completionHandler) {
- self.completionHandler(task.response, responseObject, error);
- }
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo];
- });
- });
- } else {
- dispatch_async(url_session_manager_processing_queue(), ^{
- NSError *serializationError = nil;
- responseObject = [manager.responseSerializer responseObjectForResponse:task.response data:data error:&serializationError];
-
- if (self.downloadFileURL) {
- responseObject = self.downloadFileURL;
- }
-
- if (responseObject) {
- userInfo[AFNetworkingTaskDidCompleteSerializedResponseKey] = responseObject;
- }
-
- if (serializationError) {
- userInfo[AFNetworkingTaskDidCompleteErrorKey] = serializationError;
- }
-
- dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{
- if (self.completionHandler) {
- self.completionHandler(task.response, responseObject, serializationError);
- }
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo];
- });
- });
- });
- }
-#pragma clang diagnostic pop
-}
-
-#pragma mark - NSURLSessionDataTaskDelegate
-
-- (void)URLSession:(__unused NSURLSession *)session
- dataTask:(__unused NSURLSessionDataTask *)dataTask
- didReceiveData:(NSData *)data
-{
- [self.mutableData appendData:data];
-}
-
-#pragma mark - NSURLSessionDownloadTaskDelegate
-
-- (void)URLSession:(NSURLSession *)session
- downloadTask:(NSURLSessionDownloadTask *)downloadTask
-didFinishDownloadingToURL:(NSURL *)location
-{
- NSError *fileManagerError = nil;
- self.downloadFileURL = nil;
-
- if (self.downloadTaskDidFinishDownloading) {
- self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);
- if (self.downloadFileURL) {
- [[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError];
-
- if (fileManagerError) {
- [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo];
- }
- }
- }
-}
-
-@end
-
-#pragma mark -
-
-/**
- * A workaround for issues related to key-value observing the `state` of an `NSURLSessionTask`.
- *
- * See:
- * - https://github.com/AFNetworking/AFNetworking/issues/1477
- * - https://github.com/AFNetworking/AFNetworking/issues/2638
- * - https://github.com/AFNetworking/AFNetworking/pull/2702
- */
-
-static inline void af_swizzleSelector(Class theClass, SEL originalSelector, SEL swizzledSelector) {
- Method originalMethod = class_getInstanceMethod(theClass, originalSelector);
- Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector);
- method_exchangeImplementations(originalMethod, swizzledMethod);
-}
-
-static inline BOOL af_addMethod(Class theClass, SEL selector, Method method) {
- return class_addMethod(theClass, selector, method_getImplementation(method), method_getTypeEncoding(method));
-}
-
-static NSString * const AFNSURLSessionTaskDidResumeNotification = @"com.alamofire.networking.nsurlsessiontask.resume";
-static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofire.networking.nsurlsessiontask.suspend";
-
-@interface _AFURLSessionTaskSwizzling : NSObject
-
-@end
-
-@implementation _AFURLSessionTaskSwizzling
-
-+ (void)load {
- /**
- WARNING: Trouble Ahead
- https://github.com/AFNetworking/AFNetworking/pull/2702
- */
-
- if (NSClassFromString(@"NSURLSessionTask")) {
- /**
- iOS 7 and iOS 8 differ in NSURLSessionTask implementation, which makes the next bit of code a bit tricky.
- Many Unit Tests have been built to validate as much of this behavior has possible.
- Here is what we know:
- - NSURLSessionTasks are implemented with class clusters, meaning the class you request from the API isn't actually the type of class you will get back.
- - Simply referencing `[NSURLSessionTask class]` will not work. You need to ask an `NSURLSession` to actually create an object, and grab the class from there.
- - On iOS 7, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `__NSCFURLSessionTask`.
- - On iOS 8, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `NSURLSessionTask`.
- - On iOS 7, `__NSCFLocalSessionTask` and `__NSCFURLSessionTask` are the only two classes that have their own implementations of `resume` and `suspend`, and `__NSCFLocalSessionTask` DOES NOT CALL SUPER. This means both classes need to be swizzled.
- - On iOS 8, `NSURLSessionTask` is the only class that implements `resume` and `suspend`. This means this is the only class that needs to be swizzled.
- - Because `NSURLSessionTask` is not involved in the class hierarchy for every version of iOS, its easier to add the swizzled methods to a dummy class and manage them there.
-
- Some Assumptions:
- - No implementations of `resume` or `suspend` call super. If this were to change in a future version of iOS, we'd need to handle it.
- - No background task classes override `resume` or `suspend`
-
- The current solution:
- 1) Grab an instance of `__NSCFLocalDataTask` by asking an instance of `NSURLSession` for a data task.
- 2) Grab a pointer to the original implementation of `af_resume`
- 3) Check to see if the current class has an implementation of resume. If so, continue to step 4.
- 4) Grab the super class of the current class.
- 5) Grab a pointer for the current class to the current implementation of `resume`.
- 6) Grab a pointer for the super class to the current implementation of `resume`.
- 7) If the current class implementation of `resume` is not equal to the super class implementation of `resume` AND the current implementation of `resume` is not equal to the original implementation of `af_resume`, THEN swizzle the methods
- 8) Set the current class to the super class, and repeat steps 3-8
- */
- NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
- NSURLSession * session = [NSURLSession sessionWithConfiguration:configuration];
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wnonnull"
- NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil];
-#pragma clang diagnostic pop
- IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([self class], @selector(af_resume)));
- Class currentClass = [localDataTask class];
-
- while (class_getInstanceMethod(currentClass, @selector(resume))) {
- Class superClass = [currentClass superclass];
- IMP classResumeIMP = method_getImplementation(class_getInstanceMethod(currentClass, @selector(resume)));
- IMP superclassResumeIMP = method_getImplementation(class_getInstanceMethod(superClass, @selector(resume)));
- if (classResumeIMP != superclassResumeIMP &&
- originalAFResumeIMP != classResumeIMP) {
- [self swizzleResumeAndSuspendMethodForClass:currentClass];
- }
- currentClass = [currentClass superclass];
- }
-
- [localDataTask cancel];
- [session finishTasksAndInvalidate];
- }
-}
-
-+ (void)swizzleResumeAndSuspendMethodForClass:(Class)theClass {
- Method afResumeMethod = class_getInstanceMethod(self, @selector(af_resume));
- Method afSuspendMethod = class_getInstanceMethod(self, @selector(af_suspend));
-
- if (af_addMethod(theClass, @selector(af_resume), afResumeMethod)) {
- af_swizzleSelector(theClass, @selector(resume), @selector(af_resume));
- }
-
- if (af_addMethod(theClass, @selector(af_suspend), afSuspendMethod)) {
- af_swizzleSelector(theClass, @selector(suspend), @selector(af_suspend));
- }
-}
-
-- (NSURLSessionTaskState)state {
- NSAssert(NO, @"State method should never be called in the actual dummy class");
- return NSURLSessionTaskStateCanceling;
-}
-
-- (void)af_resume {
- NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state");
- NSURLSessionTaskState state = [self state];
- [self af_resume];
-
- if (state != NSURLSessionTaskStateRunning) {
- [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidResumeNotification object:self];
- }
-}
-
-- (void)af_suspend {
- NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state");
- NSURLSessionTaskState state = [self state];
- [self af_suspend];
-
- if (state != NSURLSessionTaskStateSuspended) {
- [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidSuspendNotification object:self];
- }
-}
-@end
-
-#pragma mark -
-
-@interface AFURLSessionManager ()
-@property (readwrite, nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration;
-@property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue;
-@property (readwrite, nonatomic, strong) NSURLSession *session;
-@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableTaskDelegatesKeyedByTaskIdentifier;
-@property (readonly, nonatomic, copy) NSString *taskDescriptionForSessionTasks;
-@property (readwrite, nonatomic, strong) NSLock *lock;
-@property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid;
-@property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge;
-@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession;
-@property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection;
-@property (readwrite, nonatomic, copy) AFURLSessionTaskDidReceiveAuthenticationChallengeBlock taskDidReceiveAuthenticationChallenge;
-@property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream;
-@property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData;
-@property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete;
-@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse;
-@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask;
-@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData;
-@property (readwrite, nonatomic, copy) AFURLSessionDataTaskWillCacheResponseBlock dataTaskWillCacheResponse;
-@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;
-@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidWriteDataBlock downloadTaskDidWriteData;
-@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidResumeBlock downloadTaskDidResume;
-@end
-
-@implementation AFURLSessionManager
-
-- (instancetype)init {
- return [self initWithSessionConfiguration:nil];
-}
-
-- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
- self = [super init];
- if (!self) {
- return nil;
- }
-
- if (!configuration) {
- configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
- }
-
- self.sessionConfiguration = configuration;
-
- self.operationQueue = [[NSOperationQueue alloc] init];
- self.operationQueue.maxConcurrentOperationCount = 1;
-
- self.session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue];
-
- self.responseSerializer = [AFJSONResponseSerializer serializer];
-
- self.securityPolicy = [AFSecurityPolicy defaultPolicy];
-
-#if !TARGET_OS_WATCH
- self.reachabilityManager = [AFNetworkReachabilityManager sharedManager];
-#endif
-
- self.mutableTaskDelegatesKeyedByTaskIdentifier = [[NSMutableDictionary alloc] init];
-
- self.lock = [[NSLock alloc] init];
- self.lock.name = AFURLSessionManagerLockName;
-
- [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
- for (NSURLSessionDataTask *task in dataTasks) {
- [self addDelegateForDataTask:task uploadProgress:nil downloadProgress:nil completionHandler:nil];
- }
-
- for (NSURLSessionUploadTask *uploadTask in uploadTasks) {
- [self addDelegateForUploadTask:uploadTask progress:nil completionHandler:nil];
- }
-
- for (NSURLSessionDownloadTask *downloadTask in downloadTasks) {
- [self addDelegateForDownloadTask:downloadTask progress:nil destination:nil completionHandler:nil];
- }
- }];
-
- return self;
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-#pragma mark -
-
-- (NSString *)taskDescriptionForSessionTasks {
- return [NSString stringWithFormat:@"%p", self];
-}
-
-- (void)taskDidResume:(NSNotification *)notification {
- NSURLSessionTask *task = notification.object;
- if ([task respondsToSelector:@selector(taskDescription)]) {
- if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidResumeNotification object:task];
- });
- }
- }
-}
-
-- (void)taskDidSuspend:(NSNotification *)notification {
- NSURLSessionTask *task = notification.object;
- if ([task respondsToSelector:@selector(taskDescription)]) {
- if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidSuspendNotification object:task];
- });
- }
- }
-}
-
-#pragma mark -
-
-- (AFURLSessionManagerTaskDelegate *)delegateForTask:(NSURLSessionTask *)task {
- NSParameterAssert(task);
-
- AFURLSessionManagerTaskDelegate *delegate = nil;
- [self.lock lock];
- delegate = self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)];
- [self.lock unlock];
-
- return delegate;
-}
-
-- (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate
- forTask:(NSURLSessionTask *)task
-{
- NSParameterAssert(task);
- NSParameterAssert(delegate);
-
- [self.lock lock];
- self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate;
- [delegate setupProgressForTask:task];
- [self addNotificationObserverForTask:task];
- [self.lock unlock];
-}
-
-- (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask
- uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock
- downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock
- completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
-{
- AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
- delegate.manager = self;
- delegate.completionHandler = completionHandler;
-
- dataTask.taskDescription = self.taskDescriptionForSessionTasks;
- [self setDelegate:delegate forTask:dataTask];
-
- delegate.uploadProgressBlock = uploadProgressBlock;
- delegate.downloadProgressBlock = downloadProgressBlock;
-}
-
-- (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask
- progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
- completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
-{
- AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
- delegate.manager = self;
- delegate.completionHandler = completionHandler;
-
- uploadTask.taskDescription = self.taskDescriptionForSessionTasks;
-
- [self setDelegate:delegate forTask:uploadTask];
-
- delegate.uploadProgressBlock = uploadProgressBlock;
-}
-
-- (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask
- progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock
- destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
- completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
-{
- AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
- delegate.manager = self;
- delegate.completionHandler = completionHandler;
-
- if (destination) {
- delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) {
- return destination(location, task.response);
- };
- }
-
- downloadTask.taskDescription = self.taskDescriptionForSessionTasks;
-
- [self setDelegate:delegate forTask:downloadTask];
-
- delegate.downloadProgressBlock = downloadProgressBlock;
-}
-
-- (void)removeDelegateForTask:(NSURLSessionTask *)task {
- NSParameterAssert(task);
-
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
- [self.lock lock];
- [delegate cleanUpProgressForTask:task];
- [self removeNotificationObserverForTask:task];
- [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)];
- [self.lock unlock];
-}
-
-#pragma mark -
-
-- (NSArray *)tasksForKeyPath:(NSString *)keyPath {
- __block NSArray *tasks = nil;
- dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
- [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
- if ([keyPath isEqualToString:NSStringFromSelector(@selector(dataTasks))]) {
- tasks = dataTasks;
- } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(uploadTasks))]) {
- tasks = uploadTasks;
- } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(downloadTasks))]) {
- tasks = downloadTasks;
- } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(tasks))]) {
- tasks = [@[dataTasks, uploadTasks, downloadTasks] valueForKeyPath:@"@unionOfArrays.self"];
- }
-
- dispatch_semaphore_signal(semaphore);
- }];
-
- dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
-
- return tasks;
-}
-
-- (NSArray *)tasks {
- return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
-}
-
-- (NSArray *)dataTasks {
- return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
-}
-
-- (NSArray *)uploadTasks {
- return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
-}
-
-- (NSArray *)downloadTasks {
- return [self tasksForKeyPath:NSStringFromSelector(_cmd)];
-}
-
-#pragma mark -
-
-- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (cancelPendingTasks) {
- [self.session invalidateAndCancel];
- } else {
- [self.session finishTasksAndInvalidate];
- }
- });
-}
-
-#pragma mark -
-
-- (void)setResponseSerializer:(id )responseSerializer {
- NSParameterAssert(responseSerializer);
-
- _responseSerializer = responseSerializer;
-}
-
-#pragma mark -
-- (void)addNotificationObserverForTask:(NSURLSessionTask *)task {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidResume:) name:AFNSURLSessionTaskDidResumeNotification object:task];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidSuspend:) name:AFNSURLSessionTaskDidSuspendNotification object:task];
-}
-
-- (void)removeNotificationObserverForTask:(NSURLSessionTask *)task {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidSuspendNotification object:task];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidResumeNotification object:task];
-}
-
-#pragma mark -
-
-- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
- completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
-{
- return [self dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:completionHandler];
-}
-
-- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
- uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock
- downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock
- completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler {
-
- __block NSURLSessionDataTask *dataTask = nil;
- url_session_manager_create_task_safely(^{
- dataTask = [self.session dataTaskWithRequest:request];
- });
-
- [self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler];
-
- return dataTask;
-}
-
-#pragma mark -
-
-- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
- fromFile:(NSURL *)fileURL
- progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
- completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
-{
- __block NSURLSessionUploadTask *uploadTask = nil;
- url_session_manager_create_task_safely(^{
- uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
- });
-
- if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {
- for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {
- uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
- }
- }
-
- [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];
-
- return uploadTask;
-}
-
-- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
- fromData:(NSData *)bodyData
- progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
- completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
-{
- __block NSURLSessionUploadTask *uploadTask = nil;
- url_session_manager_create_task_safely(^{
- uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData];
- });
-
- [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];
-
- return uploadTask;
-}
-
-- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request
- progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
- completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
-{
- __block NSURLSessionUploadTask *uploadTask = nil;
- url_session_manager_create_task_safely(^{
- uploadTask = [self.session uploadTaskWithStreamedRequest:request];
- });
-
- [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler];
-
- return uploadTask;
-}
-
-#pragma mark -
-
-- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request
- progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock
- destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
- completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
-{
- __block NSURLSessionDownloadTask *downloadTask = nil;
- url_session_manager_create_task_safely(^{
- downloadTask = [self.session downloadTaskWithRequest:request];
- });
-
- [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler];
-
- return downloadTask;
-}
-
-- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData
- progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock
- destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination
- completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
-{
- __block NSURLSessionDownloadTask *downloadTask = nil;
- url_session_manager_create_task_safely(^{
- downloadTask = [self.session downloadTaskWithResumeData:resumeData];
- });
-
- [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler];
-
- return downloadTask;
-}
-
-#pragma mark -
-- (NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task {
- return [[self delegateForTask:task] uploadProgress];
-}
-
-- (NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task {
- return [[self delegateForTask:task] downloadProgress];
-}
-
-#pragma mark -
-
-- (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block {
- self.sessionDidBecomeInvalid = block;
-}
-
-- (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block {
- self.sessionDidReceiveAuthenticationChallenge = block;
-}
-
-- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block {
- self.didFinishEventsForBackgroundURLSession = block;
-}
-
-#pragma mark -
-
-- (void)setTaskNeedNewBodyStreamBlock:(NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block {
- self.taskNeedNewBodyStream = block;
-}
-
-- (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block {
- self.taskWillPerformHTTPRedirection = block;
-}
-
-- (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block {
- self.taskDidReceiveAuthenticationChallenge = block;
-}
-
-- (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block {
- self.taskDidSendBodyData = block;
-}
-
-- (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block {
- self.taskDidComplete = block;
-}
-
-#pragma mark -
-
-- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block {
- self.dataTaskDidReceiveResponse = block;
-}
-
-- (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block {
- self.dataTaskDidBecomeDownloadTask = block;
-}
-
-- (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block {
- self.dataTaskDidReceiveData = block;
-}
-
-- (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block {
- self.dataTaskWillCacheResponse = block;
-}
-
-#pragma mark -
-
-- (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block {
- self.downloadTaskDidFinishDownloading = block;
-}
-
-- (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block {
- self.downloadTaskDidWriteData = block;
-}
-
-- (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block {
- self.downloadTaskDidResume = block;
-}
-
-#pragma mark - NSObject
-
-- (NSString *)description {
- return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, self.session, self.operationQueue];
-}
-
-- (BOOL)respondsToSelector:(SEL)selector {
- if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) {
- return self.taskWillPerformHTTPRedirection != nil;
- } else if (selector == @selector(URLSession:dataTask:didReceiveResponse:completionHandler:)) {
- return self.dataTaskDidReceiveResponse != nil;
- } else if (selector == @selector(URLSession:dataTask:willCacheResponse:completionHandler:)) {
- return self.dataTaskWillCacheResponse != nil;
- } else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) {
- return self.didFinishEventsForBackgroundURLSession != nil;
- }
-
- return [[self class] instancesRespondToSelector:selector];
-}
-
-#pragma mark - NSURLSessionDelegate
-
-- (void)URLSession:(NSURLSession *)session
-didBecomeInvalidWithError:(NSError *)error
-{
- if (self.sessionDidBecomeInvalid) {
- self.sessionDidBecomeInvalid(session, error);
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDidInvalidateNotification object:session];
-}
-
-- (void)URLSession:(NSURLSession *)session
-didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
- completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
-{
- NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;
- __block NSURLCredential *credential = nil;
-
- if (self.sessionDidReceiveAuthenticationChallenge) {
- disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential);
- } else {
- if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
- if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) {
- credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
- if (credential) {
- disposition = NSURLSessionAuthChallengeUseCredential;
- } else {
- disposition = NSURLSessionAuthChallengePerformDefaultHandling;
- }
- } else {
- disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;
- }
- } else {
- disposition = NSURLSessionAuthChallengePerformDefaultHandling;
- }
- }
-
- if (completionHandler) {
- completionHandler(disposition, credential);
- }
-}
-
-#pragma mark - NSURLSessionTaskDelegate
-
-- (void)URLSession:(NSURLSession *)session
- task:(NSURLSessionTask *)task
-willPerformHTTPRedirection:(NSHTTPURLResponse *)response
- newRequest:(NSURLRequest *)request
- completionHandler:(void (^)(NSURLRequest *))completionHandler
-{
- NSURLRequest *redirectRequest = request;
-
- if (self.taskWillPerformHTTPRedirection) {
- redirectRequest = self.taskWillPerformHTTPRedirection(session, task, response, request);
- }
-
- if (completionHandler) {
- completionHandler(redirectRequest);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- task:(NSURLSessionTask *)task
-didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
- completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
-{
- NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;
- __block NSURLCredential *credential = nil;
-
- if (self.taskDidReceiveAuthenticationChallenge) {
- disposition = self.taskDidReceiveAuthenticationChallenge(session, task, challenge, &credential);
- } else {
- if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
- if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) {
- disposition = NSURLSessionAuthChallengeUseCredential;
- credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
- } else {
- disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;
- }
- } else {
- disposition = NSURLSessionAuthChallengePerformDefaultHandling;
- }
- }
-
- if (completionHandler) {
- completionHandler(disposition, credential);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- task:(NSURLSessionTask *)task
- needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler
-{
- NSInputStream *inputStream = nil;
-
- if (self.taskNeedNewBodyStream) {
- inputStream = self.taskNeedNewBodyStream(session, task);
- } else if (task.originalRequest.HTTPBodyStream && [task.originalRequest.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) {
- inputStream = [task.originalRequest.HTTPBodyStream copy];
- }
-
- if (completionHandler) {
- completionHandler(inputStream);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- task:(NSURLSessionTask *)task
- didSendBodyData:(int64_t)bytesSent
- totalBytesSent:(int64_t)totalBytesSent
-totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
-{
-
- int64_t totalUnitCount = totalBytesExpectedToSend;
- if(totalUnitCount == NSURLSessionTransferSizeUnknown) {
- NSString *contentLength = [task.originalRequest valueForHTTPHeaderField:@"Content-Length"];
- if(contentLength) {
- totalUnitCount = (int64_t) [contentLength longLongValue];
- }
- }
-
- if (self.taskDidSendBodyData) {
- self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- task:(NSURLSessionTask *)task
-didCompleteWithError:(NSError *)error
-{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task];
-
- // delegate may be nil when completing a task in the background
- if (delegate) {
- [delegate URLSession:session task:task didCompleteWithError:error];
-
- [self removeDelegateForTask:task];
- }
-
- if (self.taskDidComplete) {
- self.taskDidComplete(session, task, error);
- }
-}
-
-#pragma mark - NSURLSessionDataDelegate
-
-- (void)URLSession:(NSURLSession *)session
- dataTask:(NSURLSessionDataTask *)dataTask
-didReceiveResponse:(NSURLResponse *)response
- completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler
-{
- NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow;
-
- if (self.dataTaskDidReceiveResponse) {
- disposition = self.dataTaskDidReceiveResponse(session, dataTask, response);
- }
-
- if (completionHandler) {
- completionHandler(disposition);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- dataTask:(NSURLSessionDataTask *)dataTask
-didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
-{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
- if (delegate) {
- [self removeDelegateForTask:dataTask];
- [self setDelegate:delegate forTask:downloadTask];
- }
-
- if (self.dataTaskDidBecomeDownloadTask) {
- self.dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- dataTask:(NSURLSessionDataTask *)dataTask
- didReceiveData:(NSData *)data
-{
-
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask];
- [delegate URLSession:session dataTask:dataTask didReceiveData:data];
-
- if (self.dataTaskDidReceiveData) {
- self.dataTaskDidReceiveData(session, dataTask, data);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- dataTask:(NSURLSessionDataTask *)dataTask
- willCacheResponse:(NSCachedURLResponse *)proposedResponse
- completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler
-{
- NSCachedURLResponse *cachedResponse = proposedResponse;
-
- if (self.dataTaskWillCacheResponse) {
- cachedResponse = self.dataTaskWillCacheResponse(session, dataTask, proposedResponse);
- }
-
- if (completionHandler) {
- completionHandler(cachedResponse);
- }
-}
-
-- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session {
- if (self.didFinishEventsForBackgroundURLSession) {
- dispatch_async(dispatch_get_main_queue(), ^{
- self.didFinishEventsForBackgroundURLSession(session);
- });
- }
-}
-
-#pragma mark - NSURLSessionDownloadDelegate
-
-- (void)URLSession:(NSURLSession *)session
- downloadTask:(NSURLSessionDownloadTask *)downloadTask
-didFinishDownloadingToURL:(NSURL *)location
-{
- AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask];
- if (self.downloadTaskDidFinishDownloading) {
- NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location);
- if (fileURL) {
- delegate.downloadFileURL = fileURL;
- NSError *error = nil;
- [[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error];
- if (error) {
- [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo];
- }
-
- return;
- }
- }
-
- if (delegate) {
- [delegate URLSession:session downloadTask:downloadTask didFinishDownloadingToURL:location];
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- downloadTask:(NSURLSessionDownloadTask *)downloadTask
- didWriteData:(int64_t)bytesWritten
- totalBytesWritten:(int64_t)totalBytesWritten
-totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
-{
- if (self.downloadTaskDidWriteData) {
- self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
- }
-}
-
-- (void)URLSession:(NSURLSession *)session
- downloadTask:(NSURLSessionDownloadTask *)downloadTask
- didResumeAtOffset:(int64_t)fileOffset
-expectedTotalBytes:(int64_t)expectedTotalBytes
-{
- if (self.downloadTaskDidResume) {
- self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes);
- }
-}
-
-#pragma mark - NSSecureCoding
-
-+ (BOOL)supportsSecureCoding {
- return YES;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder {
- NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"];
-
- self = [self initWithSessionConfiguration:configuration];
- if (!self) {
- return nil;
- }
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder {
- [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"];
-}
-
-#pragma mark - NSCopying
-
-- (instancetype)copyWithZone:(NSZone *)zone {
- return [[[self class] allocWithZone:zone] initWithSessionConfiguration:self.session.configuration];
-}
-
-@end
diff --git a/iOSProject/Pods/AFNetworking/LICENSE b/iOSProject/Pods/AFNetworking/LICENSE
deleted file mode 100644
index 3fbc2c9a..00000000
--- a/iOSProject/Pods/AFNetworking/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/iOSProject/Pods/AFNetworking/README.md b/iOSProject/Pods/AFNetworking/README.md
deleted file mode 100644
index 53cb2024..00000000
--- a/iOSProject/Pods/AFNetworking/README.md
+++ /dev/null
@@ -1,320 +0,0 @@
-
-
-
-
-[](https://travis-ci.org/AFNetworking/AFNetworking)
-[](https://codecov.io/github/AFNetworking/AFNetworking?branch=master)
-[](https://img.shields.io/cocoapods/v/AFNetworking.svg)
-[](https://github.com/Carthage/Carthage)
-[](http://cocoadocs.org/docsets/AFNetworking)
-[](http://twitter.com/AFNetworking)
-
-AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
-
-Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
-
-Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did!
-
-## How To Get Started
-
-- [Download AFNetworking](https://github.com/AFNetworking/AFNetworking/archive/master.zip) and try out the included Mac and iPhone example apps
-- Read the ["Getting Started" guide](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking), [FAQ](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ), or [other articles on the Wiki](https://github.com/AFNetworking/AFNetworking/wiki)
-- Check out the [documentation](http://cocoadocs.org/docsets/AFNetworking/) for a comprehensive look at all of the APIs available in AFNetworking
-- Read the [AFNetworking 3.0 Migration Guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide) for an overview of the architectural changes from 2.0.
-
-## Communication
-
-- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking). (Tag 'afnetworking')
-- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking).
-- If you **found a bug**, _and can provide steps to reliably reproduce it_, open an issue.
-- If you **have a feature request**, open an issue.
-- If you **want to contribute**, submit a pull request.
-
-## Installation
-AFNetworking supports multiple methods for installing the library in a project.
-
-## Installation with CocoaPods
-
-[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the ["Getting Started" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking). You can install it with the following command:
-
-```bash
-$ gem install cocoapods
-```
-
-> CocoaPods 0.39.0+ is required to build AFNetworking 3.0.0+.
-
-#### Podfile
-
-To integrate AFNetworking into your Xcode project using CocoaPods, specify it in your `Podfile`:
-
-```ruby
-source 'https://github.com/CocoaPods/Specs.git'
-platform :ios, '8.0'
-
-pod 'AFNetworking', '~> 3.0'
-```
-
-Then, run the following command:
-
-```bash
-$ pod install
-```
-
-### Installation with Carthage
-
-[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
-
-You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
-
-```bash
-$ brew update
-$ brew install carthage
-```
-
-To integrate AFNetworking into your Xcode project using Carthage, specify it in your `Cartfile`:
-
-```ogdl
-github "AFNetworking/AFNetworking" ~> 3.0
-```
-
-Run `carthage` to build the framework and drag the built `AFNetworking.framework` into your Xcode project.
-
-## Requirements
-
-| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | Minimum watchOS Target | Minimum tvOS Target | Notes |
-|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
-| 3.x | iOS 7 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required. `NSURLConnectionOperation` support has been removed. |
-| 2.6 -> 2.6.3 | iOS 7 | OS X 10.9 | watchOS 2.0 | n/a | Xcode 7+ is required. |
-| 2.0 -> 2.5.4 | iOS 6 | OS X 10.8 | n/a | n/a | Xcode 5+ is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. |
-| 1.x | iOS 5 | Mac OS X 10.7 | n/a | n/a |
-| 0.10.x | iOS 4 | Mac OS X 10.6 | n/a | n/a |
-
-(OS X projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
-
-> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs.
-
-## Architecture
-
-### NSURLSession
-
-- `AFURLSessionManager`
-- `AFHTTPSessionManager`
-
-### Serialization
-
-* ``
- - `AFHTTPRequestSerializer`
- - `AFJSONRequestSerializer`
- - `AFPropertyListRequestSerializer`
-* ``
- - `AFHTTPResponseSerializer`
- - `AFJSONResponseSerializer`
- - `AFXMLParserResponseSerializer`
- - `AFXMLDocumentResponseSerializer` _(Mac OS X)_
- - `AFPropertyListResponseSerializer`
- - `AFImageResponseSerializer`
- - `AFCompoundResponseSerializer`
-
-### Additional Functionality
-
-- `AFSecurityPolicy`
-- `AFNetworkReachabilityManager`
-
-## Usage
-
-### AFURLSessionManager
-
-`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``.
-
-#### Creating a Download Task
-
-```objective-c
-NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
-
-NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"];
-NSURLRequest *request = [NSURLRequest requestWithURL:URL];
-
-NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
- NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
- return [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]];
-} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
- NSLog(@"File downloaded to: %@", filePath);
-}];
-[downloadTask resume];
-```
-
-#### Creating an Upload Task
-
-```objective-c
-NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
-
-NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"];
-NSURLRequest *request = [NSURLRequest requestWithURL:URL];
-
-NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"];
-NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
- if (error) {
- NSLog(@"Error: %@", error);
- } else {
- NSLog(@"Success: %@ %@", response, responseObject);
- }
-}];
-[uploadTask resume];
-```
-
-#### Creating an Upload Task for a Multi-Part Request, with Progress
-
-```objective-c
-NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id formData) {
- [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"file://path/to/image.jpg"] name:@"file" fileName:@"filename.jpg" mimeType:@"image/jpeg" error:nil];
- } error:nil];
-
-AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
-
-NSURLSessionUploadTask *uploadTask;
-uploadTask = [manager
- uploadTaskWithStreamedRequest:request
- progress:^(NSProgress * _Nonnull uploadProgress) {
- // This is not called back on the main queue.
- // You are responsible for dispatching to the main queue for UI updates
- dispatch_async(dispatch_get_main_queue(), ^{
- //Update the progress view
- [progressView setProgress:uploadProgress.fractionCompleted];
- });
- }
- completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
- if (error) {
- NSLog(@"Error: %@", error);
- } else {
- NSLog(@"%@ %@", response, responseObject);
- }
- }];
-
-[uploadTask resume];
-```
-
-#### Creating a Data Task
-
-```objective-c
-NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
-
-NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"];
-NSURLRequest *request = [NSURLRequest requestWithURL:URL];
-
-NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
- if (error) {
- NSLog(@"Error: %@", error);
- } else {
- NSLog(@"%@ %@", response, responseObject);
- }
-}];
-[dataTask resume];
-```
-
----
-
-### Request Serialization
-
-Request serializers create requests from URL strings, encoding parameters as either a query string or HTTP body.
-
-```objective-c
-NSString *URLString = @"http://example.com/";
-NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]};
-```
-
-#### Query String Parameter Encoding
-
-```objective-c
-[[AFHTTPRequestSerializer serializer] requestWithMethod:@"GET" URLString:URLString parameters:parameters error:nil];
-```
-
- GET http://example.com?foo=bar&baz[]=1&baz[]=2&baz[]=3
-
-#### URL Form Parameter Encoding
-
-```objective-c
-[[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil];
-```
-
- POST http://example.com/
- Content-Type: application/x-www-form-urlencoded
-
- foo=bar&baz[]=1&baz[]=2&baz[]=3
-
-#### JSON Parameter Encoding
-
-```objective-c
-[[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil];
-```
-
- POST http://example.com/
- Content-Type: application/json
-
- {"foo": "bar", "baz": [1,2,3]}
-
----
-
-### Network Reachability Manager
-
-`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
-
-* Do not use Reachability to determine if the original request should be sent.
- * You should try to send it.
-* You can use Reachability to determine when a request should be automatically retried.
- * Although it may still fail, a Reachability notification that the connectivity is available is a good time to retry something.
-* Network reachability is a useful tool for determining why a request might have failed.
- * After a network request has failed, telling the user they're offline is better than giving them a more technical but accurate error, such as "request timed out."
-
-See also [WWDC 2012 session 706, "Networking Best Practices."](https://developer.apple.com/videos/play/wwdc2012-706/).
-
-#### Shared Network Reachability
-
-```objective-c
-[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
- NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
-}];
-
-[[AFNetworkReachabilityManager sharedManager] startMonitoring];
-```
-
----
-
-### Security Policy
-
-`AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
-
-Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
-
-#### Allowing Invalid SSL Certificates
-
-```objective-c
-AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
-manager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production
-```
-
----
-
-## Unit Tests
-
-AFNetworking includes a suite of unit tests within the Tests subdirectory. These tests can be run simply be executed the test action on the platform framework you would like to test.
-
-## Credits
-
-AFNetworking is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org).
-
-AFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://en.wikipedia.org/wiki/Gowalla).
-
-AFNetworking's logo was designed by [Alan Defibaugh](http://www.alandefibaugh.com/).
-
-And most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/contributors).
-
-### Security Disclosure
-
-If you believe you have identified a security vulnerability with AFNetworking, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.
-
-## License
-
-AFNetworking is released under the MIT license. See LICENSE for details.
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
deleted file mode 100644
index 9bdc15cc..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
+++ /dev/null
@@ -1,149 +0,0 @@
-// AFAutoPurgingImageCache.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously.
- */
-@protocol AFImageCache
-
-/**
- Adds the image to the cache with the given identifier.
-
- @param image The image to cache.
- @param identifier The unique identifier for the image in the cache.
- */
-- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier;
-
-/**
- Removes the image from the cache matching the given identifier.
-
- @param identifier The unique identifier for the image in the cache.
-
- @return A BOOL indicating whether or not the image was removed from the cache.
- */
-- (BOOL)removeImageWithIdentifier:(NSString *)identifier;
-
-/**
- Removes all images from the cache.
-
- @return A BOOL indicating whether or not all images were removed from the cache.
- */
-- (BOOL)removeAllImages;
-
-/**
- Returns the image in the cache associated with the given identifier.
-
- @param identifier The unique identifier for the image in the cache.
-
- @return An image for the matching identifier, or nil.
- */
-- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier;
-@end
-
-
-/**
- The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier.
- */
-@protocol AFImageRequestCache
-
-/**
- Adds the image to the cache using an identifier created from the request and additional identifier.
-
- @param image The image to cache.
- @param request The unique URL request identifing the image asset.
- @param identifier The additional identifier to apply to the URL request to identify the image.
- */
-- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
-
-/**
- Removes the image from the cache using an identifier created from the request and additional identifier.
-
- @param request The unique URL request identifing the image asset.
- @param identifier The additional identifier to apply to the URL request to identify the image.
-
- @return A BOOL indicating whether or not all images were removed from the cache.
- */
-- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
-
-/**
- Returns the image from the cache associated with an identifier created from the request and additional identifier.
-
- @param request The unique URL request identifing the image asset.
- @param identifier The additional identifier to apply to the URL request to identify the image.
-
- @return An image for the matching request and identifier, or nil.
- */
-- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
-
-@end
-
-/**
- The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated.
- */
-@interface AFAutoPurgingImageCache : NSObject
-
-/**
- The total memory capacity of the cache in bytes.
- */
-@property (nonatomic, assign) UInt64 memoryCapacity;
-
-/**
- The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit.
- */
-@property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge;
-
-/**
- The current total memory usage in bytes of all images stored within the cache.
- */
-@property (nonatomic, assign, readonly) UInt64 memoryUsage;
-
-/**
- Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`.
-
- @return The new `AutoPurgingImageCache` instance.
- */
-- (instancetype)init;
-
-/**
- Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage
- after purge limit.
-
- @param memoryCapacity The total memory capacity of the cache in bytes.
- @param preferredMemoryCapacity The preferred memory usage after purge in bytes.
-
- @return The new `AutoPurgingImageCache` instance.
- */
-- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
-
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m
deleted file mode 100644
index 1f40715c..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m
+++ /dev/null
@@ -1,201 +0,0 @@
-// AFAutoPurgingImageCache.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import "AFAutoPurgingImageCache.h"
-
-@interface AFCachedImage : NSObject
-
-@property (nonatomic, strong) UIImage *image;
-@property (nonatomic, strong) NSString *identifier;
-@property (nonatomic, assign) UInt64 totalBytes;
-@property (nonatomic, strong) NSDate *lastAccessDate;
-@property (nonatomic, assign) UInt64 currentMemoryUsage;
-
-@end
-
-@implementation AFCachedImage
-
--(instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier {
- if (self = [self init]) {
- self.image = image;
- self.identifier = identifier;
-
- CGSize imageSize = CGSizeMake(image.size.width * image.scale, image.size.height * image.scale);
- CGFloat bytesPerPixel = 4.0;
- CGFloat bytesPerSize = imageSize.width * imageSize.height;
- self.totalBytes = (UInt64)bytesPerPixel * (UInt64)bytesPerSize;
- self.lastAccessDate = [NSDate date];
- }
- return self;
-}
-
-- (UIImage*)accessImage {
- self.lastAccessDate = [NSDate date];
- return self.image;
-}
-
-- (NSString *)description {
- NSString *descriptionString = [NSString stringWithFormat:@"Idenfitier: %@ lastAccessDate: %@ ", self.identifier, self.lastAccessDate];
- return descriptionString;
-
-}
-
-@end
-
-@interface AFAutoPurgingImageCache ()
-@property (nonatomic, strong) NSMutableDictionary *cachedImages;
-@property (nonatomic, assign) UInt64 currentMemoryUsage;
-@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;
-@end
-
-@implementation AFAutoPurgingImageCache
-
-- (instancetype)init {
- return [self initWithMemoryCapacity:100 * 1024 * 1024 preferredMemoryCapacity:60 * 1024 * 1024];
-}
-
-- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity {
- if (self = [super init]) {
- self.memoryCapacity = memoryCapacity;
- self.preferredMemoryUsageAfterPurge = preferredMemoryCapacity;
- self.cachedImages = [[NSMutableDictionary alloc] init];
-
- NSString *queueName = [NSString stringWithFormat:@"com.alamofire.autopurgingimagecache-%@", [[NSUUID UUID] UUIDString]];
- self.synchronizationQueue = dispatch_queue_create([queueName cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);
-
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(removeAllImages)
- name:UIApplicationDidReceiveMemoryWarningNotification
- object:nil];
-
- }
- return self;
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-- (UInt64)memoryUsage {
- __block UInt64 result = 0;
- dispatch_sync(self.synchronizationQueue, ^{
- result = self.currentMemoryUsage;
- });
- return result;
-}
-
-- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier {
- dispatch_barrier_async(self.synchronizationQueue, ^{
- AFCachedImage *cacheImage = [[AFCachedImage alloc] initWithImage:image identifier:identifier];
-
- AFCachedImage *previousCachedImage = self.cachedImages[identifier];
- if (previousCachedImage != nil) {
- self.currentMemoryUsage -= previousCachedImage.totalBytes;
- }
-
- self.cachedImages[identifier] = cacheImage;
- self.currentMemoryUsage += cacheImage.totalBytes;
- });
-
- dispatch_barrier_async(self.synchronizationQueue, ^{
- if (self.currentMemoryUsage > self.memoryCapacity) {
- UInt64 bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge;
- NSMutableArray *sortedImages = [NSMutableArray arrayWithArray:self.cachedImages.allValues];
- NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastAccessDate"
- ascending:YES];
- [sortedImages sortUsingDescriptors:@[sortDescriptor]];
-
- UInt64 bytesPurged = 0;
-
- for (AFCachedImage *cachedImage in sortedImages) {
- [self.cachedImages removeObjectForKey:cachedImage.identifier];
- bytesPurged += cachedImage.totalBytes;
- if (bytesPurged >= bytesToPurge) {
- break ;
- }
- }
- self.currentMemoryUsage -= bytesPurged;
- }
- });
-}
-
-- (BOOL)removeImageWithIdentifier:(NSString *)identifier {
- __block BOOL removed = NO;
- dispatch_barrier_sync(self.synchronizationQueue, ^{
- AFCachedImage *cachedImage = self.cachedImages[identifier];
- if (cachedImage != nil) {
- [self.cachedImages removeObjectForKey:identifier];
- self.currentMemoryUsage -= cachedImage.totalBytes;
- removed = YES;
- }
- });
- return removed;
-}
-
-- (BOOL)removeAllImages {
- __block BOOL removed = NO;
- dispatch_barrier_sync(self.synchronizationQueue, ^{
- if (self.cachedImages.count > 0) {
- [self.cachedImages removeAllObjects];
- self.currentMemoryUsage = 0;
- removed = YES;
- }
- });
- return removed;
-}
-
-- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier {
- __block UIImage *image = nil;
- dispatch_sync(self.synchronizationQueue, ^{
- AFCachedImage *cachedImage = self.cachedImages[identifier];
- image = [cachedImage accessImage];
- });
- return image;
-}
-
-- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
- [self addImage:image withIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
-}
-
-- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
- return [self removeImageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
-}
-
-- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
- return [self imageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]];
-}
-
-- (NSString *)imageCacheKeyFromURLRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)additionalIdentifier {
- NSString *key = request.URL.absoluteString;
- if (additionalIdentifier != nil) {
- key = [key stringByAppendingString:additionalIdentifier];
- }
- return key;
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
deleted file mode 100644
index 3903eec2..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
+++ /dev/null
@@ -1,157 +0,0 @@
-// AFImageDownloader.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import
-#import "AFAutoPurgingImageCache.h"
-#import "AFHTTPSessionManager.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
- AFImageDownloadPrioritizationFIFO,
- AFImageDownloadPrioritizationLIFO
-};
-
-/**
- The `AFImageDownloadReceipt` is an object vended by the `AFImageDownloader` when starting a data task. It can be used to cancel active tasks running on the `AFImageDownloader` session. As a general rule, image data tasks should be cancelled using the `AFImageDownloadReceipt` instead of calling `cancel` directly on the `task` itself. The `AFImageDownloader` is optimized to handle duplicate task scenarios as well as pending versus active downloads.
- */
-@interface AFImageDownloadReceipt : NSObject
-
-/**
- The data task created by the `AFImageDownloader`.
-*/
-@property (nonatomic, strong) NSURLSessionDataTask *task;
-
-/**
- The unique identifier for the success and failure blocks when duplicate requests are made.
- */
-@property (nonatomic, strong) NSUUID *receiptID;
-@end
-
-/** The `AFImageDownloader` class is responsible for downloading images in parallel on a prioritized queue. Incoming downloads are added to the front or back of the queue depending on the download prioritization. Each downloaded image is cached in the underlying `NSURLCache` as well as the in-memory image cache. By default, any download request with a cached image equivalent in the image cache will automatically be served the cached image representation.
- */
-@interface AFImageDownloader : NSObject
-
-/**
- The image cache used to store all downloaded images in. `AFAutoPurgingImageCache` by default.
- */
-@property (nonatomic, strong, nullable) id imageCache;
-
-/**
- The `AFHTTPSessionManager` used to download images. By default, this is configured with an `AFImageResponseSerializer`, and a shared `NSURLCache` for all image downloads.
- */
-@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
-
-/**
- Defines the order prioritization of incoming download requests being inserted into the queue. `AFImageDownloadPrioritizationFIFO` by default.
- */
-@property (nonatomic, assign) AFImageDownloadPrioritization downloadPrioritizaton;
-
-/**
- The shared default instance of `AFImageDownloader` initialized with default values.
- */
-+ (instancetype)defaultInstance;
-
-/**
- Creates a default `NSURLCache` with common usage parameter values.
-
- @returns The default `NSURLCache` instance.
- */
-+ (NSURLCache *)defaultURLCache;
-
-/**
- Default initializer
-
- @return An instance of `AFImageDownloader` initialized with default values.
- */
-- (instancetype)init;
-
-/**
- Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache.
-
- @param sessionManager The session manager to use to download images.
- @param downloadPrioritization The download prioritization of the download queue.
- @param maximumActiveDownloads The maximum number of active downloads allowed at any given time. Recommend `4`.
- @param imageCache The image cache used to store all downloaded images in.
-
- @return The new `AFImageDownloader` instance.
- */
-- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager
- downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization
- maximumActiveDownloads:(NSInteger)maximumActiveDownloads
- imageCache:(nullable id )imageCache;
-
-/**
- Creates a data task using the `sessionManager` instance for the specified URL request.
-
- If the same data task is already in the queue or currently being downloaded, the success and failure blocks are
- appended to the already existing task. Once the task completes, all success or failure blocks attached to the
- task are executed in the order they were added.
-
- @param request The URL request.
- @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
- @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
-
- @return The image download receipt for the data task if available. `nil` if the image is stored in the cache.
- cache and the URL request cache policy allows the cache to be used.
- */
-- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
-
-/**
- Creates a data task using the `sessionManager` instance for the specified URL request.
-
- If the same data task is already in the queue or currently being downloaded, the success and failure blocks are
- appended to the already existing task. Once the task completes, all success or failure blocks attached to the
- task are executed in the order they were added.
-
- @param request The URL request.
- @param receiptID The identifier to use for the download receipt that will be created for this request. This must be a unique identifier that does not represent any other request.
- @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
- @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
-
- @return The image download receipt for the data task if available. `nil` if the image is stored in the cache.
- cache and the URL request cache policy allows the cache to be used.
- */
-- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
- withReceiptID:(NSUUID *)receiptID
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
-
-/**
- Cancels the data task in the receipt by removing the corresponding success and failure blocks and cancelling the data task if necessary.
-
- If the data task is pending in the queue, it will be cancelled if no other success and failure blocks are registered with the data task. If the data task is currently executing or is already completed, the success and failure blocks are removed and will not be called when the task finishes.
-
- @param imageDownloadReceipt The image download receipt to cancel.
- */
-- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt;
-
-@end
-
-#endif
-
-NS_ASSUME_NONNULL_END
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m
deleted file mode 100644
index 78477bf6..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m
+++ /dev/null
@@ -1,391 +0,0 @@
-// AFImageDownloader.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import "AFImageDownloader.h"
-#import "AFHTTPSessionManager.h"
-
-@interface AFImageDownloaderResponseHandler : NSObject
-@property (nonatomic, strong) NSUUID *uuid;
-@property (nonatomic, copy) void (^successBlock)(NSURLRequest*, NSHTTPURLResponse*, UIImage*);
-@property (nonatomic, copy) void (^failureBlock)(NSURLRequest*, NSHTTPURLResponse*, NSError*);
-@end
-
-@implementation AFImageDownloaderResponseHandler
-
-- (instancetype)initWithUUID:(NSUUID *)uuid
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure {
- if (self = [self init]) {
- self.uuid = uuid;
- self.successBlock = success;
- self.failureBlock = failure;
- }
- return self;
-}
-
-- (NSString *)description {
- return [NSString stringWithFormat: @"UUID: %@", [self.uuid UUIDString]];
-}
-
-@end
-
-@interface AFImageDownloaderMergedTask : NSObject
-@property (nonatomic, strong) NSString *URLIdentifier;
-@property (nonatomic, strong) NSUUID *identifier;
-@property (nonatomic, strong) NSURLSessionDataTask *task;
-@property (nonatomic, strong) NSMutableArray *responseHandlers;
-
-@end
-
-@implementation AFImageDownloaderMergedTask
-
-- (instancetype)initWithURLIdentifier:(NSString *)URLIdentifier identifier:(NSUUID *)identifier task:(NSURLSessionDataTask *)task {
- if (self = [self init]) {
- self.URLIdentifier = URLIdentifier;
- self.task = task;
- self.identifier = identifier;
- self.responseHandlers = [[NSMutableArray alloc] init];
- }
- return self;
-}
-
-- (void)addResponseHandler:(AFImageDownloaderResponseHandler*)handler {
- [self.responseHandlers addObject:handler];
-}
-
-- (void)removeResponseHandler:(AFImageDownloaderResponseHandler*)handler {
- [self.responseHandlers removeObject:handler];
-}
-
-@end
-
-@implementation AFImageDownloadReceipt
-
-- (instancetype)initWithReceiptID:(NSUUID *)receiptID task:(NSURLSessionDataTask *)task {
- if (self = [self init]) {
- self.receiptID = receiptID;
- self.task = task;
- }
- return self;
-}
-
-@end
-
-@interface AFImageDownloader ()
-
-@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;
-@property (nonatomic, strong) dispatch_queue_t responseQueue;
-
-@property (nonatomic, assign) NSInteger maximumActiveDownloads;
-@property (nonatomic, assign) NSInteger activeRequestCount;
-
-@property (nonatomic, strong) NSMutableArray *queuedMergedTasks;
-@property (nonatomic, strong) NSMutableDictionary *mergedTasks;
-
-@end
-
-
-@implementation AFImageDownloader
-
-+ (NSURLCache *)defaultURLCache {
- return [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024
- diskCapacity:150 * 1024 * 1024
- diskPath:@"com.alamofire.imagedownloader"];
-}
-
-+ (NSURLSessionConfiguration *)defaultURLSessionConfiguration {
- NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
-
- //TODO set the default HTTP headers
-
- configuration.HTTPShouldSetCookies = YES;
- configuration.HTTPShouldUsePipelining = NO;
-
- configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;
- configuration.allowsCellularAccess = YES;
- configuration.timeoutIntervalForRequest = 60.0;
- configuration.URLCache = [AFImageDownloader defaultURLCache];
-
- return configuration;
-}
-
-- (instancetype)init {
- NSURLSessionConfiguration *defaultConfiguration = [self.class defaultURLSessionConfiguration];
- AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:defaultConfiguration];
- sessionManager.responseSerializer = [AFImageResponseSerializer serializer];
-
- return [self initWithSessionManager:sessionManager
- downloadPrioritization:AFImageDownloadPrioritizationFIFO
- maximumActiveDownloads:4
- imageCache:[[AFAutoPurgingImageCache alloc] init]];
-}
-
-- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager
- downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization
- maximumActiveDownloads:(NSInteger)maximumActiveDownloads
- imageCache:(id )imageCache {
- if (self = [super init]) {
- self.sessionManager = sessionManager;
-
- self.downloadPrioritizaton = downloadPrioritization;
- self.maximumActiveDownloads = maximumActiveDownloads;
- self.imageCache = imageCache;
-
- self.queuedMergedTasks = [[NSMutableArray alloc] init];
- self.mergedTasks = [[NSMutableDictionary alloc] init];
- self.activeRequestCount = 0;
-
- NSString *name = [NSString stringWithFormat:@"com.alamofire.imagedownloader.synchronizationqueue-%@", [[NSUUID UUID] UUIDString]];
- self.synchronizationQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_SERIAL);
-
- name = [NSString stringWithFormat:@"com.alamofire.imagedownloader.responsequeue-%@", [[NSUUID UUID] UUIDString]];
- self.responseQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT);
- }
-
- return self;
-}
-
-+ (instancetype)defaultInstance {
- static AFImageDownloader *sharedInstance = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- sharedInstance = [[self alloc] init];
- });
- return sharedInstance;
-}
-
-- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
- success:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, UIImage * _Nonnull))success
- failure:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, NSError * _Nonnull))failure {
- return [self downloadImageForURLRequest:request withReceiptID:[NSUUID UUID] success:success failure:failure];
-}
-
-- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request
- withReceiptID:(nonnull NSUUID *)receiptID
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure {
- __block NSURLSessionDataTask *task = nil;
- dispatch_sync(self.synchronizationQueue, ^{
- NSString *URLIdentifier = request.URL.absoluteString;
- if (URLIdentifier == nil) {
- if (failure) {
- NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:nil];
- dispatch_async(dispatch_get_main_queue(), ^{
- failure(request, nil, error);
- });
- }
- return;
- }
-
- // 1) Append the success and failure blocks to a pre-existing request if it already exists
- AFImageDownloaderMergedTask *existingMergedTask = self.mergedTasks[URLIdentifier];
- if (existingMergedTask != nil) {
- AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID success:success failure:failure];
- [existingMergedTask addResponseHandler:handler];
- task = existingMergedTask.task;
- return;
- }
-
- // 2) Attempt to load the image from the image cache if the cache policy allows it
- switch (request.cachePolicy) {
- case NSURLRequestUseProtocolCachePolicy:
- case NSURLRequestReturnCacheDataElseLoad:
- case NSURLRequestReturnCacheDataDontLoad: {
- UIImage *cachedImage = [self.imageCache imageforRequest:request withAdditionalIdentifier:nil];
- if (cachedImage != nil) {
- if (success) {
- dispatch_async(dispatch_get_main_queue(), ^{
- success(request, nil, cachedImage);
- });
- }
- return;
- }
- break;
- }
- default:
- break;
- }
-
- // 3) Create the request and set up authentication, validation and response serialization
- NSUUID *mergedTaskIdentifier = [NSUUID UUID];
- NSURLSessionDataTask *createdTask;
- __weak __typeof__(self) weakSelf = self;
-
- createdTask = [self.sessionManager
- dataTaskWithRequest:request
- completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
- dispatch_async(self.responseQueue, ^{
- __strong __typeof__(weakSelf) strongSelf = weakSelf;
- AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
- if ([mergedTask.identifier isEqual:mergedTaskIdentifier]) {
- mergedTask = [strongSelf safelyRemoveMergedTaskWithURLIdentifier:URLIdentifier];
- if (error) {
- for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
- if (handler.failureBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- handler.failureBlock(request, (NSHTTPURLResponse*)response, error);
- });
- }
- }
- } else {
- [strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];
-
- for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
- if (handler.successBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- handler.successBlock(request, (NSHTTPURLResponse*)response, responseObject);
- });
- }
- }
-
- }
- }
- [strongSelf safelyDecrementActiveTaskCount];
- [strongSelf safelyStartNextTaskIfNecessary];
- });
- }];
-
- // 4) Store the response handler for use when the request completes
- AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID
- success:success
- failure:failure];
- AFImageDownloaderMergedTask *mergedTask = [[AFImageDownloaderMergedTask alloc]
- initWithURLIdentifier:URLIdentifier
- identifier:mergedTaskIdentifier
- task:createdTask];
- [mergedTask addResponseHandler:handler];
- self.mergedTasks[URLIdentifier] = mergedTask;
-
- // 5) Either start the request or enqueue it depending on the current active request count
- if ([self isActiveRequestCountBelowMaximumLimit]) {
- [self startMergedTask:mergedTask];
- } else {
- [self enqueueMergedTask:mergedTask];
- }
-
- task = mergedTask.task;
- });
- if (task) {
- return [[AFImageDownloadReceipt alloc] initWithReceiptID:receiptID task:task];
- } else {
- return nil;
- }
-}
-
-- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {
- dispatch_sync(self.synchronizationQueue, ^{
- NSString *URLIdentifier = imageDownloadReceipt.task.originalRequest.URL.absoluteString;
- AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
- NSUInteger index = [mergedTask.responseHandlers indexOfObjectPassingTest:^BOOL(AFImageDownloaderResponseHandler * _Nonnull handler, __unused NSUInteger idx, __unused BOOL * _Nonnull stop) {
- return handler.uuid == imageDownloadReceipt.receiptID;
- }];
-
- if (index != NSNotFound) {
- AFImageDownloaderResponseHandler *handler = mergedTask.responseHandlers[index];
- [mergedTask removeResponseHandler:handler];
- NSString *failureReason = [NSString stringWithFormat:@"ImageDownloader cancelled URL request: %@",imageDownloadReceipt.task.originalRequest.URL.absoluteString];
- NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey:failureReason};
- NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo];
- if (handler.failureBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- handler.failureBlock(imageDownloadReceipt.task.originalRequest, nil, error);
- });
- }
- }
-
- if (mergedTask.responseHandlers.count == 0 && mergedTask.task.state == NSURLSessionTaskStateSuspended) {
- [mergedTask.task cancel];
- [self removeMergedTaskWithURLIdentifier:URLIdentifier];
- }
- });
-}
-
-- (AFImageDownloaderMergedTask*)safelyRemoveMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {
- __block AFImageDownloaderMergedTask *mergedTask = nil;
- dispatch_sync(self.synchronizationQueue, ^{
- mergedTask = [self removeMergedTaskWithURLIdentifier:URLIdentifier];
- });
- return mergedTask;
-}
-
-//This method should only be called from safely within the synchronizationQueue
-- (AFImageDownloaderMergedTask *)removeMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {
- AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
- [self.mergedTasks removeObjectForKey:URLIdentifier];
- return mergedTask;
-}
-
-- (void)safelyDecrementActiveTaskCount {
- dispatch_sync(self.synchronizationQueue, ^{
- if (self.activeRequestCount > 0) {
- self.activeRequestCount -= 1;
- }
- });
-}
-
-- (void)safelyStartNextTaskIfNecessary {
- dispatch_sync(self.synchronizationQueue, ^{
- if ([self isActiveRequestCountBelowMaximumLimit]) {
- while (self.queuedMergedTasks.count > 0) {
- AFImageDownloaderMergedTask *mergedTask = [self dequeueMergedTask];
- if (mergedTask.task.state == NSURLSessionTaskStateSuspended) {
- [self startMergedTask:mergedTask];
- break;
- }
- }
- }
- });
-}
-
-- (void)startMergedTask:(AFImageDownloaderMergedTask *)mergedTask {
- [mergedTask.task resume];
- ++self.activeRequestCount;
-}
-
-- (void)enqueueMergedTask:(AFImageDownloaderMergedTask *)mergedTask {
- switch (self.downloadPrioritizaton) {
- case AFImageDownloadPrioritizationFIFO:
- [self.queuedMergedTasks addObject:mergedTask];
- break;
- case AFImageDownloadPrioritizationLIFO:
- [self.queuedMergedTasks insertObject:mergedTask atIndex:0];
- break;
- }
-}
-
-- (AFImageDownloaderMergedTask *)dequeueMergedTask {
- AFImageDownloaderMergedTask *mergedTask = nil;
- mergedTask = [self.queuedMergedTasks firstObject];
- [self.queuedMergedTasks removeObject:mergedTask];
- return mergedTask;
-}
-
-- (BOOL)isActiveRequestCountBelowMaximumLimit {
- return self.activeRequestCount < self.maximumActiveDownloads;
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
deleted file mode 100644
index 3bcf2895..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// AFNetworkActivityIndicatorManager.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS
-
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero.
-
- You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code:
-
- [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
-
- By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself.
-
- See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information:
- http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44
- */
-NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.")
-@interface AFNetworkActivityIndicatorManager : NSObject
-
-/**
- A Boolean value indicating whether the manager is enabled.
-
- If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.
- */
-@property (nonatomic, assign, getter = isEnabled) BOOL enabled;
-
-/**
- A Boolean value indicating whether the network activity indicator manager is currently active.
-*/
-@property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;
-
-/**
- A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds.
-
- Apple's HIG describes the following:
-
- > Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence.
-
- */
-@property (nonatomic, assign) NSTimeInterval activationDelay;
-
-/**
- A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds.
- */
-
-@property (nonatomic, assign) NSTimeInterval completionDelay;
-
-/**
- Returns the shared network activity indicator manager object for the system.
-
- @return The systemwide network activity indicator manager.
- */
-+ (instancetype)sharedManager;
-
-/**
- Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
- */
-- (void)incrementActivityCount;
-
-/**
- Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator.
- */
-- (void)decrementActivityCount;
-
-/**
- Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward.
-
- @param block A block to be executed when the network activity indicator status changes.
- */
-- (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m
deleted file mode 100644
index e77508e0..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m
+++ /dev/null
@@ -1,261 +0,0 @@
-// AFNetworkActivityIndicatorManager.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "AFNetworkActivityIndicatorManager.h"
-
-#if TARGET_OS_IOS
-#import "AFURLSessionManager.h"
-
-typedef NS_ENUM(NSInteger, AFNetworkActivityManagerState) {
- AFNetworkActivityManagerStateNotActive,
- AFNetworkActivityManagerStateDelayingStart,
- AFNetworkActivityManagerStateActive,
- AFNetworkActivityManagerStateDelayingEnd
-};
-
-static NSTimeInterval const kDefaultAFNetworkActivityManagerActivationDelay = 1.0;
-static NSTimeInterval const kDefaultAFNetworkActivityManagerCompletionDelay = 0.17;
-
-static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) {
- if ([[notification object] respondsToSelector:@selector(originalRequest)]) {
- return [(NSURLSessionTask *)[notification object] originalRequest];
- } else {
- return nil;
- }
-}
-
-typedef void (^AFNetworkActivityActionBlock)(BOOL networkActivityIndicatorVisible);
-
-@interface AFNetworkActivityIndicatorManager ()
-@property (readwrite, nonatomic, assign) NSInteger activityCount;
-@property (readwrite, nonatomic, strong) NSTimer *activationDelayTimer;
-@property (readwrite, nonatomic, strong) NSTimer *completionDelayTimer;
-@property (readonly, nonatomic, getter = isNetworkActivityOccurring) BOOL networkActivityOccurring;
-@property (nonatomic, copy) AFNetworkActivityActionBlock networkActivityActionBlock;
-@property (nonatomic, assign) AFNetworkActivityManagerState currentState;
-@property (nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible;
-
-- (void)updateCurrentStateForNetworkActivityChange;
-@end
-
-@implementation AFNetworkActivityIndicatorManager
-
-+ (instancetype)sharedManager {
- static AFNetworkActivityIndicatorManager *_sharedManager = nil;
- static dispatch_once_t oncePredicate;
- dispatch_once(&oncePredicate, ^{
- _sharedManager = [[self alloc] init];
- });
-
- return _sharedManager;
-}
-
-- (instancetype)init {
- self = [super init];
- if (!self) {
- return nil;
- }
- self.currentState = AFNetworkActivityManagerStateNotActive;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil];
- self.activationDelay = kDefaultAFNetworkActivityManagerActivationDelay;
- self.completionDelay = kDefaultAFNetworkActivityManagerCompletionDelay;
-
- return self;
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [_activationDelayTimer invalidate];
- [_completionDelayTimer invalidate];
-}
-
-- (void)setEnabled:(BOOL)enabled {
- _enabled = enabled;
- if (enabled == NO) {
- [self setCurrentState:AFNetworkActivityManagerStateNotActive];
- }
-}
-
-- (void)setNetworkingActivityActionWithBlock:(void (^)(BOOL networkActivityIndicatorVisible))block {
- self.networkActivityActionBlock = block;
-}
-
-- (BOOL)isNetworkActivityOccurring {
- @synchronized(self) {
- return self.activityCount > 0;
- }
-}
-
-- (void)setNetworkActivityIndicatorVisible:(BOOL)networkActivityIndicatorVisible {
- if (_networkActivityIndicatorVisible != networkActivityIndicatorVisible) {
- [self willChangeValueForKey:@"networkActivityIndicatorVisible"];
- @synchronized(self) {
- _networkActivityIndicatorVisible = networkActivityIndicatorVisible;
- }
- [self didChangeValueForKey:@"networkActivityIndicatorVisible"];
- if (self.networkActivityActionBlock) {
- self.networkActivityActionBlock(networkActivityIndicatorVisible);
- } else {
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:networkActivityIndicatorVisible];
- }
- }
-}
-
-- (void)setActivityCount:(NSInteger)activityCount {
- @synchronized(self) {
- _activityCount = activityCount;
- }
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [self updateCurrentStateForNetworkActivityChange];
- });
-}
-
-- (void)incrementActivityCount {
- [self willChangeValueForKey:@"activityCount"];
- @synchronized(self) {
- _activityCount++;
- }
- [self didChangeValueForKey:@"activityCount"];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [self updateCurrentStateForNetworkActivityChange];
- });
-}
-
-- (void)decrementActivityCount {
- [self willChangeValueForKey:@"activityCount"];
- @synchronized(self) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- _activityCount = MAX(_activityCount - 1, 0);
-#pragma clang diagnostic pop
- }
- [self didChangeValueForKey:@"activityCount"];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [self updateCurrentStateForNetworkActivityChange];
- });
-}
-
-- (void)networkRequestDidStart:(NSNotification *)notification {
- if ([AFNetworkRequestFromNotification(notification) URL]) {
- [self incrementActivityCount];
- }
-}
-
-- (void)networkRequestDidFinish:(NSNotification *)notification {
- if ([AFNetworkRequestFromNotification(notification) URL]) {
- [self decrementActivityCount];
- }
-}
-
-#pragma mark - Internal State Management
-- (void)setCurrentState:(AFNetworkActivityManagerState)currentState {
- @synchronized(self) {
- if (_currentState != currentState) {
- [self willChangeValueForKey:@"currentState"];
- _currentState = currentState;
- switch (currentState) {
- case AFNetworkActivityManagerStateNotActive:
- [self cancelActivationDelayTimer];
- [self cancelCompletionDelayTimer];
- [self setNetworkActivityIndicatorVisible:NO];
- break;
- case AFNetworkActivityManagerStateDelayingStart:
- [self startActivationDelayTimer];
- break;
- case AFNetworkActivityManagerStateActive:
- [self cancelCompletionDelayTimer];
- [self setNetworkActivityIndicatorVisible:YES];
- break;
- case AFNetworkActivityManagerStateDelayingEnd:
- [self startCompletionDelayTimer];
- break;
- }
- }
- [self didChangeValueForKey:@"currentState"];
- }
-}
-
-- (void)updateCurrentStateForNetworkActivityChange {
- if (self.enabled) {
- switch (self.currentState) {
- case AFNetworkActivityManagerStateNotActive:
- if (self.isNetworkActivityOccurring) {
- [self setCurrentState:AFNetworkActivityManagerStateDelayingStart];
- }
- break;
- case AFNetworkActivityManagerStateDelayingStart:
- //No op. Let the delay timer finish out.
- break;
- case AFNetworkActivityManagerStateActive:
- if (!self.isNetworkActivityOccurring) {
- [self setCurrentState:AFNetworkActivityManagerStateDelayingEnd];
- }
- break;
- case AFNetworkActivityManagerStateDelayingEnd:
- if (self.isNetworkActivityOccurring) {
- [self setCurrentState:AFNetworkActivityManagerStateActive];
- }
- break;
- }
- }
-}
-
-- (void)startActivationDelayTimer {
- self.activationDelayTimer = [NSTimer
- timerWithTimeInterval:self.activationDelay target:self selector:@selector(activationDelayTimerFired) userInfo:nil repeats:NO];
- [[NSRunLoop mainRunLoop] addTimer:self.activationDelayTimer forMode:NSRunLoopCommonModes];
-}
-
-- (void)activationDelayTimerFired {
- if (self.networkActivityOccurring) {
- [self setCurrentState:AFNetworkActivityManagerStateActive];
- } else {
- [self setCurrentState:AFNetworkActivityManagerStateNotActive];
- }
-}
-
-- (void)startCompletionDelayTimer {
- [self.completionDelayTimer invalidate];
- self.completionDelayTimer = [NSTimer timerWithTimeInterval:self.completionDelay target:self selector:@selector(completionDelayTimerFired) userInfo:nil repeats:NO];
- [[NSRunLoop mainRunLoop] addTimer:self.completionDelayTimer forMode:NSRunLoopCommonModes];
-}
-
-- (void)completionDelayTimerFired {
- [self setCurrentState:AFNetworkActivityManagerStateNotActive];
-}
-
-- (void)cancelActivationDelayTimer {
- [self.activationDelayTimer invalidate];
-}
-
-- (void)cancelCompletionDelayTimer {
- [self.completionDelayTimer invalidate];
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
deleted file mode 100644
index d424c9b8..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// UIActivityIndicatorView+AFNetworking.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import
-
-/**
- This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task.
- */
-@interface UIActivityIndicatorView (AFNetworking)
-
-///----------------------------------
-/// @name Animating for Session Tasks
-///----------------------------------
-
-/**
- Binds the animating state to the state of the specified task.
-
- @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
- */
-- (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task;
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m
deleted file mode 100644
index ed704eda..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m
+++ /dev/null
@@ -1,124 +0,0 @@
-// UIActivityIndicatorView+AFNetworking.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "UIActivityIndicatorView+AFNetworking.h"
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import "AFURLSessionManager.h"
-
-@interface AFActivityIndicatorViewNotificationObserver : NSObject
-@property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView;
-- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView;
-
-- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task;
-
-@end
-
-@implementation UIActivityIndicatorView (AFNetworking)
-
-- (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver {
- AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));
- if (notificationObserver == nil) {
- notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self];
- objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- }
- return notificationObserver;
-}
-
-- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {
- [[self af_notificationObserver] setAnimatingWithStateOfTask:task];
-}
-
-@end
-
-@implementation AFActivityIndicatorViewNotificationObserver
-
-- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView
-{
- self = [super init];
- if (self) {
- _activityIndicatorView = activityIndicatorView;
- }
- return self;
-}
-
-- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task {
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
-
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
-
- if (task) {
- if (task.state != NSURLSessionTaskStateCompleted) {
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreceiver-is-weak"
-#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak"
- if (task.state == NSURLSessionTaskStateRunning) {
- [self.activityIndicatorView startAnimating];
- } else {
- [self.activityIndicatorView stopAnimating];
- }
-#pragma clang diagnostic pop
-
- [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task];
- [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task];
- [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task];
- }
- }
-}
-
-#pragma mark -
-
-- (void)af_startAnimating {
- dispatch_async(dispatch_get_main_queue(), ^{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreceiver-is-weak"
- [self.activityIndicatorView startAnimating];
-#pragma clang diagnostic pop
- });
-}
-
-- (void)af_stopAnimating {
- dispatch_async(dispatch_get_main_queue(), ^{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreceiver-is-weak"
- [self.activityIndicatorView stopAnimating];
-#pragma clang diagnostic pop
- });
-}
-
-#pragma mark -
-
-- (void)dealloc {
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
-
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
deleted file mode 100644
index d33e0d4a..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
+++ /dev/null
@@ -1,175 +0,0 @@
-// UIButton+AFNetworking.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class AFImageDownloader;
-
-/**
- This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL.
-
- @warning Compound values for control `state` (such as `UIControlStateHighlighted | UIControlStateDisabled`) are unsupported.
- */
-@interface UIButton (AFNetworking)
-
-///------------------------------------
-/// @name Accessing the Image Downloader
-///------------------------------------
-
-/**
- Set the shared image downloader used to download images.
-
- @param imageDownloader The shared image downloader used to download images.
-*/
-+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;
-
-/**
- The shared image downloader used to download images.
- */
-+ (AFImageDownloader *)sharedImageDownloader;
-
-///--------------------
-/// @name Setting Image
-///--------------------
-
-/**
- Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- @param state The control state.
- @param url The URL used for the image request.
- */
-- (void)setImageForState:(UIControlState)state
- withURL:(NSURL *)url;
-
-/**
- Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- @param state The control state.
- @param url The URL used for the image request.
- @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes.
- */
-- (void)setImageForState:(UIControlState)state
- withURL:(NSURL *)url
- placeholderImage:(nullable UIImage *)placeholderImage;
-
-/**
- Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setImage:forState:` is applied.
-
- @param state The control state.
- @param urlRequest The URL request used for the image request.
- @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes.
- @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
- @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
- */
-- (void)setImageForState:(UIControlState)state
- withURLRequest:(NSURLRequest *)urlRequest
- placeholderImage:(nullable UIImage *)placeholderImage
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
-
-
-///-------------------------------
-/// @name Setting Background Image
-///-------------------------------
-
-/**
- Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous background image request for the receiver will be cancelled.
-
- If the background image is cached locally, the background image is set immediately, otherwise the specified placeholder background image will be set immediately, and then the remote background image will be set once the request is finished.
-
- @param state The control state.
- @param url The URL used for the background image request.
- */
-- (void)setBackgroundImageForState:(UIControlState)state
- withURL:(NSURL *)url;
-
-/**
- Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- @param state The control state.
- @param url The URL used for the background image request.
- @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes.
- */
-- (void)setBackgroundImageForState:(UIControlState)state
- withURL:(NSURL *)url
- placeholderImage:(nullable UIImage *)placeholderImage;
-
-/**
- Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setBackgroundImage:forState:` is applied.
-
- @param state The control state.
- @param urlRequest The URL request used for the image request.
- @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes.
- @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
- @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
- */
-- (void)setBackgroundImageForState:(UIControlState)state
- withURLRequest:(NSURLRequest *)urlRequest
- placeholderImage:(nullable UIImage *)placeholderImage
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
-
-
-///------------------------------
-/// @name Canceling Image Loading
-///------------------------------
-
-/**
- Cancels any executing image task for the specified control state of the receiver, if one exists.
-
- @param state The control state.
- */
-- (void)cancelImageDownloadTaskForState:(UIControlState)state;
-
-/**
- Cancels any executing background image task for the specified control state of the receiver, if one exists.
-
- @param state The control state.
- */
-- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m
deleted file mode 100644
index 5bc49ddf..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m
+++ /dev/null
@@ -1,305 +0,0 @@
-// UIButton+AFNetworking.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "UIButton+AFNetworking.h"
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import "UIImageView+AFNetworking.h"
-#import "AFImageDownloader.h"
-
-@interface UIButton (_AFNetworking)
-@end
-
-@implementation UIButton (_AFNetworking)
-
-#pragma mark -
-
-static char AFImageDownloadReceiptNormal;
-static char AFImageDownloadReceiptHighlighted;
-static char AFImageDownloadReceiptSelected;
-static char AFImageDownloadReceiptDisabled;
-
-static const char * af_imageDownloadReceiptKeyForState(UIControlState state) {
- switch (state) {
- case UIControlStateHighlighted:
- return &AFImageDownloadReceiptHighlighted;
- case UIControlStateSelected:
- return &AFImageDownloadReceiptSelected;
- case UIControlStateDisabled:
- return &AFImageDownloadReceiptDisabled;
- case UIControlStateNormal:
- default:
- return &AFImageDownloadReceiptNormal;
- }
-}
-
-- (AFImageDownloadReceipt *)af_imageDownloadReceiptForState:(UIControlState)state {
- return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_imageDownloadReceiptKeyForState(state));
-}
-
-- (void)af_setImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt
- forState:(UIControlState)state
-{
- objc_setAssociatedObject(self, af_imageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-#pragma mark -
-
-static char AFBackgroundImageDownloadReceiptNormal;
-static char AFBackgroundImageDownloadReceiptHighlighted;
-static char AFBackgroundImageDownloadReceiptSelected;
-static char AFBackgroundImageDownloadReceiptDisabled;
-
-static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState state) {
- switch (state) {
- case UIControlStateHighlighted:
- return &AFBackgroundImageDownloadReceiptHighlighted;
- case UIControlStateSelected:
- return &AFBackgroundImageDownloadReceiptSelected;
- case UIControlStateDisabled:
- return &AFBackgroundImageDownloadReceiptDisabled;
- case UIControlStateNormal:
- default:
- return &AFBackgroundImageDownloadReceiptNormal;
- }
-}
-
-- (AFImageDownloadReceipt *)af_backgroundImageDownloadReceiptForState:(UIControlState)state {
- return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state));
-}
-
-- (void)af_setBackgroundImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt
- forState:(UIControlState)state
-{
- objc_setAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-@end
-
-#pragma mark -
-
-@implementation UIButton (AFNetworking)
-
-+ (AFImageDownloader *)sharedImageDownloader {
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
-#pragma clang diagnostic pop
-}
-
-+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
- objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-#pragma mark -
-
-- (void)setImageForState:(UIControlState)state
- withURL:(NSURL *)url
-{
- [self setImageForState:state withURL:url placeholderImage:nil];
-}
-
-- (void)setImageForState:(UIControlState)state
- withURL:(NSURL *)url
- placeholderImage:(UIImage *)placeholderImage
-{
- NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
- [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
-
- [self setImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
-}
-
-- (void)setImageForState:(UIControlState)state
- withURLRequest:(NSURLRequest *)urlRequest
- placeholderImage:(nullable UIImage *)placeholderImage
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
-{
- if ([self isActiveTaskURLEqualToURLRequest:urlRequest forState:state]) {
- return;
- }
-
- [self cancelImageDownloadTaskForState:state];
-
- AFImageDownloader *downloader = [[self class] sharedImageDownloader];
- id imageCache = downloader.imageCache;
-
- //Use the image from the image cache if it exists
- UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
- if (cachedImage) {
- if (success) {
- success(urlRequest, nil, cachedImage);
- } else {
- [self setImage:cachedImage forState:state];
- }
- [self af_setImageDownloadReceipt:nil forState:state];
- } else {
- if (placeholderImage) {
- [self setImage:placeholderImage forState:state];
- }
-
- __weak __typeof(self)weakSelf = self;
- NSUUID *downloadID = [NSUUID UUID];
- AFImageDownloadReceipt *receipt;
- receipt = [downloader
- downloadImageForURLRequest:urlRequest
- withReceiptID:downloadID
- success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
- if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
- if (success) {
- success(request, response, responseObject);
- } else if(responseObject) {
- [strongSelf setImage:responseObject forState:state];
- }
- [strongSelf af_setImageDownloadReceipt:nil forState:state];
- }
-
- }
- failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
- if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
- if (failure) {
- failure(request, response, error);
- }
- [strongSelf af_setImageDownloadReceipt:nil forState:state];
- }
- }];
-
- [self af_setImageDownloadReceipt:receipt forState:state];
- }
-}
-
-#pragma mark -
-
-- (void)setBackgroundImageForState:(UIControlState)state
- withURL:(NSURL *)url
-{
- [self setBackgroundImageForState:state withURL:url placeholderImage:nil];
-}
-
-- (void)setBackgroundImageForState:(UIControlState)state
- withURL:(NSURL *)url
- placeholderImage:(nullable UIImage *)placeholderImage
-{
- NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
- [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
-
- [self setBackgroundImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
-}
-
-- (void)setBackgroundImageForState:(UIControlState)state
- withURLRequest:(NSURLRequest *)urlRequest
- placeholderImage:(nullable UIImage *)placeholderImage
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
-{
- if ([self isActiveBackgroundTaskURLEqualToURLRequest:urlRequest forState:state]) {
- return;
- }
-
- [self cancelBackgroundImageDownloadTaskForState:state];
-
- AFImageDownloader *downloader = [[self class] sharedImageDownloader];
- id imageCache = downloader.imageCache;
-
- //Use the image from the image cache if it exists
- UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
- if (cachedImage) {
- if (success) {
- success(urlRequest, nil, cachedImage);
- } else {
- [self setBackgroundImage:cachedImage forState:state];
- }
- [self af_setBackgroundImageDownloadReceipt:nil forState:state];
- } else {
- if (placeholderImage) {
- [self setBackgroundImage:placeholderImage forState:state];
- }
-
- __weak __typeof(self)weakSelf = self;
- NSUUID *downloadID = [NSUUID UUID];
- AFImageDownloadReceipt *receipt;
- receipt = [downloader
- downloadImageForURLRequest:urlRequest
- withReceiptID:downloadID
- success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
- if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
- if (success) {
- success(request, response, responseObject);
- } else if(responseObject) {
- [strongSelf setBackgroundImage:responseObject forState:state];
- }
- [strongSelf af_setBackgroundImageDownloadReceipt:nil forState:state];
- }
-
- }
- failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
- if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
- if (failure) {
- failure(request, response, error);
- }
- [strongSelf af_setBackgroundImageDownloadReceipt:nil forState:state];
- }
- }];
-
- [self af_setBackgroundImageDownloadReceipt:receipt forState:state];
- }
-}
-
-#pragma mark -
-
-- (void)cancelImageDownloadTaskForState:(UIControlState)state {
- AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state];
- if (receipt != nil) {
- [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt];
- [self af_setImageDownloadReceipt:nil forState:state];
- }
-}
-
-- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state {
- AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state];
- if (receipt != nil) {
- [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt];
- [self af_setBackgroundImageDownloadReceipt:nil forState:state];
- }
-}
-
-- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state {
- AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state];
- return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
-}
-
-- (BOOL)isActiveBackgroundTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state {
- AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state];
- return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
-}
-
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h
deleted file mode 100644
index 14744cdd..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// UIImage+AFNetworking.h
-//
-//
-// Created by Paulo Ferreira on 08/07/15.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import
-
-@interface UIImage (AFNetworking)
-
-+ (UIImage*) safeImageWithData:(NSData*)data;
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
deleted file mode 100644
index 8929252e..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// UIImageView+AFNetworking.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class AFImageDownloader;
-
-/**
- This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL.
- */
-@interface UIImageView (AFNetworking)
-
-///------------------------------------
-/// @name Accessing the Image Downloader
-///------------------------------------
-
-/**
- Set the shared image downloader used to download images.
-
- @param imageDownloader The shared image downloader used to download images.
- */
-+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader;
-
-/**
- The shared image downloader used to download images.
- */
-+ (AFImageDownloader *)sharedImageDownloader;
-
-///--------------------
-/// @name Setting Image
-///--------------------
-
-/**
- Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
-
- @param url The URL used for the image request.
- */
-- (void)setImageWithURL:(NSURL *)url;
-
-/**
- Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
-
- @param url The URL used for the image request.
- @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
- */
-- (void)setImageWithURL:(NSURL *)url
- placeholderImage:(nullable UIImage *)placeholderImage;
-
-/**
- Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled.
-
- If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
-
- If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied.
-
- @param urlRequest The URL request used for the image request.
- @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
- @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`.
- @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
- */
-- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
- placeholderImage:(nullable UIImage *)placeholderImage
- success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
- failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure;
-
-/**
- Cancels any executing image operation for the receiver, if one exists.
- */
-- (void)cancelImageDownloadTask;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m
deleted file mode 100644
index 5934d681..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m
+++ /dev/null
@@ -1,161 +0,0 @@
-// UIImageView+AFNetworking.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "UIImageView+AFNetworking.h"
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import "AFImageDownloader.h"
-
-@interface UIImageView (_AFNetworking)
-@property (readwrite, nonatomic, strong, setter = af_setActiveImageDownloadReceipt:) AFImageDownloadReceipt *af_activeImageDownloadReceipt;
-@end
-
-@implementation UIImageView (_AFNetworking)
-
-- (AFImageDownloadReceipt *)af_activeImageDownloadReceipt {
- return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, @selector(af_activeImageDownloadReceipt));
-}
-
-- (void)af_setActiveImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt {
- objc_setAssociatedObject(self, @selector(af_activeImageDownloadReceipt), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-@end
-
-#pragma mark -
-
-@implementation UIImageView (AFNetworking)
-
-+ (AFImageDownloader *)sharedImageDownloader {
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
-#pragma clang diagnostic pop
-}
-
-+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
- objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-#pragma mark -
-
-- (void)setImageWithURL:(NSURL *)url {
- [self setImageWithURL:url placeholderImage:nil];
-}
-
-- (void)setImageWithURL:(NSURL *)url
- placeholderImage:(UIImage *)placeholderImage
-{
- NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
- [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
-
- [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
-}
-
-- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
- placeholderImage:(UIImage *)placeholderImage
- success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
- failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
-{
-
- if ([urlRequest URL] == nil) {
- [self cancelImageDownloadTask];
- self.image = placeholderImage;
- return;
- }
-
- if ([self isActiveTaskURLEqualToURLRequest:urlRequest]){
- return;
- }
-
- [self cancelImageDownloadTask];
-
- AFImageDownloader *downloader = [[self class] sharedImageDownloader];
- id imageCache = downloader.imageCache;
-
- //Use the image from the image cache if it exists
- UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil];
- if (cachedImage) {
- if (success) {
- success(urlRequest, nil, cachedImage);
- } else {
- self.image = cachedImage;
- }
- [self clearActiveDownloadInformation];
- } else {
- if (placeholderImage) {
- self.image = placeholderImage;
- }
-
- __weak __typeof(self)weakSelf = self;
- NSUUID *downloadID = [NSUUID UUID];
- AFImageDownloadReceipt *receipt;
- receipt = [downloader
- downloadImageForURLRequest:urlRequest
- withReceiptID:downloadID
- success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
- if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
- if (success) {
- success(request, response, responseObject);
- } else if(responseObject) {
- strongSelf.image = responseObject;
- }
- [strongSelf clearActiveDownloadInformation];
- }
-
- }
- failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
- __strong __typeof(weakSelf)strongSelf = weakSelf;
- if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
- if (failure) {
- failure(request, response, error);
- }
- [strongSelf clearActiveDownloadInformation];
- }
- }];
-
- self.af_activeImageDownloadReceipt = receipt;
- }
-}
-
-- (void)cancelImageDownloadTask {
- if (self.af_activeImageDownloadReceipt != nil) {
- [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:self.af_activeImageDownloadReceipt];
- [self clearActiveDownloadInformation];
- }
-}
-
-- (void)clearActiveDownloadInformation {
- self.af_activeImageDownloadReceipt = nil;
-}
-
-- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest {
- return [self.af_activeImageDownloadReceipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString];
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
deleted file mode 100644
index febacfc7..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// UIKit+AFNetworking.h
-//
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-#import
-
-#ifndef _UIKIT_AFNETWORKING_
- #define _UIKIT_AFNETWORKING_
-
-#if TARGET_OS_IOS
- #import "AFAutoPurgingImageCache.h"
- #import "AFImageDownloader.h"
- #import "AFNetworkActivityIndicatorManager.h"
- #import "UIRefreshControl+AFNetworking.h"
- #import "UIWebView+AFNetworking.h"
-#endif
-
- #import "UIActivityIndicatorView+AFNetworking.h"
- #import "UIButton+AFNetworking.h"
- #import "UIImageView+AFNetworking.h"
- #import "UIProgressView+AFNetworking.h"
-#endif /* _UIKIT_AFNETWORKING_ */
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
deleted file mode 100644
index 8ea0a731..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// UIProgressView+AFNetworking.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-
-/**
- This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task.
- */
-@interface UIProgressView (AFNetworking)
-
-///------------------------------------
-/// @name Setting Session Task Progress
-///------------------------------------
-
-/**
- Binds the progress to the upload progress of the specified session task.
-
- @param task The session task.
- @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.
- */
-- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
- animated:(BOOL)animated;
-
-/**
- Binds the progress to the download progress of the specified session task.
-
- @param task The session task.
- @param animated `YES` if the change should be animated, `NO` if the change should happen immediately.
- */
-- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
- animated:(BOOL)animated;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m
deleted file mode 100644
index 058755e2..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m
+++ /dev/null
@@ -1,118 +0,0 @@
-// UIProgressView+AFNetworking.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "UIProgressView+AFNetworking.h"
-
-#import
-
-#if TARGET_OS_IOS || TARGET_OS_TV
-
-#import "AFURLSessionManager.h"
-
-static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext;
-static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext;
-
-#pragma mark -
-
-@implementation UIProgressView (AFNetworking)
-
-- (BOOL)af_uploadProgressAnimated {
- return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue];
-}
-
-- (void)af_setUploadProgressAnimated:(BOOL)animated {
- objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (BOOL)af_downloadProgressAnimated {
- return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue];
-}
-
-- (void)af_setDownloadProgressAnimated:(BOOL)animated {
- objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-#pragma mark -
-
-- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task
- animated:(BOOL)animated
-{
- [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
- [task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext];
-
- [self af_setUploadProgressAnimated:animated];
-}
-
-- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task
- animated:(BOOL)animated
-{
- [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
- [task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext];
-
- [self af_setDownloadProgressAnimated:animated];
-}
-
-#pragma mark - NSKeyValueObserving
-
-- (void)observeValueForKeyPath:(NSString *)keyPath
- ofObject:(id)object
- change:(__unused NSDictionary *)change
- context:(void *)context
-{
- if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) {
- if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) {
- if ([object countOfBytesExpectedToSend] > 0) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated];
- });
- }
- }
-
- if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) {
- if ([object countOfBytesExpectedToReceive] > 0) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated];
- });
- }
- }
-
- if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) {
- if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) {
- @try {
- [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))];
-
- if (context == AFTaskCountOfBytesSentContext) {
- [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))];
- }
-
- if (context == AFTaskCountOfBytesReceivedContext) {
- [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))];
- }
- }
- @catch (NSException * __unused exception) {}
- }
- }
- }
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
deleted file mode 100644
index 215eafcf..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// UIRefreshControl+AFNetworking.m
-//
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS
-
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task.
- */
-@interface UIRefreshControl (AFNetworking)
-
-///-----------------------------------
-/// @name Refreshing for Session Tasks
-///-----------------------------------
-
-/**
- Binds the refreshing state to the state of the specified task.
-
- @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
- */
-- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m
deleted file mode 100644
index aba6d61e..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m
+++ /dev/null
@@ -1,122 +0,0 @@
-// UIRefreshControl+AFNetworking.m
-//
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "UIRefreshControl+AFNetworking.h"
-#import
-
-#if TARGET_OS_IOS
-
-#import "AFURLSessionManager.h"
-
-@interface AFRefreshControlNotificationObserver : NSObject
-@property (readonly, nonatomic, weak) UIRefreshControl *refreshControl;
-- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl;
-
-- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task;
-
-@end
-
-@implementation UIRefreshControl (AFNetworking)
-
-- (AFRefreshControlNotificationObserver *)af_notificationObserver {
- AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver));
- if (notificationObserver == nil) {
- notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self];
- objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- }
- return notificationObserver;
-}
-
-- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {
- [[self af_notificationObserver] setRefreshingWithStateOfTask:task];
-}
-
-@end
-
-@implementation AFRefreshControlNotificationObserver
-
-- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl
-{
- self = [super init];
- if (self) {
- _refreshControl = refreshControl;
- }
- return self;
-}
-
-- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task {
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
-
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
-
- if (task) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreceiver-is-weak"
-#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak"
- if (task.state == NSURLSessionTaskStateRunning) {
- [self.refreshControl beginRefreshing];
-
- [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task];
- [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task];
- [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task];
- } else {
- [self.refreshControl endRefreshing];
- }
-#pragma clang diagnostic pop
- }
-}
-
-#pragma mark -
-
-- (void)af_beginRefreshing {
- dispatch_async(dispatch_get_main_queue(), ^{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreceiver-is-weak"
- [self.refreshControl beginRefreshing];
-#pragma clang diagnostic pop
- });
-}
-
-- (void)af_endRefreshing {
- dispatch_async(dispatch_get_main_queue(), ^{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreceiver-is-weak"
- [self.refreshControl endRefreshing];
-#pragma clang diagnostic pop
- });
-}
-
-#pragma mark -
-
-- (void)dealloc {
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
-
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
- [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
-}
-
-@end
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
deleted file mode 100644
index b9a56af4..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// UIWebView+AFNetworking.h
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import
-
-#import
-
-#if TARGET_OS_IOS
-
-#import
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class AFHTTPSessionManager;
-
-/**
- This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling.
-
- @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly.
- */
-@interface UIWebView (AFNetworking)
-
-/**
- The session manager used to download all requests.
- */
-@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
-
-/**
- Asynchronously loads the specified request.
-
- @param request A URL request identifying the location of the content to load. This must not be `nil`.
- @param progress A progress object monitoring the current download progress.
- @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string.
- @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.
- */
-- (void)loadRequest:(NSURLRequest *)request
- progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
- success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success
- failure:(nullable void (^)(NSError *error))failure;
-
-/**
- Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding.
-
- @param request A URL request identifying the location of the content to load. This must not be `nil`.
- @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified.
- @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified.
-@param progress A progress object monitoring the current download progress.
- @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data.
- @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred.
- */
-- (void)loadRequest:(NSURLRequest *)request
- MIMEType:(nullable NSString *)MIMEType
- textEncodingName:(nullable NSString *)textEncodingName
- progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
- success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success
- failure:(nullable void (^)(NSError *error))failure;
-
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
diff --git a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m b/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m
deleted file mode 100644
index 751c499e..00000000
--- a/iOSProject/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m
+++ /dev/null
@@ -1,162 +0,0 @@
-// UIWebView+AFNetworking.m
-// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "UIWebView+AFNetworking.h"
-
-#import
-
-#if TARGET_OS_IOS
-
-#import "AFHTTPSessionManager.h"
-#import "AFURLResponseSerialization.h"
-#import "AFURLRequestSerialization.h"
-
-@interface UIWebView (_AFNetworking)
-@property (readwrite, nonatomic, strong, setter = af_setURLSessionTask:) NSURLSessionDataTask *af_URLSessionTask;
-@end
-
-@implementation UIWebView (_AFNetworking)
-
-- (NSURLSessionDataTask *)af_URLSessionTask {
- return (NSURLSessionDataTask *)objc_getAssociatedObject(self, @selector(af_URLSessionTask));
-}
-
-- (void)af_setURLSessionTask:(NSURLSessionDataTask *)af_URLSessionTask {
- objc_setAssociatedObject(self, @selector(af_URLSessionTask), af_URLSessionTask, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-@end
-
-#pragma mark -
-
-@implementation UIWebView (AFNetworking)
-
-- (AFHTTPSessionManager *)sessionManager {
- static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- _af_defaultHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
- _af_defaultHTTPSessionManager.requestSerializer = [AFHTTPRequestSerializer serializer];
- _af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
- });
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager;
-#pragma clang diagnostic pop
-}
-
-- (void)setSessionManager:(AFHTTPSessionManager *)sessionManager {
- objc_setAssociatedObject(self, @selector(sessionManager), sessionManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (AFHTTPResponseSerializer *)responseSerializer {
- static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer];
- });
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu"
- return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer;
-#pragma clang diagnostic pop
-}
-
-- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer {
- objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-#pragma mark -
-
-- (void)loadRequest:(NSURLRequest *)request
- progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
- success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success
- failure:(void (^)(NSError *error))failure
-{
- [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) {
- NSStringEncoding stringEncoding = NSUTF8StringEncoding;
- if (response.textEncodingName) {
- CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName);
- if (encoding != kCFStringEncodingInvalidId) {
- stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding);
- }
- }
-
- NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding];
- if (success) {
- string = success(response, string);
- }
-
- return [string dataUsingEncoding:stringEncoding];
- } failure:failure];
-}
-
-- (void)loadRequest:(NSURLRequest *)request
- MIMEType:(NSString *)MIMEType
- textEncodingName:(NSString *)textEncodingName
- progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress
- success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success
- failure:(void (^)(NSError *error))failure
-{
- NSParameterAssert(request);
-
- if (self.af_URLSessionTask.state == NSURLSessionTaskStateRunning || self.af_URLSessionTask.state == NSURLSessionTaskStateSuspended) {
- [self.af_URLSessionTask cancel];
- }
- self.af_URLSessionTask = nil;
-
- __weak __typeof(self)weakSelf = self;
- NSURLSessionDataTask *dataTask;
- dataTask = [self.sessionManager
- GET:request.URL.absoluteString
- parameters:nil
- progress:nil
- success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
- __strong __typeof(weakSelf) strongSelf = weakSelf;
- if (success) {
- success((NSHTTPURLResponse *)task.response, responseObject);
- }
- [strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[task.currentRequest URL]];
-
- if ([strongSelf.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
- [strongSelf.delegate webViewDidFinishLoad:strongSelf];
- }
- }
- failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
- if (failure) {
- failure(error);
- }
- }];
- self.af_URLSessionTask = dataTask;
- if (progress != nil) {
- *progress = [self.sessionManager downloadProgressForTask:dataTask];
- }
- [self.af_URLSessionTask resume];
-
- if ([self.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) {
- [self.delegate webViewDidStartLoad:self];
- }
-}
-
-@end
-
-#endif
\ No newline at end of file
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIAuthenticationDialog.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIAuthenticationDialog.h
deleted file mode 100644
index 6bbb2827..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIAuthenticationDialog.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// ASIAuthenticationDialog.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 21/08/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import
-#import
-@class ASIHTTPRequest;
-
-typedef enum _ASIAuthenticationType {
- ASIStandardAuthenticationType = 0,
- ASIProxyAuthenticationType = 1
-} ASIAuthenticationType;
-
-@interface ASIAutorotatingViewController : UIViewController
-@end
-
-@interface ASIAuthenticationDialog : ASIAutorotatingViewController {
- ASIHTTPRequest *request;
- ASIAuthenticationType type;
- UITableView *tableView;
- UIViewController *presentingController;
- BOOL didEnableRotationNotifications;
-}
-+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)request;
-+ (void)dismiss;
-
-@property (retain) ASIHTTPRequest *request;
-@property (assign) ASIAuthenticationType type;
-@property (assign) BOOL didEnableRotationNotifications;
-@property (retain, nonatomic) UIViewController *presentingController;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIAuthenticationDialog.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIAuthenticationDialog.m
deleted file mode 100644
index 7fb612ed..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIAuthenticationDialog.m
+++ /dev/null
@@ -1,520 +0,0 @@
-//
-// ASIAuthenticationDialog.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 21/08/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIAuthenticationDialog.h"
-#import "ASIHTTPRequest.h"
-#import
-
-static ASIAuthenticationDialog *sharedDialog = nil;
-BOOL isDismissing = NO;
-static NSMutableArray *requestsNeedingAuthentication = nil;
-
-static const NSUInteger kUsernameRow = 0;
-static const NSUInteger kUsernameSection = 0;
-static const NSUInteger kPasswordRow = 1;
-static const NSUInteger kPasswordSection = 0;
-static const NSUInteger kDomainRow = 0;
-static const NSUInteger kDomainSection = 1;
-
-
-@implementation ASIAutorotatingViewController
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
-{
- return YES;
-}
-
-@end
-
-
-@interface ASIAuthenticationDialog ()
-- (void)showTitle;
-- (void)show;
-- (NSArray *)requestsRequiringTheseCredentials;
-- (void)presentNextDialog;
-- (void)keyboardWillShow:(NSNotification *)notification;
-- (void)orientationChanged:(NSNotification *)notification;
-- (void)cancelAuthenticationFromDialog:(id)sender;
-- (void)loginWithCredentialsFromDialog:(id)sender;
-@property (retain) UITableView *tableView;
-@end
-
-@implementation ASIAuthenticationDialog
-
-#pragma mark init / dealloc
-
-+ (void)initialize
-{
- if (self == [ASIAuthenticationDialog class]) {
- requestsNeedingAuthentication = [[NSMutableArray array] retain];
- }
-}
-
-+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)theRequest
-{
- // No need for a lock here, this will always be called on the main thread
- if (!sharedDialog) {
- sharedDialog = [[self alloc] init];
- [sharedDialog setRequest:theRequest];
- if ([theRequest authenticationNeeded] == ASIProxyAuthenticationNeeded) {
- [sharedDialog setType:ASIProxyAuthenticationType];
- } else {
- [sharedDialog setType:ASIStandardAuthenticationType];
- }
- [sharedDialog show];
- } else {
- [requestsNeedingAuthentication addObject:theRequest];
- }
-}
-
-- (id)init
-{
- if ((self = [self initWithNibName:nil bundle:nil])) {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
-#endif
- if (![UIDevice currentDevice].generatesDeviceOrientationNotifications) {
- [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
- [self setDidEnableRotationNotifications:YES];
- }
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- }
-#endif
- }
- return self;
-}
-
-- (void)dealloc
-{
- if ([self didEnableRotationNotifications]) {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
- }
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
-
- [request release];
- [tableView release];
- [presentingController.view removeFromSuperview];
- [presentingController release];
- [super dealloc];
-}
-
-#pragma mark keyboard notifications
-
-- (void)keyboardWillShow:(NSNotification *)notification
-{
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
-#endif
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_2
- NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey];
-#else
- NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey];
-#endif
- CGRect keyboardBounds;
- [keyboardBoundsValue getValue:&keyboardBounds];
- UIEdgeInsets e = UIEdgeInsetsMake(0, 0, keyboardBounds.size.height, 0);
- [[self tableView] setScrollIndicatorInsets:e];
- [[self tableView] setContentInset:e];
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- }
-#endif
-}
-
-// Manually handles orientation changes on iPhone
-- (void)orientationChanged:(NSNotification *)notification
-{
- [self showTitle];
-
- UIInterfaceOrientation o = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
- CGFloat angle = 0;
- switch (o) {
- case UIDeviceOrientationLandscapeLeft: angle = 90; break;
- case UIDeviceOrientationLandscapeRight: angle = -90; break;
- case UIDeviceOrientationPortraitUpsideDown: angle = 180; break;
- default: break;
- }
-
- CGRect f = [[UIScreen mainScreen] applicationFrame];
-
- // Swap the frame height and width if necessary
- if (UIDeviceOrientationIsLandscape(o)) {
- CGFloat t;
- t = f.size.width;
- f.size.width = f.size.height;
- f.size.height = t;
- }
-
- CGAffineTransform previousTransform = self.view.layer.affineTransform;
- CGAffineTransform newTransform = CGAffineTransformMakeRotation((CGFloat)(angle * M_PI / 180.0));
-
- // Reset the transform so we can set the size
- self.view.layer.affineTransform = CGAffineTransformIdentity;
- self.view.frame = (CGRect){ { 0, 0 }, f.size};
-
- // Revert to the previous transform for correct animation
- self.view.layer.affineTransform = previousTransform;
-
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
-
- // Set the new transform
- self.view.layer.affineTransform = newTransform;
-
- // Fix the view origin
- self.view.frame = (CGRect){ { f.origin.x, f.origin.y },self.view.frame.size};
- [UIView commitAnimations];
-}
-
-#pragma mark utilities
-
-- (UIViewController *)presentingController
-{
- if (!presentingController) {
- presentingController = [[ASIAutorotatingViewController alloc] initWithNibName:nil bundle:nil];
-
- // Attach to the window, but don't interfere.
- UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
- [window addSubview:[presentingController view]];
- [[presentingController view] setFrame:CGRectZero];
- [[presentingController view] setUserInteractionEnabled:NO];
- }
-
- return presentingController;
-}
-
-- (UITextField *)textFieldInRow:(NSUInteger)row section:(NSUInteger)section
-{
- return [[[[[self tableView] cellForRowAtIndexPath:
- [NSIndexPath indexPathForRow:row inSection:section]]
- contentView] subviews] objectAtIndex:0];
-}
-
-- (UITextField *)usernameField
-{
- return [self textFieldInRow:kUsernameRow section:kUsernameSection];
-}
-
-- (UITextField *)passwordField
-{
- return [self textFieldInRow:kPasswordRow section:kPasswordSection];
-}
-
-- (UITextField *)domainField
-{
- return [self textFieldInRow:kDomainRow section:kDomainSection];
-}
-
-#pragma mark show / dismiss
-
-+ (void)dismiss
-{
- UIViewController* dismisser = nil;
- if ([sharedDialog respondsToSelector:@selector(presentingViewController)]){
- dismisser = [sharedDialog presentingViewController];
- }else{
- dismisser = [sharedDialog parentViewController];
- }
- if([dismisser respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]){
- [dismisser dismissViewControllerAnimated:YES completion:nil];
- }else{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- [dismisser dismissModalViewControllerAnimated:YES];
-#pragma clang diagnostic pop
- }
-}
-
-- (void)viewDidDisappear:(BOOL)animated
-{
- [self retain];
- [sharedDialog release];
- sharedDialog = nil;
- [self performSelector:@selector(presentNextDialog) withObject:nil afterDelay:0];
- [self release];
-}
-
-- (void)dismiss
-{
- if (self == sharedDialog) {
- [[self class] dismiss];
- } else {
- UIViewController* dismisser = nil;
- if ([self respondsToSelector:@selector(presentingViewController)]){
- dismisser = [self presentingViewController];
- }else{
- dismisser = [self parentViewController];
- }
- if([dismisser respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]){
- [dismisser dismissViewControllerAnimated:YES completion:nil];
- }else{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- [dismisser dismissModalViewControllerAnimated:YES];
-#pragma clang diagnostic pop
- }
- }
-}
-
-- (void)showTitle
-{
- UINavigationBar *navigationBar = [[[self view] subviews] objectAtIndex:0];
- UINavigationItem *navItem = [[navigationBar items] objectAtIndex:0];
- if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
- // Setup the title
- if ([self type] == ASIProxyAuthenticationType) {
- [navItem setPrompt:@"Login to this secure proxy server."];
- } else {
- [navItem setPrompt:@"Login to this secure server."];
- }
- } else {
- [navItem setPrompt:nil];
- }
- [navigationBar sizeToFit];
- CGRect f = [[self view] bounds];
- f.origin.y = [navigationBar frame].size.height;
- f.size.height -= f.origin.y;
- [[self tableView] setFrame:f];
-}
-
-- (void)show
-{
- // Remove all subviews
- UIView *v;
- while ((v = [[[self view] subviews] lastObject])) {
- [v removeFromSuperview];
- }
-
- // Setup toolbar
- UINavigationBar *bar = [[[UINavigationBar alloc] init] autorelease];
- [bar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
-
- UINavigationItem *navItem = [[[UINavigationItem alloc] init] autorelease];
- bar.items = [NSArray arrayWithObject:navItem];
-
- [[self view] addSubview:bar];
-
- [self showTitle];
-
- // Setup toolbar buttons
- if ([self type] == ASIProxyAuthenticationType) {
- [navItem setTitle:[[self request] proxyHost]];
- } else {
- [navItem setTitle:[[[self request] url] host]];
- }
-
- [navItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelAuthenticationFromDialog:)] autorelease]];
- [navItem setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleDone target:self action:@selector(loginWithCredentialsFromDialog:)] autorelease]];
-
- // We show the login form in a table view, similar to Safari's authentication dialog
- [bar sizeToFit];
- CGRect f = [[self view] bounds];
- f.origin.y = [bar frame].size.height;
- f.size.height -= f.origin.y;
-
- [self setTableView:[[[UITableView alloc] initWithFrame:f style:UITableViewStyleGrouped] autorelease]];
- [[self tableView] setDelegate:self];
- [[self tableView] setDataSource:self];
- [[self tableView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
- [[self view] addSubview:[self tableView]];
-
- // Force reload the table content, and focus the first field to show the keyboard
- [[self tableView] reloadData];
- [[[[[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].contentView subviews] objectAtIndex:0] becomeFirstResponder];
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
- [self setModalPresentationStyle:UIModalPresentationFormSheet];
- }
-#endif
-
- if([[self presentingController] respondsToSelector:@selector(presentViewController:animated:completion:)]){
- [[self presentingController] presentViewController:self animated:YES completion:nil];
- }else{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- [[self presentingController] presentModalViewController:self animated:YES];
-#pragma clang diagnostic pop
- }
-}
-
-#pragma mark button callbacks
-
-- (void)cancelAuthenticationFromDialog:(id)sender
-{
- for (ASIHTTPRequest *theRequest in [self requestsRequiringTheseCredentials]) {
- [theRequest cancelAuthentication];
- [requestsNeedingAuthentication removeObject:theRequest];
- }
- [self dismiss];
-}
-
-- (NSArray *)requestsRequiringTheseCredentials
-{
- NSMutableArray *requestsRequiringTheseCredentials = [NSMutableArray array];
- NSURL *requestURL = [[self request] url];
- for (ASIHTTPRequest *otherRequest in requestsNeedingAuthentication) {
- NSURL *theURL = [otherRequest url];
- if (([otherRequest authenticationNeeded] == [[self request] authenticationNeeded]) && [[theURL host] isEqualToString:[requestURL host]] && ([theURL port] == [requestURL port] || ([requestURL port] && [[theURL port] isEqualToNumber:[requestURL port]])) && [[theURL scheme] isEqualToString:[requestURL scheme]] && ((![otherRequest authenticationRealm] && ![[self request] authenticationRealm]) || ([otherRequest authenticationRealm] && [[self request] authenticationRealm] && [[[self request] authenticationRealm] isEqualToString:[otherRequest authenticationRealm]]))) {
- [requestsRequiringTheseCredentials addObject:otherRequest];
- }
- }
- [requestsRequiringTheseCredentials addObject:[self request]];
- return requestsRequiringTheseCredentials;
-}
-
-- (void)presentNextDialog
-{
- if ([requestsNeedingAuthentication count]) {
- ASIHTTPRequest *nextRequest = [requestsNeedingAuthentication objectAtIndex:0];
- [requestsNeedingAuthentication removeObjectAtIndex:0];
- [[self class] presentAuthenticationDialogForRequest:nextRequest];
- }
-}
-
-
-- (void)loginWithCredentialsFromDialog:(id)sender
-{
- for (ASIHTTPRequest *theRequest in [self requestsRequiringTheseCredentials]) {
-
- NSString *username = [[self usernameField] text];
- NSString *password = [[self passwordField] text];
-
- if (username == nil) { username = @""; }
- if (password == nil) { password = @""; }
-
- if ([self type] == ASIProxyAuthenticationType) {
- [theRequest setProxyUsername:username];
- [theRequest setProxyPassword:password];
- } else {
- [theRequest setUsername:username];
- [theRequest setPassword:password];
- }
-
- // Handle NTLM domains
- NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
- if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
- NSString *domain = [[self domainField] text];
- if ([self type] == ASIProxyAuthenticationType) {
- [theRequest setProxyDomain:domain];
- } else {
- [theRequest setDomain:domain];
- }
- }
-
- [theRequest retryUsingSuppliedCredentials];
- [requestsNeedingAuthentication removeObject:theRequest];
- }
- [self dismiss];
-}
-
-#pragma mark table view data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView
-{
- NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
- if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
- return 2;
- }
- return 1;
-}
-
-- (CGFloat)tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger)section
-{
- if (section == [self numberOfSectionsInTableView:aTableView]-1) {
- return 30;
- }
- return 0;
-}
-
-- (CGFloat)tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section
-{
- if (section == 0) {
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
- return 54;
- }
-#endif
- return 30;
- }
- return 0;
-}
-
-- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
-{
- if (section == 0) {
- return [[self request] authenticationRealm];
- }
- return nil;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0
- UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
-#else
- UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:nil] autorelease];
-#endif
-
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
-
- CGRect f = CGRectInset([cell bounds], 10, 10);
- UITextField *textField = [[[UITextField alloc] initWithFrame:f] autorelease];
- [textField setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
- [textField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
- [textField setAutocorrectionType:UITextAutocorrectionTypeNo];
-
- NSUInteger s = [indexPath section];
- NSUInteger r = [indexPath row];
-
- if (s == kUsernameSection && r == kUsernameRow) {
- [textField setPlaceholder:@"User"];
- } else if (s == kPasswordSection && r == kPasswordRow) {
- [textField setPlaceholder:@"Password"];
- [textField setSecureTextEntry:YES];
- } else if (s == kDomainSection && r == kDomainRow) {
- [textField setPlaceholder:@"Domain"];
- }
- [cell.contentView addSubview:textField];
-
- return cell;
-}
-
-- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
-{
- if (section == 0) {
- return 2;
- } else {
- return 1;
- }
-}
-
-- (NSString *)tableView:(UITableView *)aTableView titleForFooterInSection:(NSInteger)section
-{
- if (section == [self numberOfSectionsInTableView:aTableView]-1) {
- // If we're using Basic authentication and the connection is not using SSL, we'll show the plain text message
- if ([[[self request] authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && ![[[[self request] url] scheme] isEqualToString:@"https"]) {
- return @"Password will be sent in the clear.";
- // We are using Digest, NTLM, or any scheme over SSL
- } else {
- return @"Password will be sent securely.";
- }
- }
- return nil;
-}
-
-#pragma mark -
-
-@synthesize request;
-@synthesize type;
-@synthesize tableView;
-@synthesize didEnableRotationNotifications;
-@synthesize presentingController;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASICacheDelegate.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASICacheDelegate.h
deleted file mode 100644
index 060cda59..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASICacheDelegate.h
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// ASICacheDelegate.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 01/05/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-#import
-@class ASIHTTPRequest;
-
-// Cache policies control the behaviour of a cache and how requests use the cache
-// When setting a cache policy, you can use a combination of these values as a bitmask
-// For example: [request setCachePolicy:ASIAskServerIfModifiedCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy|ASIDoNotWriteToCacheCachePolicy];
-// Note that some of the behaviours below are mutally exclusive - you cannot combine ASIAskServerIfModifiedWhenStaleCachePolicy and ASIAskServerIfModifiedCachePolicy, for example.
-typedef enum _ASICachePolicy {
-
- // The default cache policy. When you set a request to use this, it will use the cache's defaultCachePolicy
- // ASIDownloadCache's default cache policy is 'ASIAskServerIfModifiedWhenStaleCachePolicy'
- ASIUseDefaultCachePolicy = 0,
-
- // Tell the request not to read from the cache
- ASIDoNotReadFromCacheCachePolicy = 1,
-
- // The the request not to write to the cache
- ASIDoNotWriteToCacheCachePolicy = 2,
-
- // Ask the server if there is an updated version of this resource (using a conditional GET) ONLY when the cached data is stale
- ASIAskServerIfModifiedWhenStaleCachePolicy = 4,
-
- // Always ask the server if there is an updated version of this resource (using a conditional GET)
- ASIAskServerIfModifiedCachePolicy = 8,
-
- // If cached data exists, use it even if it is stale. This means requests will not talk to the server unless the resource they are requesting is not in the cache
- ASIOnlyLoadIfNotCachedCachePolicy = 16,
-
- // If cached data exists, use it even if it is stale. If cached data does not exist, stop (will not set an error on the request)
- ASIDontLoadCachePolicy = 32,
-
- // Specifies that cached data may be used if the request fails. If cached data is used, the request will succeed without error. Usually used in combination with other options above.
- ASIFallbackToCacheIfLoadFailsCachePolicy = 64
-} ASICachePolicy;
-
-// Cache storage policies control whether cached data persists between application launches (ASICachePermanentlyCacheStoragePolicy) or not (ASICacheForSessionDurationCacheStoragePolicy)
-// Calling [ASIHTTPRequest clearSession] will remove any data stored using ASICacheForSessionDurationCacheStoragePolicy
-typedef enum _ASICacheStoragePolicy {
- ASICacheForSessionDurationCacheStoragePolicy = 0,
- ASICachePermanentlyCacheStoragePolicy = 1
-} ASICacheStoragePolicy;
-
-
-@protocol ASICacheDelegate
-
-@required
-
-// Should return the cache policy that will be used when requests have their cache policy set to ASIUseDefaultCachePolicy
-- (ASICachePolicy)defaultCachePolicy;
-
-// Returns the date a cached response should expire on. Pass a non-zero max age to specify a custom date.
-- (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Updates cached response headers with a new expiry date. Pass a non-zero max age to specify a custom date.
-- (void)updateExpiryForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Looks at the request's cache policy and any cached headers to determine if the cache data is still valid
-- (BOOL)canUseCachedDataForRequest:(ASIHTTPRequest *)request;
-
-// Removes cached data for a particular request
-- (void)removeCachedDataForRequest:(ASIHTTPRequest *)request;
-
-// Should return YES if the cache considers its cached response current for the request
-// Should return NO is the data is not cached, or (for example) if the cached headers state the request should have expired
-- (BOOL)isCachedDataCurrentForRequest:(ASIHTTPRequest *)request;
-
-// Should store the response for the passed request in the cache
-// When a non-zero maxAge is passed, it should be used as the expiry time for the cached response
-- (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Removes cached data for a particular url
-- (void)removeCachedDataForURL:(NSURL *)url;
-
-// Should return an NSDictionary of cached headers for the passed URL, if it is stored in the cache
-- (NSDictionary *)cachedResponseHeadersForURL:(NSURL *)url;
-
-// Should return the cached body of a response for the passed URL, if it is stored in the cache
-- (NSData *)cachedResponseDataForURL:(NSURL *)url;
-
-// Returns a path to the cached response data, if it exists
-- (NSString *)pathToCachedResponseDataForURL:(NSURL *)url;
-
-// Returns a path to the cached response headers, if they url
-- (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url;
-
-// Returns the location to use to store cached response headers for a particular request
-- (NSString *)pathToStoreCachedResponseHeadersForRequest:(ASIHTTPRequest *)request;
-
-// Returns the location to use to store a cached response body for a particular request
-- (NSString *)pathToStoreCachedResponseDataForRequest:(ASIHTTPRequest *)request;
-
-// Clear cached data stored for the passed storage policy
-- (void)clearCachedResponsesForStoragePolicy:(ASICacheStoragePolicy)cachePolicy;
-
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataCompressor.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataCompressor.h
deleted file mode 100644
index ae0e441a..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataCompressor.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// ASIDataCompressor.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 17/08/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-// This is a helper class used by ASIHTTPRequest to handle deflating (compressing) data in memory and on disk
-// You may also find it helpful if you need to deflate data and files yourself - see the class methods below
-// Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net
-
-#import
-#import
-
-@interface ASIDataCompressor : NSObject {
- BOOL streamReady;
- z_stream zStream;
-}
-
-// Convenience constructor will call setupStream for you
-+ (id)compressor;
-
-// Compress the passed chunk of data
-// Passing YES for shouldFinish will finalize the deflated data - you must pass YES when you are on the last chunk of data
-- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish;
-
-// Convenience method - pass it some data, and you'll get deflated data back
-+ (NSData *)compressData:(NSData*)uncompressedData error:(NSError **)err;
-
-// Convenience method - pass it a file containing the data to compress in sourcePath, and it will write deflated data to destinationPath
-+ (BOOL)compressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err;
-
-// Sets up zlib to handle the inflating. You only need to call this yourself if you aren't using the convenience constructor 'compressor'
-- (NSError *)setupStream;
-
-// Tells zlib to clean up. You need to call this if you need to cancel deflating part way through
-// If deflating finishes or fails, this method will be called automatically
-- (NSError *)closeStream;
-
-@property (assign, readonly) BOOL streamReady;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataCompressor.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataCompressor.m
deleted file mode 100644
index c9a5cd55..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataCompressor.m
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// ASIDataCompressor.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 17/08/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIDataCompressor.h"
-#import "ASIHTTPRequest.h"
-
-#define DATA_CHUNK_SIZE 262144 // Deal with gzipped data in 256KB chunks
-#define COMPRESSION_AMOUNT Z_DEFAULT_COMPRESSION
-
-@interface ASIDataCompressor ()
-+ (NSError *)deflateErrorWithCode:(int)code;
-@end
-
-@implementation ASIDataCompressor
-
-+ (id)compressor
-{
- ASIDataCompressor *compressor = [[[self alloc] init] autorelease];
- [compressor setupStream];
- return compressor;
-}
-
-- (void)dealloc
-{
- if (streamReady) {
- [self closeStream];
- }
- [super dealloc];
-}
-
-- (NSError *)setupStream
-{
- if (streamReady) {
- return nil;
- }
- // Setup the inflate stream
- zStream.zalloc = Z_NULL;
- zStream.zfree = Z_NULL;
- zStream.opaque = Z_NULL;
- zStream.avail_in = 0;
- zStream.next_in = 0;
- int status = deflateInit2(&zStream, COMPRESSION_AMOUNT, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY);
- if (status != Z_OK) {
- return [[self class] deflateErrorWithCode:status];
- }
- streamReady = YES;
- return nil;
-}
-
-- (NSError *)closeStream
-{
- if (!streamReady) {
- return nil;
- }
- // Close the deflate stream
- streamReady = NO;
- int status = deflateEnd(&zStream);
- if (status != Z_OK) {
- return [[self class] deflateErrorWithCode:status];
- }
- return nil;
-}
-
-- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err shouldFinish:(BOOL)shouldFinish
-{
- if (length == 0) return nil;
-
- NSUInteger halfLength = length/2;
-
- // We'll take a guess that the compressed data will fit in half the size of the original (ie the max to compress at once is half DATA_CHUNK_SIZE), if not, we'll increase it below
- NSMutableData *outputData = [NSMutableData dataWithLength:length/2];
-
- int status;
-
- zStream.next_in = bytes;
- zStream.avail_in = (unsigned int)length;
- zStream.avail_out = 0;
-
- NSInteger bytesProcessedAlready = zStream.total_out;
- while (zStream.avail_out == 0) {
-
- if (zStream.total_out-bytesProcessedAlready >= [outputData length]) {
- [outputData increaseLengthBy:halfLength];
- }
-
- zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
- zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));
- status = deflate(&zStream, shouldFinish ? Z_FINISH : Z_NO_FLUSH);
-
- if (status == Z_STREAM_END) {
- break;
- } else if (status != Z_OK) {
- if (err) {
- *err = [[self class] deflateErrorWithCode:status];
- }
- return NO;
- }
- }
-
- // Set real length
- [outputData setLength: zStream.total_out-bytesProcessedAlready];
- return outputData;
-}
-
-
-+ (NSData *)compressData:(NSData*)uncompressedData error:(NSError **)err
-{
- NSError *theError = nil;
- NSData *outputData = [[ASIDataCompressor compressor] compressBytes:(Bytef *)[uncompressedData bytes] length:[uncompressedData length] error:&theError shouldFinish:YES];
- if (theError) {
- if (err) {
- *err = theError;
- }
- return nil;
- }
- return outputData;
-}
-
-
-
-+ (BOOL)compressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err
-{
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- // Create an empty file at the destination path
- if (![fileManager createFileAtPath:destinationPath contents:[NSData data] attributes:nil]) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were to create a file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,nil]];
- }
- return NO;
- }
-
- // Ensure the source file exists
- if (![fileManager fileExistsAtPath:sourcePath]) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed the file does not exist",sourcePath],NSLocalizedDescriptionKey,nil]];
- }
- return NO;
- }
-
- UInt8 inputData[DATA_CHUNK_SIZE];
- NSData *outputData;
- NSInteger readLength;
- NSError *theError = nil;
-
- ASIDataCompressor *compressor = [ASIDataCompressor compressor];
-
- NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:sourcePath];
- [inputStream open];
- NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:destinationPath append:NO];
- [outputStream open];
-
- while ([compressor streamReady]) {
-
- // Read some data from the file
- readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE];
-
- // Make sure nothing went wrong
- if ([inputStream streamStatus] == NSStreamStatusError) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];
- }
- [compressor closeStream];
- return NO;
- }
- // Have we reached the end of the input data?
- if (!readLength) {
- break;
- }
-
- // Attempt to deflate the chunk of data
- outputData = [compressor compressBytes:inputData length:readLength error:&theError shouldFinish:readLength < DATA_CHUNK_SIZE ];
- if (theError) {
- if (err) {
- *err = theError;
- }
- [compressor closeStream];
- return NO;
- }
-
- // Write the deflated data out to the destination file
- [outputStream write:(const uint8_t *)[outputData bytes] maxLength:[outputData length]];
-
- // Make sure nothing went wrong
- if ([inputStream streamStatus] == NSStreamStatusError) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
- }
- [compressor closeStream];
- return NO;
- }
-
- }
- [inputStream close];
- [outputStream close];
-
- NSError *error = [compressor closeStream];
- if (error) {
- if (err) {
- *err = error;
- }
- return NO;
- }
-
- return YES;
-}
-
-+ (NSError *)deflateErrorWithCode:(int)code
-{
- return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of data failed with code %d",code],NSLocalizedDescriptionKey,nil]];
-}
-
-@synthesize streamReady;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataDecompressor.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataDecompressor.h
deleted file mode 100644
index 8be8f9b5..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataDecompressor.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// ASIDataDecompressor.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 17/08/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-// This is a helper class used by ASIHTTPRequest to handle inflating (decompressing) data in memory and on disk
-// You may also find it helpful if you need to inflate data and files yourself - see the class methods below
-// Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net
-
-#import
-#import
-
-@interface ASIDataDecompressor : NSObject {
- BOOL streamReady;
- z_stream zStream;
-}
-
-// Convenience constructor will call setupStream for you
-+ (id)decompressor;
-
-// Uncompress the passed chunk of data
-- (NSData *)uncompressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err;
-
-// Convenience method - pass it some deflated data, and you'll get inflated data back
-+ (NSData *)uncompressData:(NSData*)compressedData error:(NSError **)err;
-
-// Convenience method - pass it a file containing deflated data in sourcePath, and it will write inflated data to destinationPath
-+ (BOOL)uncompressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err;
-
-// Sets up zlib to handle the inflating. You only need to call this yourself if you aren't using the convenience constructor 'decompressor'
-- (NSError *)setupStream;
-
-// Tells zlib to clean up. You need to call this if you need to cancel inflating part way through
-// If inflating finishes or fails, this method will be called automatically
-- (NSError *)closeStream;
-
-@property (assign, readonly) BOOL streamReady;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataDecompressor.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataDecompressor.m
deleted file mode 100644
index e84a1e31..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDataDecompressor.m
+++ /dev/null
@@ -1,218 +0,0 @@
-//
-// ASIDataDecompressor.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 17/08/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIDataDecompressor.h"
-#import "ASIHTTPRequest.h"
-
-#define DATA_CHUNK_SIZE 262144 // Deal with gzipped data in 256KB chunks
-
-@interface ASIDataDecompressor ()
-+ (NSError *)inflateErrorWithCode:(int)code;
-@end;
-
-@implementation ASIDataDecompressor
-
-+ (id)decompressor
-{
- ASIDataDecompressor *decompressor = [[[self alloc] init] autorelease];
- [decompressor setupStream];
- return decompressor;
-}
-
-- (void)dealloc
-{
- if (streamReady) {
- [self closeStream];
- }
- [super dealloc];
-}
-
-- (NSError *)setupStream
-{
- if (streamReady) {
- return nil;
- }
- // Setup the inflate stream
- zStream.zalloc = Z_NULL;
- zStream.zfree = Z_NULL;
- zStream.opaque = Z_NULL;
- zStream.avail_in = 0;
- zStream.next_in = 0;
- int status = inflateInit2(&zStream, (15+32));
- if (status != Z_OK) {
- return [[self class] inflateErrorWithCode:status];
- }
- streamReady = YES;
- return nil;
-}
-
-- (NSError *)closeStream
-{
- if (!streamReady) {
- return nil;
- }
- // Close the inflate stream
- streamReady = NO;
- int status = inflateEnd(&zStream);
- if (status != Z_OK) {
- return [[self class] inflateErrorWithCode:status];
- }
- return nil;
-}
-
-- (NSData *)uncompressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err
-{
- if (length == 0) return nil;
-
- NSUInteger halfLength = length/2;
- NSMutableData *outputData = [NSMutableData dataWithLength:length+halfLength];
-
- int status;
-
- zStream.next_in = bytes;
- zStream.avail_in = (unsigned int)length;
- zStream.avail_out = 0;
-
- NSInteger bytesProcessedAlready = zStream.total_out;
- while (zStream.avail_in != 0) {
-
- if (zStream.total_out-bytesProcessedAlready >= [outputData length]) {
- [outputData increaseLengthBy:halfLength];
- }
-
- zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
- zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));
-
- status = inflate(&zStream, Z_NO_FLUSH);
-
- if (status == Z_STREAM_END) {
- break;
- } else if (status != Z_OK) {
- if (err) {
- *err = [[self class] inflateErrorWithCode:status];
- }
- return nil;
- }
- }
-
- // Set real length
- [outputData setLength: zStream.total_out-bytesProcessedAlready];
- return outputData;
-}
-
-
-+ (NSData *)uncompressData:(NSData*)compressedData error:(NSError **)err
-{
- NSError *theError = nil;
- NSData *outputData = [[ASIDataDecompressor decompressor] uncompressBytes:(Bytef *)[compressedData bytes] length:[compressedData length] error:&theError];
- if (theError) {
- if (err) {
- *err = theError;
- }
- return nil;
- }
- return outputData;
-}
-
-+ (BOOL)uncompressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err
-{
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- // Create an empty file at the destination path
- if (![fileManager createFileAtPath:destinationPath contents:[NSData data] attributes:nil]) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were to create a file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,nil]];
- }
- return NO;
- }
-
- // Ensure the source file exists
- if (![fileManager fileExistsAtPath:sourcePath]) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed the file does not exist",sourcePath],NSLocalizedDescriptionKey,nil]];
- }
- return NO;
- }
-
- UInt8 inputData[DATA_CHUNK_SIZE];
- NSData *outputData;
- NSInteger readLength;
- NSError *theError = nil;
-
-
- ASIDataDecompressor *decompressor = [ASIDataDecompressor decompressor];
-
- NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:sourcePath];
- [inputStream open];
- NSOutputStream *outputStream = [NSOutputStream outputStreamToFileAtPath:destinationPath append:NO];
- [outputStream open];
-
- while ([decompressor streamReady]) {
-
- // Read some data from the file
- readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE];
-
- // Make sure nothing went wrong
- if ([inputStream streamStatus] == NSStreamStatusError) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to read from the source data file",sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];
- }
- [decompressor closeStream];
- return NO;
- }
- // Have we reached the end of the input data?
- if (!readLength) {
- break;
- }
-
- // Attempt to inflate the chunk of data
- outputData = [decompressor uncompressBytes:inputData length:readLength error:&theError];
- if (theError) {
- if (err) {
- *err = theError;
- }
- [decompressor closeStream];
- return NO;
- }
-
- // Write the inflated data out to the destination file
- [outputStream write:(Bytef*)[outputData bytes] maxLength:[outputData length]];
-
- // Make sure nothing went wrong
- if ([inputStream streamStatus] == NSStreamStatusError) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
- }
- [decompressor closeStream];
- return NO;
- }
-
- }
-
- [inputStream close];
- [outputStream close];
-
- NSError *error = [decompressor closeStream];
- if (error) {
- if (err) {
- *err = error;
- }
- return NO;
- }
-
- return YES;
-}
-
-
-+ (NSError *)inflateErrorWithCode:(int)code
-{
- return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Decompression of data failed with code %d",code],NSLocalizedDescriptionKey,nil]];
-}
-
-@synthesize streamReady;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDownloadCache.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDownloadCache.h
deleted file mode 100644
index a2df9084..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDownloadCache.h
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// ASIDownloadCache.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 01/05/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-#import
-#import "ASICacheDelegate.h"
-
-@interface ASIDownloadCache : NSObject {
-
- // The default cache policy for this cache
- // Requests that store data in the cache will use this cache policy if their cache policy is set to ASIUseDefaultCachePolicy
- // Defaults to ASIAskServerIfModifiedWhenStaleCachePolicy
- ASICachePolicy defaultCachePolicy;
-
- // The directory in which cached data will be stored
- // Defaults to a directory called 'ASIHTTPRequestCache' in the temporary directory
- NSString *storagePath;
-
- // Mediates access to the cache
- NSRecursiveLock *accessLock;
-
- // When YES, the cache will look for cache-control / pragma: no-cache headers, and won't reuse store responses if it finds them
- BOOL shouldRespectCacheControlHeaders;
-}
-
-// Returns a static instance of an ASIDownloadCache
-// In most circumstances, it will make sense to use this as a global cache, rather than creating your own cache
-// To make ASIHTTPRequests use it automatically, use [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];
-+ (id)sharedCache;
-
-// A helper function that determines if the server has requested data should not be cached by looking at the request's response headers
-+ (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request;
-
-// A list of file extensions that we know won't be readable by a webview when accessed locally
-// If we're asking for a path to cache a particular url and it has one of these extensions, we change it to '.html'
-+ (NSArray *)fileExtensionsToHandleAsHTML;
-
-@property (assign, nonatomic) ASICachePolicy defaultCachePolicy;
-@property (retain, nonatomic) NSString *storagePath;
-@property (retain) NSRecursiveLock *accessLock;
-@property (assign) BOOL shouldRespectCacheControlHeaders;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDownloadCache.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDownloadCache.m
deleted file mode 100644
index 93da36fb..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIDownloadCache.m
+++ /dev/null
@@ -1,514 +0,0 @@
-//
-// ASIDownloadCache.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 01/05/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIDownloadCache.h"
-#import "ASIHTTPRequest.h"
-#import
-
-static ASIDownloadCache *sharedCache = nil;
-
-static NSString *sessionCacheFolder = @"SessionStore";
-static NSString *permanentCacheFolder = @"PermanentStore";
-static NSArray *fileExtensionsToHandleAsHTML = nil;
-
-@interface ASIDownloadCache ()
-+ (NSString *)keyForURL:(NSURL *)url;
-- (NSString *)pathToFile:(NSString *)file;
-@end
-
-@implementation ASIDownloadCache
-
-+ (void)initialize
-{
- if (self == [ASIDownloadCache class]) {
- // Obviously this is not an exhaustive list, but hopefully these are the most commonly used and this will 'just work' for the widest range of people
- // I imagine many web developers probably use url rewriting anyway
- fileExtensionsToHandleAsHTML = [[NSArray alloc] initWithObjects:@"asp",@"aspx",@"jsp",@"php",@"rb",@"py",@"pl",@"cgi", nil];
- }
-}
-
-- (id)init
-{
- self = [super init];
- [self setShouldRespectCacheControlHeaders:YES];
- [self setDefaultCachePolicy:ASIUseDefaultCachePolicy];
- [self setAccessLock:[[[NSRecursiveLock alloc] init] autorelease]];
- return self;
-}
-
-+ (id)sharedCache
-{
- if (!sharedCache) {
- @synchronized(self) {
- if (!sharedCache) {
- sharedCache = [[self alloc] init];
- [sharedCache setStoragePath:[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"ASIHTTPRequestCache"]];
- }
- }
- }
- return sharedCache;
-}
-
-- (void)dealloc
-{
- [storagePath release];
- [accessLock release];
- [super dealloc];
-}
-
-- (NSString *)storagePath
-{
- [[self accessLock] lock];
- NSString *p = [[storagePath retain] autorelease];
- [[self accessLock] unlock];
- return p;
-}
-
-
-- (void)setStoragePath:(NSString *)path
-{
- [[self accessLock] lock];
- [self clearCachedResponsesForStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
- [storagePath release];
- storagePath = [path retain];
-
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- BOOL isDirectory = NO;
- NSArray *directories = [NSArray arrayWithObjects:path,[path stringByAppendingPathComponent:sessionCacheFolder],[path stringByAppendingPathComponent:permanentCacheFolder],nil];
- for (NSString *directory in directories) {
- BOOL exists = [fileManager fileExistsAtPath:directory isDirectory:&isDirectory];
- if (exists && !isDirectory) {
- [[self accessLock] unlock];
- [NSException raise:@"FileExistsAtCachePath" format:@"Cannot create a directory for the cache at '%@', because a file already exists",directory];
- } else if (!exists) {
- [fileManager createDirectoryAtPath:directory withIntermediateDirectories:NO attributes:nil error:nil];
- if (![fileManager fileExistsAtPath:directory]) {
- [[self accessLock] unlock];
- [NSException raise:@"FailedToCreateCacheDirectory" format:@"Failed to create a directory for the cache at '%@'",directory];
- }
- }
- }
- [self clearCachedResponsesForStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
- [[self accessLock] unlock];
-}
-
-- (void)updateExpiryForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
-{
- NSString *headerPath = [self pathToStoreCachedResponseHeadersForRequest:request];
- NSMutableDictionary *cachedHeaders = [NSMutableDictionary dictionaryWithContentsOfFile:headerPath];
- if (!cachedHeaders) {
- return;
- }
- NSDate *expires = [self expiryDateForRequest:request maxAge:maxAge];
- if (!expires) {
- return;
- }
- [cachedHeaders setObject:[NSNumber numberWithDouble:[expires timeIntervalSince1970]] forKey:@"X-ASIHTTPRequest-Expires"];
- [cachedHeaders writeToFile:headerPath atomically:NO];
-}
-
-- (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
-{
- return [ASIHTTPRequest expiryDateForRequest:request maxAge:maxAge];
-}
-
-- (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
-{
- [[self accessLock] lock];
-
- if ([request error] || ![request responseHeaders] || ([request cachePolicy] & ASIDoNotWriteToCacheCachePolicy)) {
- [[self accessLock] unlock];
- return;
- }
-
- // We only cache 200/OK or redirect reponses (redirect responses are cached so the cache works better with no internet connection)
- int responseCode = [request responseStatusCode];
- if (responseCode != 200 && responseCode != 301 && responseCode != 302 && responseCode != 303 && responseCode != 307) {
- [[self accessLock] unlock];
- return;
- }
-
- if ([self shouldRespectCacheControlHeaders] && ![[self class] serverAllowsResponseCachingForRequest:request]) {
- [[self accessLock] unlock];
- return;
- }
-
- NSString *headerPath = [self pathToStoreCachedResponseHeadersForRequest:request];
- NSString *dataPath = [self pathToStoreCachedResponseDataForRequest:request];
-
- NSMutableDictionary *responseHeaders = [NSMutableDictionary dictionaryWithDictionary:[request responseHeaders]];
- if ([request isResponseCompressed]) {
- [responseHeaders removeObjectForKey:@"Content-Encoding"];
- }
-
- // Create a special 'X-ASIHTTPRequest-Expires' header
- // This is what we use for deciding if cached data is current, rather than parsing the expires / max-age headers individually each time
- // We store this as a timestamp to make reading it easier as NSDateFormatter is quite expensive
-
- NSDate *expires = [self expiryDateForRequest:request maxAge:maxAge];
- if (expires) {
- [responseHeaders setObject:[NSNumber numberWithDouble:[expires timeIntervalSince1970]] forKey:@"X-ASIHTTPRequest-Expires"];
- }
-
- // Store the response code in a custom header so we can reuse it later
-
- // We'll change 304/Not Modified to 200/OK because this is likely to be us updating the cached headers with a conditional GET
- int statusCode = [request responseStatusCode];
- if (statusCode == 304) {
- statusCode = 200;
- }
- [responseHeaders setObject:[NSNumber numberWithInt:statusCode] forKey:@"X-ASIHTTPRequest-Response-Status-Code"];
-
- [responseHeaders writeToFile:headerPath atomically:NO];
-
- if ([request responseData]) {
- [[request responseData] writeToFile:dataPath atomically:NO];
- } else if ([request downloadDestinationPath] && ![[request downloadDestinationPath] isEqualToString:dataPath]) {
- NSError *error = nil;
- NSFileManager* manager = [[NSFileManager alloc] init];
- if ([manager fileExistsAtPath:dataPath]) {
- [manager removeItemAtPath:dataPath error:&error];
- }
- [manager copyItemAtPath:[request downloadDestinationPath] toPath:dataPath error:&error];
- [manager release];
- }
- [[self accessLock] unlock];
-}
-
-- (NSDictionary *)cachedResponseHeadersForURL:(NSURL *)url
-{
- NSString *path = [self pathToCachedResponseHeadersForURL:url];
- if (path) {
- return [NSDictionary dictionaryWithContentsOfFile:path];
- }
- return nil;
-}
-
-- (NSData *)cachedResponseDataForURL:(NSURL *)url
-{
- NSString *path = [self pathToCachedResponseDataForURL:url];
- if (path) {
- return [NSData dataWithContentsOfFile:path];
- }
- return nil;
-}
-
-- (NSString *)pathToCachedResponseDataForURL:(NSURL *)url
-{
- // Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view
- NSString *extension = [[url path] pathExtension];
-
- // If the url doesn't have an extension, we'll add one so a webview can read it when locally cached
- // If the url has the extension of a common web scripting language, we'll change the extension on the cached path to html for the same reason
- if (![extension length] || [[[self class] fileExtensionsToHandleAsHTML] containsObject:[extension lowercaseString]]) {
- extension = @"html";
- }
- return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:extension]];
-}
-
-+ (NSArray *)fileExtensionsToHandleAsHTML
-{
- return fileExtensionsToHandleAsHTML;
-}
-
-
-- (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url
-{
- return [self pathToFile:[[[self class] keyForURL:url] stringByAppendingPathExtension:@"cachedheaders"]];
-}
-
-- (NSString *)pathToFile:(NSString *)file
-{
- [[self accessLock] lock];
- if (![self storagePath]) {
- [[self accessLock] unlock];
- return nil;
- }
-
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- // Look in the session store
- NSString *dataPath = [[[self storagePath] stringByAppendingPathComponent:sessionCacheFolder] stringByAppendingPathComponent:file];
- if ([fileManager fileExistsAtPath:dataPath]) {
- [[self accessLock] unlock];
- return dataPath;
- }
- // Look in the permanent store
- dataPath = [[[self storagePath] stringByAppendingPathComponent:permanentCacheFolder] stringByAppendingPathComponent:file];
- if ([fileManager fileExistsAtPath:dataPath]) {
- [[self accessLock] unlock];
- return dataPath;
- }
- [[self accessLock] unlock];
- return nil;
-}
-
-
-- (NSString *)pathToStoreCachedResponseDataForRequest:(ASIHTTPRequest *)request
-{
- [[self accessLock] lock];
- if (![self storagePath]) {
- [[self accessLock] unlock];
- return nil;
- }
-
- NSString *path = [[self storagePath] stringByAppendingPathComponent:([request cacheStoragePolicy] == ASICacheForSessionDurationCacheStoragePolicy ? sessionCacheFolder : permanentCacheFolder)];
-
- // Grab the file extension, if there is one. We do this so we can save the cached response with the same file extension - this is important if you want to display locally cached data in a web view
- NSString *extension = [[[request url] path] pathExtension];
-
- // If the url doesn't have an extension, we'll add one so a webview can read it when locally cached
- // If the url has the extension of a common web scripting language, we'll change the extension on the cached path to html for the same reason
- if (![extension length] || [[[self class] fileExtensionsToHandleAsHTML] containsObject:[extension lowercaseString]]) {
- extension = @"html";
- }
- path = [path stringByAppendingPathComponent:[[[self class] keyForURL:[request url]] stringByAppendingPathExtension:extension]];
- [[self accessLock] unlock];
- return path;
-}
-
-- (NSString *)pathToStoreCachedResponseHeadersForRequest:(ASIHTTPRequest *)request
-{
- [[self accessLock] lock];
- if (![self storagePath]) {
- [[self accessLock] unlock];
- return nil;
- }
- NSString *path = [[self storagePath] stringByAppendingPathComponent:([request cacheStoragePolicy] == ASICacheForSessionDurationCacheStoragePolicy ? sessionCacheFolder : permanentCacheFolder)];
- path = [path stringByAppendingPathComponent:[[[self class] keyForURL:[request url]] stringByAppendingPathExtension:@"cachedheaders"]];
- [[self accessLock] unlock];
- return path;
-}
-
-- (void)removeCachedDataForURL:(NSURL *)url
-{
- [[self accessLock] lock];
- if (![self storagePath]) {
- [[self accessLock] unlock];
- return;
- }
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- NSString *path = [self pathToCachedResponseHeadersForURL:url];
- if (path) {
- [fileManager removeItemAtPath:path error:NULL];
- }
-
- path = [self pathToCachedResponseDataForURL:url];
- if (path) {
- [fileManager removeItemAtPath:path error:NULL];
- }
- [[self accessLock] unlock];
-}
-
-- (void)removeCachedDataForRequest:(ASIHTTPRequest *)request
-{
- [self removeCachedDataForURL:[request url]];
-}
-
-- (BOOL)isCachedDataCurrentForRequest:(ASIHTTPRequest *)request
-{
- [[self accessLock] lock];
- if (![self storagePath]) {
- [[self accessLock] unlock];
- return NO;
- }
- NSDictionary *cachedHeaders = [self cachedResponseHeadersForURL:[request url]];
- if (!cachedHeaders) {
- [[self accessLock] unlock];
- return NO;
- }
- NSString *dataPath = [self pathToCachedResponseDataForURL:[request url]];
- if (!dataPath) {
- [[self accessLock] unlock];
- return NO;
- }
-
- // New content is not different
- if ([request responseStatusCode] == 304) {
- [[self accessLock] unlock];
- return YES;
- }
-
- // If we already have response headers for this request, check to see if the new content is different
- // We check [request complete] so that we don't end up comparing response headers from a redirection with these
- if ([request responseHeaders] && [request complete]) {
-
- // If the Etag or Last-Modified date are different from the one we have, we'll have to fetch this resource again
- NSArray *headersToCompare = [NSArray arrayWithObjects:@"Etag",@"Last-Modified",nil];
- for (NSString *header in headersToCompare) {
- if (![[[request responseHeaders] objectForKey:header] isEqualToString:[cachedHeaders objectForKey:header]]) {
- [[self accessLock] unlock];
- return NO;
- }
- }
- }
-
- if ([self shouldRespectCacheControlHeaders]) {
-
- // Look for X-ASIHTTPRequest-Expires header to see if the content is out of date
- NSNumber *expires = [cachedHeaders objectForKey:@"X-ASIHTTPRequest-Expires"];
- if (expires) {
- if ([[NSDate dateWithTimeIntervalSince1970:[expires doubleValue]] timeIntervalSinceNow] >= 0) {
- [[self accessLock] unlock];
- return YES;
- }
- }
-
- // No explicit expiration time sent by the server
- [[self accessLock] unlock];
- return NO;
- }
-
-
- [[self accessLock] unlock];
- return YES;
-}
-
-- (ASICachePolicy)defaultCachePolicy
-{
- [[self accessLock] lock];
- ASICachePolicy cp = defaultCachePolicy;
- [[self accessLock] unlock];
- return cp;
-}
-
-
-- (void)setDefaultCachePolicy:(ASICachePolicy)cachePolicy
-{
- [[self accessLock] lock];
- if (!cachePolicy) {
- defaultCachePolicy = ASIAskServerIfModifiedWhenStaleCachePolicy;
- } else {
- defaultCachePolicy = cachePolicy;
- }
- [[self accessLock] unlock];
-}
-
-- (void)clearCachedResponsesForStoragePolicy:(ASICacheStoragePolicy)storagePolicy
-{
- [[self accessLock] lock];
- if (![self storagePath]) {
- [[self accessLock] unlock];
- return;
- }
- NSString *path = [[self storagePath] stringByAppendingPathComponent:(storagePolicy == ASICacheForSessionDurationCacheStoragePolicy ? sessionCacheFolder : permanentCacheFolder)];
-
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- BOOL isDirectory = NO;
- BOOL exists = [fileManager fileExistsAtPath:path isDirectory:&isDirectory];
- if (!exists || !isDirectory) {
- [[self accessLock] unlock];
- return;
- }
- NSError *error = nil;
- NSArray *cacheFiles = [fileManager contentsOfDirectoryAtPath:path error:&error];
- if (error) {
- [[self accessLock] unlock];
- [NSException raise:@"FailedToTraverseCacheDirectory" format:@"Listing cache directory failed at path '%@'",path];
- }
- for (NSString *file in cacheFiles) {
- [fileManager removeItemAtPath:[path stringByAppendingPathComponent:file] error:&error];
- if (error) {
- [[self accessLock] unlock];
- [NSException raise:@"FailedToRemoveCacheFile" format:@"Failed to remove cached data at path '%@'",path];
- }
- }
- [[self accessLock] unlock];
-}
-
-+ (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request
-{
- NSString *cacheControl = [[[request responseHeaders] objectForKey:@"Cache-Control"] lowercaseString];
- if (cacheControl) {
- if ([cacheControl isEqualToString:@"no-cache"] || [cacheControl isEqualToString:@"no-store"]) {
- return NO;
- }
- }
- NSString *pragma = [[[request responseHeaders] objectForKey:@"Pragma"] lowercaseString];
- if (pragma) {
- if ([pragma isEqualToString:@"no-cache"]) {
- return NO;
- }
- }
- return YES;
-}
-
-+ (NSString *)keyForURL:(NSURL *)url
-{
- NSString *urlString = [url absoluteString];
- if ([urlString length] == 0) {
- return nil;
- }
-
- // Strip trailing slashes so http://allseeing-i.com/ASIHTTPRequest/ is cached the same as http://allseeing-i.com/ASIHTTPRequest
- if ([[urlString substringFromIndex:[urlString length]-1] isEqualToString:@"/"]) {
- urlString = [urlString substringToIndex:[urlString length]-1];
- }
-
- // Borrowed from: http://stackoverflow.com/questions/652300/using-md5-hash-on-a-string-in-cocoa
- const char *cStr = [urlString UTF8String];
- unsigned char result[16];
- CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
- return [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7],result[8], result[9], result[10], result[11],result[12], result[13], result[14], result[15]];
-}
-
-- (BOOL)canUseCachedDataForRequest:(ASIHTTPRequest *)request
-{
- // Ensure the request is allowed to read from the cache
- if ([request cachePolicy] & ASIDoNotReadFromCacheCachePolicy) {
- return NO;
-
- // If we don't want to load the request whatever happens, always pretend we have cached data even if we don't
- } else if ([request cachePolicy] & ASIDontLoadCachePolicy) {
- return YES;
- }
-
- NSDictionary *headers = [self cachedResponseHeadersForURL:[request url]];
- if (!headers) {
- return NO;
- }
- NSString *dataPath = [self pathToCachedResponseDataForURL:[request url]];
- if (!dataPath) {
- return NO;
- }
-
- // If we get here, we have cached data
-
- // If we have cached data, we can use it
- if ([request cachePolicy] & ASIOnlyLoadIfNotCachedCachePolicy) {
- return YES;
-
- // If we want to fallback to the cache after an error
- } else if ([request complete] && [request cachePolicy] & ASIFallbackToCacheIfLoadFailsCachePolicy) {
- return YES;
-
- // If we have cached data that is current, we can use it
- } else if ([request cachePolicy] & ASIAskServerIfModifiedWhenStaleCachePolicy) {
- if ([self isCachedDataCurrentForRequest:request]) {
- return YES;
- }
-
- // If we've got headers from a conditional GET and the cached data is still current, we can use it
- } else if ([request cachePolicy] & ASIAskServerIfModifiedCachePolicy) {
- if (![request responseHeaders]) {
- return NO;
- } else if ([self isCachedDataCurrentForRequest:request]) {
- return YES;
- }
- }
- return NO;
-}
-
-@synthesize storagePath;
-@synthesize defaultCachePolicy;
-@synthesize accessLock;
-@synthesize shouldRespectCacheControlHeaders;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIFormDataRequest.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIFormDataRequest.h
deleted file mode 100644
index 670995f1..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIFormDataRequest.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// ASIFormDataRequest.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 07/11/2008.
-// Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import
-#import "ASIHTTPRequest.h"
-#import "ASIHTTPRequestConfig.h"
-
-typedef enum _ASIPostFormat {
- ASIMultipartFormDataPostFormat = 0,
- ASIURLEncodedPostFormat = 1
-
-} ASIPostFormat;
-
-@interface ASIFormDataRequest : ASIHTTPRequest {
-
- // Parameters that will be POSTed to the url
- NSMutableArray *postData;
-
- // Files that will be POSTed to the url
- NSMutableArray *fileData;
-
- ASIPostFormat postFormat;
-
- NSStringEncoding stringEncoding;
-
-#if DEBUG_FORM_DATA_REQUEST
- // Will store a string version of the request body that will be printed to the console when ASIHTTPREQUEST_DEBUG is set in GCC_PREPROCESSOR_DEFINITIONS
- NSString *debugBodyString;
-#endif
-
-}
-
-#pragma mark utilities
-- (NSString*)encodeURL:(NSString *)string;
-
-#pragma mark setup request
-
-// Add a POST variable to the request
-- (void)addPostValue:(id )value forKey:(NSString *)key;
-
-// Set a POST variable for this request, clearing any others with the same key
-- (void)setPostValue:(id )value forKey:(NSString *)key;
-
-// Add the contents of a local file to the request
-- (void)addFile:(NSString *)filePath forKey:(NSString *)key;
-
-// Same as above, but you can specify the content-type and file name
-- (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
-
-// Add the contents of a local file to the request, clearing any others with the same key
-- (void)setFile:(NSString *)filePath forKey:(NSString *)key;
-
-// Same as above, but you can specify the content-type and file name
-- (void)setFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
-
-// Add the contents of an NSData object to the request
-- (void)addData:(NSData *)data forKey:(NSString *)key;
-
-// Same as above, but you can specify the content-type and file name
-- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
-
-// Add the contents of an NSData object to the request, clearing any others with the same key
-- (void)setData:(NSData *)data forKey:(NSString *)key;
-
-// Same as above, but you can specify the content-type and file name
-- (void)setData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key;
-
-
-@property (assign) ASIPostFormat postFormat;
-@property (assign) NSStringEncoding stringEncoding;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIFormDataRequest.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIFormDataRequest.m
deleted file mode 100644
index 2d812a04..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIFormDataRequest.m
+++ /dev/null
@@ -1,362 +0,0 @@
-//
-// ASIFormDataRequest.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 07/11/2008.
-// Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIFormDataRequest.h"
-
-
-// Private stuff
-@interface ASIFormDataRequest ()
-- (void)buildMultipartFormDataPostBody;
-- (void)buildURLEncodedPostBody;
-- (void)appendPostString:(NSString *)string;
-
-@property (retain) NSMutableArray *postData;
-@property (retain) NSMutableArray *fileData;
-
-#if DEBUG_FORM_DATA_REQUEST
-- (void)addToDebugBody:(NSString *)string;
-@property (retain, nonatomic) NSString *debugBodyString;
-#endif
-
-@end
-
-@implementation ASIFormDataRequest
-
-#pragma mark utilities
-- (NSString*)encodeURL:(NSString *)string
-{
- NSString *newString = [NSMakeCollectable(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding([self stringEncoding]))) autorelease];
- if (newString) {
- return newString;
- }
- return @"";
-}
-
-#pragma mark init / dealloc
-
-+ (id)requestWithURL:(NSURL *)newURL
-{
- return [[[self alloc] initWithURL:newURL] autorelease];
-}
-
-- (id)initWithURL:(NSURL *)newURL
-{
- self = [super initWithURL:newURL];
- [self setPostFormat:ASIURLEncodedPostFormat];
- [self setStringEncoding:NSUTF8StringEncoding];
- [self setRequestMethod:@"POST"];
- return self;
-}
-
-- (void)dealloc
-{
-#if DEBUG_FORM_DATA_REQUEST
- [debugBodyString release];
-#endif
-
- [postData release];
- [fileData release];
- [super dealloc];
-}
-
-#pragma mark setup request
-
-- (void)addPostValue:(id )value forKey:(NSString *)key
-{
- if (!key) {
- return;
- }
- if (![self postData]) {
- [self setPostData:[NSMutableArray array]];
- }
- NSMutableDictionary *keyValuePair = [NSMutableDictionary dictionaryWithCapacity:2];
- [keyValuePair setValue:key forKey:@"key"];
- [keyValuePair setValue:[value description] forKey:@"value"];
- [[self postData] addObject:keyValuePair];
-}
-
-- (void)setPostValue:(id )value forKey:(NSString *)key
-{
- // Remove any existing value
- NSUInteger i;
- for (i=0; i<[[self postData] count]; i++) {
- NSDictionary *val = [[self postData] objectAtIndex:i];
- if ([[val objectForKey:@"key"] isEqualToString:key]) {
- [[self postData] removeObjectAtIndex:i];
- i--;
- }
- }
- [self addPostValue:value forKey:key];
-}
-
-
-- (void)addFile:(NSString *)filePath forKey:(NSString *)key
-{
- [self addFile:filePath withFileName:nil andContentType:nil forKey:key];
-}
-
-- (void)addFile:(NSString *)filePath withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
-{
- BOOL isDirectory = NO;
- BOOL fileExists = [[[[NSFileManager alloc] init] autorelease] fileExistsAtPath:filePath isDirectory:&isDirectory];
- if (!fileExists || isDirectory) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"No file exists at %@",filePath],NSLocalizedDescriptionKey,nil]]];
- }
-
- // If the caller didn't specify a custom file name, we'll use the file name of the file we were passed
- if (!fileName) {
- fileName = [filePath lastPathComponent];
- }
-
- // If we were given the path to a file, and the user didn't specify a mime type, we can detect it from the file extension
- if (!contentType) {
- contentType = [ASIHTTPRequest mimeTypeForFileAtPath:filePath];
- }
- [self addData:filePath withFileName:fileName andContentType:contentType forKey:key];
-}
-
-- (void)setFile:(NSString *)filePath forKey:(NSString *)key
-{
- [self setFile:filePath withFileName:nil andContentType:nil forKey:key];
-}
-
-- (void)setFile:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
-{
- // Remove any existing value
- NSUInteger i;
- for (i=0; i<[[self fileData] count]; i++) {
- NSDictionary *val = [[self fileData] objectAtIndex:i];
- if ([[val objectForKey:@"key"] isEqualToString:key]) {
- [[self fileData] removeObjectAtIndex:i];
- i--;
- }
- }
- [self addFile:data withFileName:fileName andContentType:contentType forKey:key];
-}
-
-- (void)addData:(NSData *)data forKey:(NSString *)key
-{
- [self addData:data withFileName:@"file" andContentType:nil forKey:key];
-}
-
-- (void)addData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
-{
- if (![self fileData]) {
- [self setFileData:[NSMutableArray array]];
- }
- if (!contentType) {
- contentType = @"application/octet-stream";
- }
-
- NSMutableDictionary *fileInfo = [NSMutableDictionary dictionaryWithCapacity:4];
- [fileInfo setValue:key forKey:@"key"];
- [fileInfo setValue:fileName forKey:@"fileName"];
- [fileInfo setValue:contentType forKey:@"contentType"];
- [fileInfo setValue:data forKey:@"data"];
-
- [[self fileData] addObject:fileInfo];
-}
-
-- (void)setData:(NSData *)data forKey:(NSString *)key
-{
- [self setData:data withFileName:@"file" andContentType:nil forKey:key];
-}
-
-- (void)setData:(id)data withFileName:(NSString *)fileName andContentType:(NSString *)contentType forKey:(NSString *)key
-{
- // Remove any existing value
- NSUInteger i;
- for (i=0; i<[[self fileData] count]; i++) {
- NSDictionary *val = [[self fileData] objectAtIndex:i];
- if ([[val objectForKey:@"key"] isEqualToString:key]) {
- [[self fileData] removeObjectAtIndex:i];
- i--;
- }
- }
- [self addData:data withFileName:fileName andContentType:contentType forKey:key];
-}
-
-- (void)buildPostBody
-{
- if ([self haveBuiltPostBody]) {
- return;
- }
-
-#if DEBUG_FORM_DATA_REQUEST
- [self setDebugBodyString:@""];
-#endif
-
- if (![self postData] && ![self fileData]) {
- [super buildPostBody];
- return;
- }
- if ([[self fileData] count] > 0) {
- [self setShouldStreamPostDataFromDisk:YES];
- }
-
- if ([self postFormat] == ASIURLEncodedPostFormat) {
- [self buildURLEncodedPostBody];
- } else {
- [self buildMultipartFormDataPostBody];
- }
-
- [super buildPostBody];
-
-#if DEBUG_FORM_DATA_REQUEST
- ASI_DEBUG_LOG(@"%@",[self debugBodyString]);
- [self setDebugBodyString:nil];
-#endif
-}
-
-
-- (void)buildMultipartFormDataPostBody
-{
-#if DEBUG_FORM_DATA_REQUEST
- [self addToDebugBody:@"\r\n==== Building a multipart/form-data body ====\r\n"];
-#endif
-
- NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding]));
-
- // We don't bother to check if post data contains the boundary, since it's pretty unlikely that it does.
- CFUUIDRef uuid = CFUUIDCreate(nil);
- NSString *uuidString = [(NSString*)CFUUIDCreateString(nil, uuid) autorelease];
- CFRelease(uuid);
- NSString *stringBoundary = [NSString stringWithFormat:@"0xKhTmLbOuNdArY-%@",uuidString];
-
- [self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, stringBoundary]];
-
- [self appendPostString:[NSString stringWithFormat:@"--%@\r\n",stringBoundary]];
-
- // Adds post data
- NSString *endItemBoundary = [NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary];
- NSUInteger i=0;
- for (NSDictionary *val in [self postData]) {
- [self appendPostString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",[val objectForKey:@"key"]]];
- [self appendPostString:[val objectForKey:@"value"]];
- i++;
- if (i != [[self postData] count] || [[self fileData] count] > 0) { //Only add the boundary if this is not the last item in the post body
- [self appendPostString:endItemBoundary];
- }
- }
-
- // Adds files to upload
- i=0;
- for (NSDictionary *val in [self fileData]) {
-
- [self appendPostString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", [val objectForKey:@"key"], [val objectForKey:@"fileName"]]];
- [self appendPostString:[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", [val objectForKey:@"contentType"]]];
-
- id data = [val objectForKey:@"data"];
- if ([data isKindOfClass:[NSString class]]) {
- [self appendPostDataFromFile:data];
- } else {
- [self appendPostData:data];
- }
- i++;
- // Only add the boundary if this is not the last item in the post body
- if (i != [[self fileData] count]) {
- [self appendPostString:endItemBoundary];
- }
- }
-
- [self appendPostString:[NSString stringWithFormat:@"\r\n--%@--\r\n",stringBoundary]];
-
-#if DEBUG_FORM_DATA_REQUEST
- [self addToDebugBody:@"==== End of multipart/form-data body ====\r\n"];
-#endif
-}
-
-- (void)buildURLEncodedPostBody
-{
-
- // We can't post binary data using application/x-www-form-urlencoded
- if ([[self fileData] count] > 0) {
- [self setPostFormat:ASIMultipartFormDataPostFormat];
- [self buildMultipartFormDataPostBody];
- return;
- }
-
-#if DEBUG_FORM_DATA_REQUEST
- [self addToDebugBody:@"\r\n==== Building an application/x-www-form-urlencoded body ====\r\n"];
-#endif
-
-
- NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding([self stringEncoding]));
-
- [self addRequestHeader:@"Content-Type" value:[NSString stringWithFormat:@"application/x-www-form-urlencoded; charset=%@",charset]];
-
-
- NSUInteger i=0;
- NSUInteger count = [[self postData] count]-1;
- for (NSDictionary *val in [self postData]) {
- NSString *data = [NSString stringWithFormat:@"%@=%@%@", [self encodeURL:[val objectForKey:@"key"]], [self encodeURL:[val objectForKey:@"value"]],(i
-#if TARGET_OS_IPHONE
- #import
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
- #import // Necessary for background task support
- #endif
-#endif
-
-#import
-#import "ASIHTTPRequestConfig.h"
-#import "ASIHTTPRequestDelegate.h"
-#import "ASIProgressDelegate.h"
-#import "ASICacheDelegate.h"
-
-@class ASIDataDecompressor;
-
-extern NSString *ASIHTTPRequestVersion;
-
-// Make targeting different platforms more reliable
-// See: http://www.blumtnwerx.com/blog/2009/06/cross-sdk-code-hygiene-in-xcode/
-#ifndef __IPHONE_3_2
- #define __IPHONE_3_2 30200
-#endif
-#ifndef __IPHONE_4_0
- #define __IPHONE_4_0 40000
-#endif
-#ifndef __MAC_10_5
- #define __MAC_10_5 1050
-#endif
-#ifndef __MAC_10_6
- #define __MAC_10_6 1060
-#endif
-
-typedef enum _ASIAuthenticationState {
- ASINoAuthenticationNeededYet = 0,
- ASIHTTPAuthenticationNeeded = 1,
- ASIProxyAuthenticationNeeded = 2
-} ASIAuthenticationState;
-
-typedef enum _ASINetworkErrorType {
- ASIConnectionFailureErrorType = 1,
- ASIRequestTimedOutErrorType = 2,
- ASIAuthenticationErrorType = 3,
- ASIRequestCancelledErrorType = 4,
- ASIUnableToCreateRequestErrorType = 5,
- ASIInternalErrorWhileBuildingRequestType = 6,
- ASIInternalErrorWhileApplyingCredentialsType = 7,
- ASIFileManagementError = 8,
- ASITooMuchRedirectionErrorType = 9,
- ASIUnhandledExceptionError = 10,
- ASICompressionError = 11
-
-} ASINetworkErrorType;
-
-
-// The error domain that all errors generated by ASIHTTPRequest use
-extern NSString* const NetworkRequestErrorDomain;
-
-// You can use this number to throttle upload and download bandwidth in iPhone OS apps send or receive a large amount of data
-// This may help apps that might otherwise be rejected for inclusion into the app store for using excessive bandwidth
-// This number is not official, as far as I know there is no officially documented bandwidth limit
-extern unsigned long const ASIWWANBandwidthThrottleAmount;
-
-#if NS_BLOCKS_AVAILABLE
-typedef void (^ASIBasicBlock)(void);
-typedef void (^ASIHeadersBlock)(NSDictionary *responseHeaders);
-typedef void (^ASISizeBlock)(long long size);
-typedef void (^ASIProgressBlock)(unsigned long long size, unsigned long long total);
-typedef void (^ASIDataBlock)(NSData *data);
-#endif
-
-@interface ASIHTTPRequest : NSOperation {
-
- // The url for this operation, should include GET params in the query string where appropriate
- NSURL *url;
-
- // Will always contain the original url used for making the request (the value of url can change when a request is redirected)
- NSURL *originalURL;
-
- // Temporarily stores the url we are about to redirect to. Will be nil again when we do redirect
- NSURL *redirectURL;
-
- // The delegate - will be notified of various changes in state via the ASIHTTPRequestDelegate protocol
- id delegate;
-
- // Another delegate that is also notified of request status changes and progress updates
- // Generally, you won't use this directly, but ASINetworkQueue sets itself as the queue so it can proxy updates to its own delegates
- // NOTE: WILL BE RETAINED BY THE REQUEST
- id queue;
-
- // HTTP method to use (eg: GET / POST / PUT / DELETE / HEAD etc). Defaults to GET
- NSString *requestMethod;
-
- // Request body - only used when the whole body is stored in memory (shouldStreamPostDataFromDisk is false)
- NSMutableData *postBody;
-
- // gzipped request body used when shouldCompressRequestBody is YES
- NSData *compressedPostBody;
-
- // When true, post body will be streamed from a file on disk, rather than loaded into memory at once (useful for large uploads)
- // Automatically set to true in ASIFormDataRequests when using setFile:forKey:
- BOOL shouldStreamPostDataFromDisk;
-
- // Path to file used to store post body (when shouldStreamPostDataFromDisk is true)
- // You can set this yourself - useful if you want to PUT a file from local disk
- NSString *postBodyFilePath;
-
- // Path to a temporary file used to store a deflated post body (when shouldCompressPostBody is YES)
- NSString *compressedPostBodyFilePath;
-
- // Set to true when ASIHTTPRequest automatically created a temporary file containing the request body (when true, the file at postBodyFilePath will be deleted at the end of the request)
- BOOL didCreateTemporaryPostDataFile;
-
- // Used when writing to the post body when shouldStreamPostDataFromDisk is true (via appendPostData: or appendPostDataFromFile:)
- NSOutputStream *postBodyWriteStream;
-
- // Used for reading from the post body when sending the request
- NSInputStream *postBodyReadStream;
-
- // Dictionary for custom HTTP request headers
- NSMutableDictionary *requestHeaders;
-
- // Set to YES when the request header dictionary has been populated, used to prevent this happening more than once
- BOOL haveBuiltRequestHeaders;
-
- // Will be populated with HTTP response headers from the server
- NSDictionary *responseHeaders;
-
- // Can be used to manually insert cookie headers to a request, but it's more likely that sessionCookies will do this for you
- NSMutableArray *requestCookies;
-
- // Will be populated with cookies
- NSArray *responseCookies;
-
- // If use useCookiePersistence is true, network requests will present valid cookies from previous requests
- BOOL useCookiePersistence;
-
- // If useKeychainPersistence is true, network requests will attempt to read credentials from the keychain, and will save them in the keychain when they are successfully presented
- BOOL useKeychainPersistence;
-
- // If useSessionPersistence is true, network requests will save credentials and reuse for the duration of the session (until clearSession is called)
- BOOL useSessionPersistence;
-
- // If allowCompressedResponse is true, requests will inform the server they can accept compressed data, and will automatically decompress gzipped responses. Default is true.
- BOOL allowCompressedResponse;
-
- // If shouldCompressRequestBody is true, the request body will be gzipped. Default is false.
- // You will probably need to enable this feature on your webserver to make this work. Tested with apache only.
- BOOL shouldCompressRequestBody;
-
- // When downloadDestinationPath is set, the result of this request will be downloaded to the file at this location
- // If downloadDestinationPath is not set, download data will be stored in memory
- NSString *downloadDestinationPath;
-
- // The location that files will be downloaded to. Once a download is complete, files will be decompressed (if necessary) and moved to downloadDestinationPath
- NSString *temporaryFileDownloadPath;
-
- // If the response is gzipped and shouldWaitToInflateCompressedResponses is NO, a file will be created at this path containing the inflated response as it comes in
- NSString *temporaryUncompressedDataDownloadPath;
-
- // Used for writing data to a file when downloadDestinationPath is set
- NSOutputStream *fileDownloadOutputStream;
-
- NSOutputStream *inflatedFileDownloadOutputStream;
-
- // When the request fails or completes successfully, complete will be true
- BOOL complete;
-
- // external "finished" indicator, subject of KVO notifications; updates after 'complete'
- BOOL finished;
-
- // True if our 'cancel' selector has been called
- BOOL cancelled;
-
- // If an error occurs, error will contain an NSError
- // If error code is = ASIConnectionFailureErrorType (1, Connection failure occurred) - inspect [[error userInfo] objectForKey:NSUnderlyingErrorKey] for more information
- NSError *error;
-
- // Username and password used for authentication
- NSString *username;
- NSString *password;
-
- // User-Agent for this request
- NSString *userAgentString;
-
- // Domain used for NTLM authentication
- NSString *domain;
-
- // Username and password used for proxy authentication
- NSString *proxyUsername;
- NSString *proxyPassword;
-
- // Domain used for NTLM proxy authentication
- NSString *proxyDomain;
-
- // Delegate for displaying upload progress (usually an NSProgressIndicator, but you can supply a different object and handle this yourself)
- id uploadProgressDelegate;
-
- // Delegate for displaying download progress (usually an NSProgressIndicator, but you can supply a different object and handle this yourself)
- id downloadProgressDelegate;
-
- // Whether we've seen the headers of the response yet
- BOOL haveExaminedHeaders;
-
- // Data we receive will be stored here. Data may be compressed unless allowCompressedResponse is false - you should use [request responseData] instead in most cases
- NSMutableData *rawResponseData;
-
- // Used for sending and receiving data
- CFHTTPMessageRef request;
- NSInputStream *readStream;
-
- // Used for authentication
- CFHTTPAuthenticationRef requestAuthentication;
- NSDictionary *requestCredentials;
-
- // Used during NTLM authentication
- int authenticationRetryCount;
-
- // Authentication scheme (Basic, Digest, NTLM)
- // If you are using Basic authentication and want to force ASIHTTPRequest to send an authorization header without waiting for a 401, you must set this to (NSString *)kCFHTTPAuthenticationSchemeBasic
- NSString *authenticationScheme;
-
- // Realm for authentication when credentials are required
- NSString *authenticationRealm;
-
- // When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a server that requires authentication
- // The dialog will not be shown if your delegate responds to authenticationNeededForRequest:
- // Default is NO.
- BOOL shouldPresentAuthenticationDialog;
-
- // When YES, ASIHTTPRequest will present a dialog allowing users to enter credentials when no-matching credentials were found for a proxy server that requires authentication
- // The dialog will not be shown if your delegate responds to proxyAuthenticationNeededForRequest:
- // Default is YES (basically, because most people won't want the hassle of adding support for authenticating proxies to their apps)
- BOOL shouldPresentProxyAuthenticationDialog;
-
- // Used for proxy authentication
- CFHTTPAuthenticationRef proxyAuthentication;
- NSDictionary *proxyCredentials;
-
- // Used during authentication with an NTLM proxy
- int proxyAuthenticationRetryCount;
-
- // Authentication scheme for the proxy (Basic, Digest, NTLM)
- NSString *proxyAuthenticationScheme;
-
- // Realm for proxy authentication when credentials are required
- NSString *proxyAuthenticationRealm;
-
- // HTTP status code, eg: 200 = OK, 404 = Not found etc
- int responseStatusCode;
-
- // Description of the HTTP status code
- NSString *responseStatusMessage;
-
- // Size of the response
- unsigned long long contentLength;
-
- // Size of the partially downloaded content
- unsigned long long partialDownloadSize;
-
- // Size of the POST payload
- unsigned long long postLength;
-
- // The total amount of downloaded data
- unsigned long long totalBytesRead;
-
- // The total amount of uploaded data
- unsigned long long totalBytesSent;
-
- // Last amount of data read (used for incrementing progress)
- unsigned long long lastBytesRead;
-
- // Last amount of data sent (used for incrementing progress)
- unsigned long long lastBytesSent;
-
- // This lock prevents the operation from being cancelled at an inopportune moment
- NSRecursiveLock *cancelledLock;
-
- // Called on the delegate (if implemented) when the request starts. Default is requestStarted:
- SEL didStartSelector;
-
- // Called on the delegate (if implemented) when the request receives response headers. Default is request:didReceiveResponseHeaders:
- SEL didReceiveResponseHeadersSelector;
-
- // Called on the delegate (if implemented) when the request receives a Location header and shouldRedirect is YES
- // The delegate can then change the url if needed, and can restart the request by calling [request redirectToURL:], or simply cancel it
- SEL willRedirectSelector;
-
- // Called on the delegate (if implemented) when the request completes successfully. Default is requestFinished:
- SEL didFinishSelector;
-
- // Called on the delegate (if implemented) when the request fails. Default is requestFailed:
- SEL didFailSelector;
-
- // Called on the delegate (if implemented) when the request receives data. Default is request:didReceiveData:
- // If you set this and implement the method in your delegate, you must handle the data yourself - ASIHTTPRequest will not populate responseData or write the data to downloadDestinationPath
- SEL didReceiveDataSelector;
-
- // Used for recording when something last happened during the request, we will compare this value with the current date to time out requests when appropriate
- NSDate *lastActivityTime;
-
- // Number of seconds to wait before timing out - default is 10
- NSTimeInterval timeOutSeconds;
-
- // Will be YES when a HEAD request will handle the content-length before this request starts
- BOOL shouldResetUploadProgress;
- BOOL shouldResetDownloadProgress;
-
- // Used by HEAD requests when showAccurateProgress is YES to preset the content-length for this request
- ASIHTTPRequest *mainRequest;
-
- // When NO, this request will only update the progress indicator when it completes
- // When YES, this request will update the progress indicator according to how much data it has received so far
- // The default for requests is YES
- // Also see the comments in ASINetworkQueue.h
- BOOL showAccurateProgress;
-
- // Used to ensure the progress indicator is only incremented once when showAccurateProgress = NO
- BOOL updatedProgress;
-
- // Prevents the body of the post being built more than once (largely for subclasses)
- BOOL haveBuiltPostBody;
-
- // Used internally, may reflect the size of the internal buffer used by CFNetwork
- // POST / PUT operations with body sizes greater than uploadBufferSize will not timeout unless more than uploadBufferSize bytes have been sent
- // Likely to be 32KB on iPhone 3.0, 128KB on Mac OS X Leopard and iPhone 2.2.x
- unsigned long long uploadBufferSize;
-
- // Text encoding for responses that do not send a Content-Type with a charset value. Defaults to NSISOLatin1StringEncoding
- NSStringEncoding defaultResponseEncoding;
-
- // The text encoding of the response, will be defaultResponseEncoding if the server didn't specify. Can't be set.
- NSStringEncoding responseEncoding;
-
- // Tells ASIHTTPRequest not to delete partial downloads, and allows it to use an existing file to resume a download. Defaults to NO.
- BOOL allowResumeForFileDownloads;
-
- // Custom user information associated with the request (not sent to the server)
- NSDictionary *userInfo;
- NSInteger tag;
-
- // Use HTTP 1.0 rather than 1.1 (defaults to false)
- BOOL useHTTPVersionOne;
-
- // When YES, requests will automatically redirect when they get a HTTP 30x header (defaults to YES)
- BOOL shouldRedirect;
-
- // Used internally to tell the main loop we need to stop and retry with a new url
- BOOL needsRedirect;
-
- // Incremented every time this request redirects. When it reaches 5, we give up
- int redirectCount;
-
- // When NO, requests will not check the secure certificate is valid (use for self-signed certificates during development, DO NOT USE IN PRODUCTION) Default is YES
- BOOL validatesSecureCertificate;
-
- // If not nil and the URL scheme is https, CFNetwork configured to supply a client certificate
- SecIdentityRef clientCertificateIdentity;
- NSArray *clientCertificates;
-
- // Details on the proxy to use - you could set these yourself, but it's probably best to let ASIHTTPRequest detect the system proxy settings
- NSString *proxyHost;
- int proxyPort;
-
- // ASIHTTPRequest will assume kCFProxyTypeHTTP if the proxy type could not be automatically determined
- // Set to kCFProxyTypeSOCKS if you are manually configuring a SOCKS proxy
- NSString *proxyType;
-
- // URL for a PAC (Proxy Auto Configuration) file. If you want to set this yourself, it's probably best if you use a local file
- NSURL *PACurl;
-
- // See ASIAuthenticationState values above. 0 == default == No authentication needed yet
- ASIAuthenticationState authenticationNeeded;
-
- // When YES, ASIHTTPRequests will present credentials from the session store for requests to the same server before being asked for them
- // This avoids an extra round trip for requests after authentication has succeeded, which is much for efficient for authenticated requests with large bodies, or on slower connections
- // Set to NO to only present credentials when explicitly asked for them
- // This only affects credentials stored in the session cache when useSessionPersistence is YES. Credentials from the keychain are never presented unless the server asks for them
- // Default is YES
- // For requests using Basic authentication, set authenticationScheme to (NSString *)kCFHTTPAuthenticationSchemeBasic, and credentials can be sent on the very first request when shouldPresentCredentialsBeforeChallenge is YES
- BOOL shouldPresentCredentialsBeforeChallenge;
-
- // YES when the request hasn't finished yet. Will still be YES even if the request isn't doing anything (eg it's waiting for delegate authentication). READ-ONLY
- BOOL inProgress;
-
- // Used internally to track whether the stream is scheduled on the run loop or not
- // Bandwidth throttling can unschedule the stream to slow things down while a request is in progress
- BOOL readStreamIsScheduled;
-
- // Set to allow a request to automatically retry itself on timeout
- // Default is zero - timeout will stop the request
- int numberOfTimesToRetryOnTimeout;
-
- // The number of times this request has retried (when numberOfTimesToRetryOnTimeout > 0)
- int retryCount;
-
- // Temporarily set to YES when a closed connection forces a retry (internally, this stops ASIHTTPRequest cleaning up a temporary post body)
- BOOL willRetryRequest;
-
- // When YES, requests will keep the connection to the server alive for a while to allow subsequent requests to re-use it for a substantial speed-boost
- // Persistent connections will not be used if the server explicitly closes the connection
- // Default is YES
- BOOL shouldAttemptPersistentConnection;
-
- // Number of seconds to keep an inactive persistent connection open on the client side
- // Default is 60
- // If we get a keep-alive header, this is this value is replaced with how long the server told us to keep the connection around
- // A future date is created from this and used for expiring the connection, this is stored in connectionInfo's expires value
- NSTimeInterval persistentConnectionTimeoutSeconds;
-
- // Set to yes when an appropriate keep-alive header is found
- BOOL connectionCanBeReused;
-
- // Stores information about the persistent connection that is currently in use.
- // It may contain:
- // * The id we set for a particular connection, incremented every time we want to specify that we need a new connection
- // * The date that connection should expire
- // * A host, port and scheme for the connection. These are used to determine whether that connection can be reused by a subsequent request (all must match the new request)
- // * An id for the request that is currently using the connection. This is used for determining if a connection is available or not (we store a number rather than a reference to the request so we don't need to hang onto a request until the connection expires)
- // * A reference to the stream that is currently using the connection. This is necessary because we need to keep the old stream open until we've opened a new one.
- // The stream will be closed + released either when another request comes to use the connection, or when the timer fires to tell the connection to expire
- NSMutableDictionary *connectionInfo;
-
- // When set to YES, 301 and 302 automatic redirects will use the original method and and body, according to the HTTP 1.1 standard
- // Default is NO (to follow the behaviour of most browsers)
- BOOL shouldUseRFC2616RedirectBehaviour;
-
- // Used internally to record when a request has finished downloading data
- BOOL downloadComplete;
-
- // An ID that uniquely identifies this request - primarily used for debugging persistent connections
- NSNumber *requestID;
-
- // Will be ASIHTTPRequestRunLoopMode for synchronous requests, NSDefaultRunLoopMode for all other requests
- NSString *runLoopMode;
-
- // This timer checks up on the request every 0.25 seconds, and updates progress
- NSTimer *statusTimer;
-
- // The download cache that will be used for this request (use [ASIHTTPRequest setDefaultCache:cache] to configure a default cache
- id downloadCache;
-
- // The cache policy that will be used for this request - See ASICacheDelegate.h for possible values
- ASICachePolicy cachePolicy;
-
- // The cache storage policy that will be used for this request - See ASICacheDelegate.h for possible values
- ASICacheStoragePolicy cacheStoragePolicy;
-
- // Will be true when the response was pulled from the cache rather than downloaded
- BOOL didUseCachedResponse;
-
- // Set secondsToCache to use a custom time interval for expiring the response when it is stored in a cache
- NSTimeInterval secondsToCache;
-
- #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
- BOOL shouldContinueWhenAppEntersBackground;
- UIBackgroundTaskIdentifier backgroundTask;
- #endif
-
- // When downloading a gzipped response, the request will use this helper object to inflate the response
- ASIDataDecompressor *dataDecompressor;
-
- // Controls how responses with a gzipped encoding are inflated (decompressed)
- // When set to YES (This is the default):
- // * gzipped responses for requests without a downloadDestinationPath will be inflated only when [request responseData] / [request responseString] is called
- // * gzipped responses for requests with a downloadDestinationPath set will be inflated only when the request completes
- //
- // When set to NO
- // All requests will inflate the response as it comes in
- // * If the request has no downloadDestinationPath set, the raw (compressed) response is discarded and rawResponseData will contain the decompressed response
- // * If the request has a downloadDestinationPath, the raw response will be stored in temporaryFileDownloadPath as normal, the inflated response will be stored in temporaryUncompressedDataDownloadPath
- // Once the request completes successfully, the contents of temporaryUncompressedDataDownloadPath are moved into downloadDestinationPath
- //
- // Setting this to NO may be especially useful for users using ASIHTTPRequest in conjunction with a streaming parser, as it will allow partial gzipped responses to be inflated and passed on to the parser while the request is still running
- BOOL shouldWaitToInflateCompressedResponses;
-
- // Will be YES if this is a request created behind the scenes to download a PAC file - these requests do not attempt to configure their own proxies
- BOOL isPACFileRequest;
-
- // Used for downloading PAC files from http / https webservers
- ASIHTTPRequest *PACFileRequest;
-
- // Used for asynchronously reading PAC files from file:// URLs
- NSInputStream *PACFileReadStream;
-
- // Used for storing PAC data from file URLs as it is downloaded
- NSMutableData *PACFileData;
-
- // Set to YES in startSynchronous. Currently used by proxy detection to download PAC files synchronously when appropriate
- BOOL isSynchronous;
-
- #if NS_BLOCKS_AVAILABLE
- //block to execute when request starts
- ASIBasicBlock startedBlock;
-
- //block to execute when headers are received
- ASIHeadersBlock headersReceivedBlock;
-
- //block to execute when request completes successfully
- ASIBasicBlock completionBlock;
-
- //block to execute when request fails
- ASIBasicBlock failureBlock;
-
- //block for when bytes are received
- ASIProgressBlock bytesReceivedBlock;
-
- //block for when bytes are sent
- ASIProgressBlock bytesSentBlock;
-
- //block for when download size is incremented
- ASISizeBlock downloadSizeIncrementedBlock;
-
- //block for when upload size is incremented
- ASISizeBlock uploadSizeIncrementedBlock;
-
- //block for handling raw bytes received
- ASIDataBlock dataReceivedBlock;
-
- //block for handling authentication
- ASIBasicBlock authenticationNeededBlock;
-
- //block for handling proxy authentication
- ASIBasicBlock proxyAuthenticationNeededBlock;
-
- //block for handling redirections, if you want to
- ASIBasicBlock requestRedirectedBlock;
- #endif
-}
-
-#pragma mark init / dealloc
-
-// Should be an HTTP or HTTPS url, may include username and password if appropriate
-- (id)initWithURL:(NSURL *)newURL;
-
-// Convenience constructor
-+ (id)requestWithURL:(NSURL *)newURL;
-
-+ (id)requestWithURL:(NSURL *)newURL usingCache:(id )cache;
-+ (id)requestWithURL:(NSURL *)newURL usingCache:(id )cache andCachePolicy:(ASICachePolicy)policy;
-
-#if NS_BLOCKS_AVAILABLE
-- (void)setStartedBlock:(ASIBasicBlock)aStartedBlock;
-- (void)setHeadersReceivedBlock:(ASIHeadersBlock)aReceivedBlock;
-- (void)setCompletionBlock:(ASIBasicBlock)aCompletionBlock;
-- (void)setFailedBlock:(ASIBasicBlock)aFailedBlock;
-- (void)setBytesReceivedBlock:(ASIProgressBlock)aBytesReceivedBlock;
-- (void)setBytesSentBlock:(ASIProgressBlock)aBytesSentBlock;
-- (void)setDownloadSizeIncrementedBlock:(ASISizeBlock) aDownloadSizeIncrementedBlock;
-- (void)setUploadSizeIncrementedBlock:(ASISizeBlock) anUploadSizeIncrementedBlock;
-- (void)setDataReceivedBlock:(ASIDataBlock)aReceivedBlock;
-- (void)setAuthenticationNeededBlock:(ASIBasicBlock)anAuthenticationBlock;
-- (void)setProxyAuthenticationNeededBlock:(ASIBasicBlock)aProxyAuthenticationBlock;
-- (void)setRequestRedirectedBlock:(ASIBasicBlock)aRedirectBlock;
-#endif
-
-#pragma mark setup request
-
-// Add a custom header to the request
-- (void)addRequestHeader:(NSString *)header value:(NSString *)value;
-
-// Called during buildRequestHeaders and after a redirect to create a cookie header from request cookies and the global store
-- (void)applyCookieHeader;
-
-// Populate the request headers dictionary. Called before a request is started, or by a HEAD request that needs to borrow them
-- (void)buildRequestHeaders;
-
-// Used to apply authorization header to a request before it is sent (when shouldPresentCredentialsBeforeChallenge is YES)
-- (void)applyAuthorizationHeader;
-
-
-// Create the post body
-- (void)buildPostBody;
-
-// Called to add data to the post body. Will append to postBody when shouldStreamPostDataFromDisk is false, or write to postBodyWriteStream when true
-- (void)appendPostData:(NSData *)data;
-- (void)appendPostDataFromFile:(NSString *)file;
-
-#pragma mark get information about this request
-
-// Returns the contents of the result as an NSString (not appropriate for binary data - used responseData instead)
-- (NSString *)responseString;
-
-// Response data, automatically uncompressed where appropriate
-- (NSData *)responseData;
-
-// Returns true if the response was gzip compressed
-- (BOOL)isResponseCompressed;
-
-#pragma mark running a request
-
-
-// Run a request synchronously, and return control when the request completes or fails
-- (void)startSynchronous;
-
-// Run request in the background
-- (void)startAsynchronous;
-
-// Clears all delegates and blocks, then cancels the request
-- (void)clearDelegatesAndCancel;
-
-#pragma mark HEAD request
-
-// Used by ASINetworkQueue to create a HEAD request appropriate for this request with the same headers (though you can use it yourself)
-- (ASIHTTPRequest *)HEADRequest;
-
-#pragma mark upload/download progress
-
-// Called approximately every 0.25 seconds to update the progress delegates
-- (void)updateProgressIndicators;
-
-// Updates upload progress (notifies the queue and/or uploadProgressDelegate of this request)
-- (void)updateUploadProgress;
-
-// Updates download progress (notifies the queue and/or uploadProgressDelegate of this request)
-- (void)updateDownloadProgress;
-
-// Called when authorisation is needed, as we only find out we don't have permission to something when the upload is complete
-- (void)removeUploadProgressSoFar;
-
-// Called when we get a content-length header and shouldResetDownloadProgress is true
-- (void)incrementDownloadSizeBy:(long long)length;
-
-// Called when a request starts and shouldResetUploadProgress is true
-// Also called (with a negative length) to remove the size of the underlying buffer used for uploading
-- (void)incrementUploadSizeBy:(long long)length;
-
-// Helper method for interacting with progress indicators to abstract the details of different APIS (NSProgressIndicator and UIProgressView)
-+ (void)updateProgressIndicator:(id *)indicator withProgress:(unsigned long long)progress ofTotal:(unsigned long long)total;
-
-// Helper method used for performing invocations on the main thread (used for progress)
-+ (void)performSelector:(SEL)selector onTarget:(id *)target withObject:(id)object amount:(void *)amount callerToRetain:(id)caller;
-
-#pragma mark talking to delegates
-
-// Called when a request starts, lets the delegate know via didStartSelector
-- (void)requestStarted;
-
-// Called when a request receives response headers, lets the delegate know via didReceiveResponseHeadersSelector
-- (void)requestReceivedResponseHeaders:(NSDictionary *)newHeaders;
-
-// Called when a request completes successfully, lets the delegate know via didFinishSelector
-- (void)requestFinished;
-
-// Called when a request fails, and lets the delegate know via didFailSelector
-- (void)failWithError:(NSError *)theError;
-
-// Called to retry our request when our persistent connection is closed
-// Returns YES if we haven't already retried, and connection will be restarted
-// Otherwise, returns NO, and nothing will happen
-- (BOOL)retryUsingNewConnection;
-
-// Can be called by delegates from inside their willRedirectSelector implementations to restart the request with a new url
-- (void)redirectToURL:(NSURL *)newURL;
-
-#pragma mark parsing HTTP response headers
-
-// Reads the response headers to find the content length, encoding, cookies for the session
-// Also initiates request redirection when shouldRedirect is true
-// And works out if HTTP auth is required
-- (void)readResponseHeaders;
-
-// Attempts to set the correct encoding by looking at the Content-Type header, if this is one
-- (void)parseStringEncodingFromHeaders;
-
-+ (void)parseMimeType:(NSString **)mimeType andResponseEncoding:(NSStringEncoding *)stringEncoding fromContentType:(NSString *)contentType;
-
-#pragma mark http authentication stuff
-
-// Apply credentials to this request
-- (BOOL)applyCredentials:(NSDictionary *)newCredentials;
-- (BOOL)applyProxyCredentials:(NSDictionary *)newCredentials;
-
-// Attempt to obtain credentials for this request from the URL, username and password or keychain
-- (NSMutableDictionary *)findCredentials;
-- (NSMutableDictionary *)findProxyCredentials;
-
-// Unlock (unpause) the request thread so it can resume the request
-// Should be called by delegates when they have populated the authentication information after an authentication challenge
-- (void)retryUsingSuppliedCredentials;
-
-// Should be called by delegates when they wish to cancel authentication and stop
-- (void)cancelAuthentication;
-
-// Apply authentication information and resume the request after an authentication challenge
-- (void)attemptToApplyCredentialsAndResume;
-- (void)attemptToApplyProxyCredentialsAndResume;
-
-// Attempt to show the built-in authentication dialog, returns YES if credentials were supplied, NO if user cancelled dialog / dialog is disabled / running on main thread
-// Currently only used on iPhone OS
-- (BOOL)showProxyAuthenticationDialog;
-- (BOOL)showAuthenticationDialog;
-
-// Construct a basic authentication header from the username and password supplied, and add it to the request headers
-// Used when shouldPresentCredentialsBeforeChallenge is YES
-- (void)addBasicAuthenticationHeaderWithUsername:(NSString *)theUsername andPassword:(NSString *)thePassword;
-
-#pragma mark stream status handlers
-
-// CFnetwork event handlers
-- (void)handleNetworkEvent:(CFStreamEventType)type;
-- (void)handleBytesAvailable;
-- (void)handleStreamComplete;
-- (void)handleStreamError;
-
-#pragma mark cleanup
-
-// Cleans up and lets the queue know this operation is finished.
-// Appears in this header for subclassing only, do not call this method from outside your request!
-- (void)markAsFinished;
-
-// Cleans up temporary files. There's normally no reason to call these yourself, they are called automatically when a request completes or fails
-
-// Clean up the temporary file used to store the downloaded data when it comes in (if downloadDestinationPath is set)
-- (BOOL)removeTemporaryDownloadFile;
-
-// Clean up the temporary file used to store data that is inflated (decompressed) as it comes in
-- (BOOL)removeTemporaryUncompressedDownloadFile;
-
-// Clean up the temporary file used to store the request body (when shouldStreamPostDataFromDisk is YES)
-- (BOOL)removeTemporaryUploadFile;
-
-// Clean up the temporary file used to store a deflated (compressed) request body when shouldStreamPostDataFromDisk is YES
-- (BOOL)removeTemporaryCompressedUploadFile;
-
-// Remove a file on disk, returning NO and populating the passed error pointer if it fails
-+ (BOOL)removeFileAtPath:(NSString *)path error:(NSError **)err;
-
-#pragma mark persistent connections
-
-// Get the ID of the connection this request used (only really useful in tests and debugging)
-- (NSNumber *)connectionID;
-
-// Called automatically when a request is started to clean up any persistent connections that have expired
-+ (void)expirePersistentConnections;
-
-#pragma mark default time out
-
-+ (NSTimeInterval)defaultTimeOutSeconds;
-+ (void)setDefaultTimeOutSeconds:(NSTimeInterval)newTimeOutSeconds;
-
-#pragma mark client certificate
-
-- (void)setClientCertificateIdentity:(SecIdentityRef)anIdentity;
-
-#pragma mark session credentials
-
-+ (NSMutableArray *)sessionProxyCredentialsStore;
-+ (NSMutableArray *)sessionCredentialsStore;
-
-+ (void)storeProxyAuthenticationCredentialsInSessionStore:(NSDictionary *)credentials;
-+ (void)storeAuthenticationCredentialsInSessionStore:(NSDictionary *)credentials;
-
-+ (void)removeProxyAuthenticationCredentialsFromSessionStore:(NSDictionary *)credentials;
-+ (void)removeAuthenticationCredentialsFromSessionStore:(NSDictionary *)credentials;
-
-- (NSDictionary *)findSessionProxyAuthenticationCredentials;
-- (NSDictionary *)findSessionAuthenticationCredentials;
-
-#pragma mark keychain storage
-
-// Save credentials for this request to the keychain
-- (void)saveCredentialsToKeychain:(NSDictionary *)newCredentials;
-
-// Save credentials to the keychain
-+ (void)saveCredentials:(NSURLCredential *)credentials forHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
-+ (void)saveCredentials:(NSURLCredential *)credentials forProxy:(NSString *)host port:(int)port realm:(NSString *)realm;
-
-// Return credentials from the keychain
-+ (NSURLCredential *)savedCredentialsForHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
-+ (NSURLCredential *)savedCredentialsForProxy:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
-
-// Remove credentials from the keychain
-+ (void)removeCredentialsForHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm;
-+ (void)removeCredentialsForProxy:(NSString *)host port:(int)port realm:(NSString *)realm;
-
-// We keep track of any cookies we accept, so that we can remove them from the persistent store later
-+ (void)setSessionCookies:(NSMutableArray *)newSessionCookies;
-+ (NSMutableArray *)sessionCookies;
-
-// Adds a cookie to our list of cookies we've accepted, checking first for an old version of the same cookie and removing that
-+ (void)addSessionCookie:(NSHTTPCookie *)newCookie;
-
-// Dump all session data (authentication and cookies)
-+ (void)clearSession;
-
-#pragma mark get user agent
-
-// Will be used as a user agent if requests do not specify a custom user agent
-// Is only used when you have specified a Bundle Display Name (CFDisplayBundleName) or Bundle Name (CFBundleName) in your plist
-+ (NSString *)defaultUserAgentString;
-+ (void)setDefaultUserAgentString:(NSString *)agent;
-
-#pragma mark mime-type detection
-
-// Return the mime type for a file
-+ (NSString *)mimeTypeForFileAtPath:(NSString *)path;
-
-#pragma mark bandwidth measurement / throttling
-
-// The maximum number of bytes ALL requests can send / receive in a second
-// This is a rough figure. The actual amount used will be slightly more, this does not include HTTP headers
-+ (unsigned long)maxBandwidthPerSecond;
-+ (void)setMaxBandwidthPerSecond:(unsigned long)bytes;
-
-// Get a rough average (for the last 5 seconds) of how much bandwidth is being used, in bytes
-+ (unsigned long)averageBandwidthUsedPerSecond;
-
-- (void)performThrottling;
-
-// Will return YES is bandwidth throttling is currently in use
-+ (BOOL)isBandwidthThrottled;
-
-// Used internally to record bandwidth use, and by ASIInputStreams when uploading. It's probably best if you don't mess with this.
-+ (void)incrementBandwidthUsedInLastSecond:(unsigned long)bytes;
-
-// On iPhone, ASIHTTPRequest can automatically turn throttling on and off as the connection type changes between WWAN and WiFi
-
-#if TARGET_OS_IPHONE
-// Set to YES to automatically turn on throttling when WWAN is connected, and automatically turn it off when it isn't
-+ (void)setShouldThrottleBandwidthForWWAN:(BOOL)throttle;
-
-// Turns on throttling automatically when WWAN is connected using a custom limit, and turns it off automatically when it isn't
-+ (void)throttleBandwidthForWWANUsingLimit:(unsigned long)limit;
-
-#pragma mark reachability
-
-// Returns YES when an iPhone OS device is connected via WWAN, false when connected via WIFI or not connected
-+ (BOOL)isNetworkReachableViaWWAN;
-
-#endif
-
-#pragma mark queue
-
-// Returns the shared queue
-+ (NSOperationQueue *)sharedQueue;
-
-#pragma mark cache
-
-+ (void)setDefaultCache:(id )cache;
-+ (id )defaultCache;
-
-// Returns the maximum amount of data we can read as part of the current measurement period, and sleeps this thread if our allowance is used up
-+ (unsigned long)maxUploadReadLength;
-
-#pragma mark network activity
-
-+ (BOOL)isNetworkInUse;
-
-+ (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate;
-
-// Shows the network activity spinner thing on iOS. You may wish to override this to do something else in Mac projects
-+ (void)showNetworkActivityIndicator;
-
-// Hides the network activity spinner thing on iOS
-+ (void)hideNetworkActivityIndicator;
-
-#pragma mark miscellany
-
-// Used for generating Authorization header when using basic authentication when shouldPresentCredentialsBeforeChallenge is true
-// And also by ASIS3Request
-+ (NSString *)base64forData:(NSData *)theData;
-
-// Returns the expiration date for the request.
-// Calculated from the Expires response header property, unless maxAge is non-zero or
-// there exists a non-zero max-age property in the Cache-Control response header.
-+ (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Returns a date from a string in RFC1123 format
-+ (NSDate *)dateFromRFC1123String:(NSString *)string;
-
-
-// Used for detecting multitasking support at runtime (for backgrounding requests)
-#if TARGET_OS_IPHONE
-+ (BOOL)isMultitaskingSupported;
-#endif
-
-#pragma mark threading behaviour
-
-// In the default implementation, all requests run in a single background thread
-// Advanced users only: Override this method in a subclass for a different threading behaviour
-// Eg: return [NSThread mainThread] to run all requests in the main thread
-// Alternatively, you can create a thread on demand, or manage a pool of threads
-// Threads returned by this method will need to run the runloop in default mode (eg CFRunLoopRun())
-// Requests will stop the runloop when they complete
-// If you have multiple requests sharing the thread you'll need to restart the runloop when this happens
-+ (NSThread *)threadForRequest:(ASIHTTPRequest *)request;
-
-
-#pragma mark ===
-
-@property (retain) NSString *username;
-@property (retain) NSString *password;
-@property (retain) NSString *userAgentString;
-@property (retain) NSString *domain;
-
-@property (retain) NSString *proxyUsername;
-@property (retain) NSString *proxyPassword;
-@property (retain) NSString *proxyDomain;
-
-@property (retain) NSString *proxyHost;
-@property (assign) int proxyPort;
-@property (retain) NSString *proxyType;
-
-@property (retain,setter=setURL:, nonatomic) NSURL *url;
-@property (retain) NSURL *originalURL;
-@property (assign, nonatomic) id delegate;
-@property (retain, nonatomic) id queue;
-@property (assign, nonatomic) id uploadProgressDelegate;
-@property (assign, nonatomic) id downloadProgressDelegate;
-@property (assign) BOOL useKeychainPersistence;
-@property (assign) BOOL useSessionPersistence;
-@property (retain) NSString *downloadDestinationPath;
-@property (retain) NSString *temporaryFileDownloadPath;
-@property (retain) NSString *temporaryUncompressedDataDownloadPath;
-@property (assign) SEL didStartSelector;
-@property (assign) SEL didReceiveResponseHeadersSelector;
-@property (assign) SEL willRedirectSelector;
-@property (assign) SEL didFinishSelector;
-@property (assign) SEL didFailSelector;
-@property (assign) SEL didReceiveDataSelector;
-@property (retain,readonly) NSString *authenticationRealm;
-@property (retain,readonly) NSString *proxyAuthenticationRealm;
-@property (retain) NSError *error;
-@property (assign,readonly) BOOL complete;
-@property (retain) NSDictionary *responseHeaders;
-@property (retain) NSMutableDictionary *requestHeaders;
-@property (retain) NSMutableArray *requestCookies;
-@property (retain,readonly) NSArray *responseCookies;
-@property (assign) BOOL useCookiePersistence;
-@property (retain) NSDictionary *requestCredentials;
-@property (retain) NSDictionary *proxyCredentials;
-@property (assign,readonly) int responseStatusCode;
-@property (retain,readonly) NSString *responseStatusMessage;
-@property (retain) NSMutableData *rawResponseData;
-@property (assign) NSTimeInterval timeOutSeconds;
-@property (retain, nonatomic) NSString *requestMethod;
-@property (retain) NSMutableData *postBody;
-@property (assign) unsigned long long contentLength;
-@property (assign) unsigned long long postLength;
-@property (assign) BOOL shouldResetDownloadProgress;
-@property (assign) BOOL shouldResetUploadProgress;
-@property (assign) ASIHTTPRequest *mainRequest;
-@property (assign) BOOL showAccurateProgress;
-@property (assign) unsigned long long totalBytesRead;
-@property (assign) unsigned long long totalBytesSent;
-@property (assign) NSStringEncoding defaultResponseEncoding;
-@property (assign) NSStringEncoding responseEncoding;
-@property (assign) BOOL allowCompressedResponse;
-@property (assign) BOOL allowResumeForFileDownloads;
-@property (retain) NSDictionary *userInfo;
-@property (assign) NSInteger tag;
-@property (retain) NSString *postBodyFilePath;
-@property (assign) BOOL shouldStreamPostDataFromDisk;
-@property (assign) BOOL didCreateTemporaryPostDataFile;
-@property (assign) BOOL useHTTPVersionOne;
-@property (assign, readonly) unsigned long long partialDownloadSize;
-@property (assign) BOOL shouldRedirect;
-@property (assign) BOOL validatesSecureCertificate;
-@property (assign) BOOL shouldCompressRequestBody;
-@property (retain) NSURL *PACurl;
-@property (retain) NSString *authenticationScheme;
-@property (retain) NSString *proxyAuthenticationScheme;
-@property (assign) BOOL shouldPresentAuthenticationDialog;
-@property (assign) BOOL shouldPresentProxyAuthenticationDialog;
-@property (assign, readonly) ASIAuthenticationState authenticationNeeded;
-@property (assign) BOOL shouldPresentCredentialsBeforeChallenge;
-@property (assign, readonly) int authenticationRetryCount;
-@property (assign, readonly) int proxyAuthenticationRetryCount;
-@property (assign) BOOL haveBuiltRequestHeaders;
-@property (assign, nonatomic) BOOL haveBuiltPostBody;
-@property (assign, readonly) BOOL inProgress;
-@property (assign) int numberOfTimesToRetryOnTimeout;
-@property (assign, readonly) int retryCount;
-@property (assign) BOOL shouldAttemptPersistentConnection;
-@property (assign) NSTimeInterval persistentConnectionTimeoutSeconds;
-@property (assign) BOOL shouldUseRFC2616RedirectBehaviour;
-@property (assign, readonly) BOOL connectionCanBeReused;
-@property (retain, readonly) NSNumber *requestID;
-@property (assign) id downloadCache;
-@property (assign) ASICachePolicy cachePolicy;
-@property (assign) ASICacheStoragePolicy cacheStoragePolicy;
-@property (assign, readonly) BOOL didUseCachedResponse;
-@property (assign) NSTimeInterval secondsToCache;
-@property (retain) NSArray *clientCertificates;
-#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
-@property (assign) BOOL shouldContinueWhenAppEntersBackground;
-#endif
-@property (retain) ASIDataDecompressor *dataDecompressor;
-@property (assign) BOOL shouldWaitToInflateCompressedResponses;
-
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequest.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequest.m
deleted file mode 100644
index ece66b8a..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequest.m
+++ /dev/null
@@ -1,5134 +0,0 @@
-//
-// ASIHTTPRequest.m
-//
-// Created by Ben Copsey on 04/10/2007.
-// Copyright 2007-2011 All-Seeing Interactive. All rights reserved.
-//
-// A guide to the main features is available at:
-// http://allseeing-i.com/ASIHTTPRequest
-//
-// Portions are based on the ImageClient example from Apple:
-// See: http://developer.apple.com/samplecode/ImageClient/listing37.html
-
-#import "ASIHTTPRequest.h"
-
-#if TARGET_OS_IPHONE
-#import "Reachability.h"
-#import "ASIAuthenticationDialog.h"
-#import
-#else
-#import
-#endif
-#import "ASIInputStream.h"
-#import "ASIDataDecompressor.h"
-#import "ASIDataCompressor.h"
-
-// Automatically set on build
-NSString *ASIHTTPRequestVersion = @"v1.8.1-61 2011-09-19";
-
-static NSString *defaultUserAgent = nil;
-
-NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";
-
-static NSString *ASIHTTPRequestRunLoopMode = @"ASIHTTPRequestRunLoopMode";
-
-static const CFOptionFlags kNetworkEvents = kCFStreamEventHasBytesAvailable | kCFStreamEventEndEncountered | kCFStreamEventErrorOccurred;
-
-// In memory caches of credentials, used on when useSessionPersistence is YES
-static NSMutableArray *sessionCredentialsStore = nil;
-static NSMutableArray *sessionProxyCredentialsStore = nil;
-
-// This lock mediates access to session credentials
-static NSRecursiveLock *sessionCredentialsLock = nil;
-
-// We keep track of cookies we have received here so we can remove them from the sharedHTTPCookieStorage later
-static NSMutableArray *sessionCookies = nil;
-
-// The number of times we will allow requests to redirect before we fail with a redirection error
-const int RedirectionLimit = 5;
-
-// The default number of seconds to use for a timeout
-static NSTimeInterval defaultTimeOutSeconds = 10;
-
-static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventType type, void *clientCallBackInfo) {
- [((ASIHTTPRequest*)clientCallBackInfo) handleNetworkEvent: type];
-}
-
-// This lock prevents the operation from being cancelled while it is trying to update the progress, and vice versa
-static NSRecursiveLock *progressLock;
-
-static NSError *ASIRequestCancelledError;
-static NSError *ASIRequestTimedOutError;
-static NSError *ASIAuthenticationError;
-static NSError *ASIUnableToCreateRequestError;
-static NSError *ASITooMuchRedirectionError;
-
-static NSMutableArray *bandwidthUsageTracker = nil;
-static unsigned long averageBandwidthUsedPerSecond = 0;
-
-// These are used for queuing persistent connections on the same connection
-
-// Incremented every time we specify we want a new connection
-static unsigned int nextConnectionNumberToCreate = 0;
-
-// An array of connectionInfo dictionaries.
-// When attempting a persistent connection, we look here to try to find an existing connection to the same server that is currently not in use
-static NSMutableArray *persistentConnectionsPool = nil;
-
-// Mediates access to the persistent connections pool
-static NSRecursiveLock *connectionsLock = nil;
-
-// Each request gets a new id, we store this rather than a ref to the request itself in the connectionInfo dictionary.
-// We do this so we don't have to keep the request around while we wait for the connection to expire
-static unsigned int nextRequestID = 0;
-
-// Records how much bandwidth all requests combined have used in the last second
-static unsigned long bandwidthUsedInLastSecond = 0;
-
-// A date one second in the future from the time it was created
-static NSDate *bandwidthMeasurementDate = nil;
-
-// Since throttling variables are shared among all requests, we'll use a lock to mediate access
-static NSLock *bandwidthThrottlingLock = nil;
-
-// the maximum number of bytes that can be transmitted in one second
-static unsigned long maxBandwidthPerSecond = 0;
-
-// A default figure for throttling bandwidth on mobile devices
-unsigned long const ASIWWANBandwidthThrottleAmount = 14800;
-
-#if TARGET_OS_IPHONE
-// YES when bandwidth throttling is active
-// This flag does not denote whether throttling is turned on - rather whether it is currently in use
-// It will be set to NO when throttling was turned on with setShouldThrottleBandwidthForWWAN, but a WI-FI connection is active
-static BOOL isBandwidthThrottled = NO;
-
-// When YES, bandwidth will be automatically throttled when using WWAN (3G/Edge/GPRS)
-// Wifi will not be throttled
-static BOOL shouldThrottleBandwidthForWWANOnly = NO;
-#endif
-
-// Mediates access to the session cookies so requests
-static NSRecursiveLock *sessionCookiesLock = nil;
-
-// This lock ensures delegates only receive one notification that authentication is required at once
-// When using ASIAuthenticationDialogs, it also ensures only one dialog is shown at once
-// If a request can't acquire the lock immediately, it means a dialog is being shown or a delegate is handling the authentication challenge
-// Once it gets the lock, it will try to look for existing credentials again rather than showing the dialog / notifying the delegate
-// This is so it can make use of any credentials supplied for the other request, if they are appropriate
-static NSRecursiveLock *delegateAuthenticationLock = nil;
-
-// When throttling bandwidth, Set to a date in future that we will allow all requests to wake up and reschedule their streams
-static NSDate *throttleWakeUpTime = nil;
-
-static id defaultCache = nil;
-
-// Used for tracking when requests are using the network
-static unsigned int runningRequestCount = 0;
-
-// You can use [ASIHTTPRequest setShouldUpdateNetworkActivityIndicator:NO] if you want to manage it yourself
-// Alternatively, override showNetworkActivityIndicator / hideNetworkActivityIndicator
-// By default this does nothing on Mac OS X, but again override the above methods for a different behaviour
-static BOOL shouldUpdateNetworkActivityIndicator = YES;
-
-// The thread all requests will run on
-// Hangs around forever, but will be blocked unless there are requests underway
-static NSThread *networkThread = nil;
-
-static NSOperationQueue *sharedQueue = nil;
-
-// Private stuff
-@interface ASIHTTPRequest ()
-
-- (void)cancelLoad;
-
-- (void)destroyReadStream;
-- (void)scheduleReadStream;
-- (void)unscheduleReadStream;
-
-- (BOOL)willAskDelegateForCredentials;
-- (BOOL)willAskDelegateForProxyCredentials;
-- (void)askDelegateForProxyCredentials;
-- (void)askDelegateForCredentials;
-- (void)failAuthentication;
-
-+ (void)measureBandwidthUsage;
-+ (void)recordBandwidthUsage;
-
-- (void)startRequest;
-- (void)updateStatus:(NSTimer *)timer;
-- (void)checkRequestStatus;
-- (void)reportFailure;
-- (void)reportFinished;
-- (void)markAsFinished;
-- (void)performRedirect;
-- (BOOL)shouldTimeOut;
-- (BOOL)willRedirect;
-- (BOOL)willAskDelegateToConfirmRedirect;
-
-+ (void)performInvocation:(NSInvocation *)invocation onTarget:(id *)target releasingObject:(id)objectToRelease;
-+ (void)hideNetworkActivityIndicatorAfterDelay;
-+ (void)hideNetworkActivityIndicatorIfNeeeded;
-+ (void)runRequests;
-
-// Handling Proxy autodetection and PAC file downloads
-- (BOOL)configureProxies;
-- (void)fetchPACFile;
-- (void)finishedDownloadingPACFile:(ASIHTTPRequest *)theRequest;
-- (void)runPACScript:(NSString *)script;
-- (void)timeOutPACRead;
-
-- (void)useDataFromCache;
-
-// Called to update the size of a partial download when starting a request, or retrying after a timeout
-- (void)updatePartialDownloadSize;
-
-#if TARGET_OS_IPHONE
-+ (void)registerForNetworkReachabilityNotifications;
-+ (void)unsubscribeFromNetworkReachabilityNotifications;
-// Called when the status of the network changes
-+ (void)reachabilityChanged:(NSNotification *)note;
-#endif
-
-#if NS_BLOCKS_AVAILABLE
-- (void)performBlockOnMainThread:(ASIBasicBlock)block;
-- (void)releaseBlocksOnMainThread;
-+ (void)releaseBlocks:(NSArray *)blocks;
-- (void)callBlock:(ASIBasicBlock)block;
-#endif
-
-
-
-
-
-@property (assign) BOOL complete;
-@property (retain) NSArray *responseCookies;
-@property (assign) int responseStatusCode;
-@property (retain, nonatomic) NSDate *lastActivityTime;
-
-@property (assign) unsigned long long partialDownloadSize;
-@property (assign, nonatomic) unsigned long long uploadBufferSize;
-@property (retain, nonatomic) NSOutputStream *postBodyWriteStream;
-@property (retain, nonatomic) NSInputStream *postBodyReadStream;
-@property (assign, nonatomic) unsigned long long lastBytesRead;
-@property (assign, nonatomic) unsigned long long lastBytesSent;
-@property (retain) NSRecursiveLock *cancelledLock;
-@property (retain, nonatomic) NSOutputStream *fileDownloadOutputStream;
-@property (retain, nonatomic) NSOutputStream *inflatedFileDownloadOutputStream;
-@property (assign) int authenticationRetryCount;
-@property (assign) int proxyAuthenticationRetryCount;
-@property (assign, nonatomic) BOOL updatedProgress;
-@property (assign, nonatomic) BOOL needsRedirect;
-@property (assign, nonatomic) int redirectCount;
-@property (retain, nonatomic) NSData *compressedPostBody;
-@property (retain, nonatomic) NSString *compressedPostBodyFilePath;
-@property (retain) NSString *authenticationRealm;
-@property (retain) NSString *proxyAuthenticationRealm;
-@property (retain) NSString *responseStatusMessage;
-@property (assign) BOOL inProgress;
-@property (assign) int retryCount;
-@property (assign) BOOL willRetryRequest;
-@property (assign) BOOL connectionCanBeReused;
-@property (retain, nonatomic) NSMutableDictionary *connectionInfo;
-@property (retain, nonatomic) NSInputStream *readStream;
-@property (assign) ASIAuthenticationState authenticationNeeded;
-@property (assign, nonatomic) BOOL readStreamIsScheduled;
-@property (assign, nonatomic) BOOL downloadComplete;
-@property (retain) NSNumber *requestID;
-@property (assign, nonatomic) NSString *runLoopMode;
-@property (retain, nonatomic) NSTimer *statusTimer;
-@property (assign) BOOL didUseCachedResponse;
-@property (retain, nonatomic) NSURL *redirectURL;
-
-@property (assign, nonatomic) BOOL isPACFileRequest;
-@property (retain, nonatomic) ASIHTTPRequest *PACFileRequest;
-@property (retain, nonatomic) NSInputStream *PACFileReadStream;
-@property (retain, nonatomic) NSMutableData *PACFileData;
-
-@property (assign, nonatomic, setter=setSynchronous:) BOOL isSynchronous;
-@end
-
-
-@implementation ASIHTTPRequest
-
-#pragma mark init / dealloc
-
-+ (void)initialize
-{
- if (self == [ASIHTTPRequest class]) {
- persistentConnectionsPool = [[NSMutableArray alloc] init];
- connectionsLock = [[NSRecursiveLock alloc] init];
- progressLock = [[NSRecursiveLock alloc] init];
- bandwidthThrottlingLock = [[NSLock alloc] init];
- sessionCookiesLock = [[NSRecursiveLock alloc] init];
- sessionCredentialsLock = [[NSRecursiveLock alloc] init];
- delegateAuthenticationLock = [[NSRecursiveLock alloc] init];
- bandwidthUsageTracker = [[NSMutableArray alloc] initWithCapacity:5];
- ASIRequestTimedOutError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIRequestTimedOutErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"The request timed out",NSLocalizedDescriptionKey,nil]];
- ASIAuthenticationError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIAuthenticationErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Authentication needed",NSLocalizedDescriptionKey,nil]];
- ASIRequestCancelledError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIRequestCancelledErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"The request was cancelled",NSLocalizedDescriptionKey,nil]];
- ASIUnableToCreateRequestError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIUnableToCreateRequestErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to create request (bad url?)",NSLocalizedDescriptionKey,nil]];
- ASITooMuchRedirectionError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASITooMuchRedirectionErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"The request failed because it redirected too many times",NSLocalizedDescriptionKey,nil]];
- sharedQueue = [[NSOperationQueue alloc] init];
- [sharedQueue setMaxConcurrentOperationCount:4];
-
- }
-}
-
-
-- (id)initWithURL:(NSURL *)newURL
-{
- self = [self init];
- [self setRequestMethod:@"GET"];
-
- [self setRunLoopMode:NSDefaultRunLoopMode];
- [self setShouldAttemptPersistentConnection:YES];
- [self setPersistentConnectionTimeoutSeconds:60.0];
- [self setShouldPresentCredentialsBeforeChallenge:YES];
- [self setShouldRedirect:YES];
- [self setShowAccurateProgress:YES];
- [self setShouldResetDownloadProgress:YES];
- [self setShouldResetUploadProgress:YES];
- [self setAllowCompressedResponse:YES];
- [self setShouldWaitToInflateCompressedResponses:YES];
- [self setDefaultResponseEncoding:NSISOLatin1StringEncoding];
- [self setShouldPresentProxyAuthenticationDialog:YES];
-
- [self setTimeOutSeconds:[ASIHTTPRequest defaultTimeOutSeconds]];
- [self setUseSessionPersistence:YES];
- [self setUseCookiePersistence:YES];
- [self setValidatesSecureCertificate:YES];
- [self setRequestCookies:[[[NSMutableArray alloc] init] autorelease]];
- [self setDidStartSelector:@selector(requestStarted:)];
- [self setDidReceiveResponseHeadersSelector:@selector(request:didReceiveResponseHeaders:)];
- [self setWillRedirectSelector:@selector(request:willRedirectToURL:)];
- [self setDidFinishSelector:@selector(requestFinished:)];
- [self setDidFailSelector:@selector(requestFailed:)];
- [self setDidReceiveDataSelector:@selector(request:didReceiveData:)];
- [self setURL:newURL];
- [self setCancelledLock:[[[NSRecursiveLock alloc] init] autorelease]];
- [self setDownloadCache:[[self class] defaultCache]];
- return self;
-}
-
-+ (id)requestWithURL:(NSURL *)newURL
-{
- return [[[self alloc] initWithURL:newURL] autorelease];
-}
-
-+ (id)requestWithURL:(NSURL *)newURL usingCache:(id )cache
-{
- return [self requestWithURL:newURL usingCache:cache andCachePolicy:ASIUseDefaultCachePolicy];
-}
-
-+ (id)requestWithURL:(NSURL *)newURL usingCache:(id )cache andCachePolicy:(ASICachePolicy)policy
-{
- ASIHTTPRequest *request = [[[self alloc] initWithURL:newURL] autorelease];
- [request setDownloadCache:cache];
- [request setCachePolicy:policy];
- return request;
-}
-
-- (void)dealloc
-{
- [self setAuthenticationNeeded:ASINoAuthenticationNeededYet];
- if (requestAuthentication) {
- CFRelease(requestAuthentication);
- }
- if (proxyAuthentication) {
- CFRelease(proxyAuthentication);
- }
- if (request) {
- CFRelease(request);
- }
- if (clientCertificateIdentity) {
- CFRelease(clientCertificateIdentity);
- }
- [self cancelLoad];
- [redirectURL release];
- [statusTimer invalidate];
- [statusTimer release];
- [queue release];
- [userInfo release];
- [postBody release];
- [compressedPostBody release];
- [error release];
- [requestHeaders release];
- [requestCookies release];
- [downloadDestinationPath release];
- [temporaryFileDownloadPath release];
- [temporaryUncompressedDataDownloadPath release];
- [fileDownloadOutputStream release];
- [inflatedFileDownloadOutputStream release];
- [username release];
- [password release];
- [domain release];
- [authenticationRealm release];
- [authenticationScheme release];
- [requestCredentials release];
- [proxyHost release];
- [proxyType release];
- [proxyUsername release];
- [proxyPassword release];
- [proxyDomain release];
- [proxyAuthenticationRealm release];
- [proxyAuthenticationScheme release];
- [proxyCredentials release];
- [url release];
- [originalURL release];
- [lastActivityTime release];
- [responseCookies release];
- [rawResponseData release];
- [responseHeaders release];
- [requestMethod release];
- [cancelledLock release];
- [postBodyFilePath release];
- [compressedPostBodyFilePath release];
- [postBodyWriteStream release];
- [postBodyReadStream release];
- [PACurl release];
- [clientCertificates release];
- [responseStatusMessage release];
- [connectionInfo release];
- [requestID release];
- [dataDecompressor release];
- [userAgentString release];
-
- #if NS_BLOCKS_AVAILABLE
- [self releaseBlocksOnMainThread];
- #endif
-
- [super dealloc];
-}
-
-#if NS_BLOCKS_AVAILABLE
-- (void)releaseBlocksOnMainThread
-{
- NSMutableArray *blocks = [NSMutableArray array];
- if (completionBlock) {
- [blocks addObject:completionBlock];
- [completionBlock release];
- completionBlock = nil;
- }
- if (failureBlock) {
- [blocks addObject:failureBlock];
- [failureBlock release];
- failureBlock = nil;
- }
- if (startedBlock) {
- [blocks addObject:startedBlock];
- [startedBlock release];
- startedBlock = nil;
- }
- if (headersReceivedBlock) {
- [blocks addObject:headersReceivedBlock];
- [headersReceivedBlock release];
- headersReceivedBlock = nil;
- }
- if (bytesReceivedBlock) {
- [blocks addObject:bytesReceivedBlock];
- [bytesReceivedBlock release];
- bytesReceivedBlock = nil;
- }
- if (bytesSentBlock) {
- [blocks addObject:bytesSentBlock];
- [bytesSentBlock release];
- bytesSentBlock = nil;
- }
- if (downloadSizeIncrementedBlock) {
- [blocks addObject:downloadSizeIncrementedBlock];
- [downloadSizeIncrementedBlock release];
- downloadSizeIncrementedBlock = nil;
- }
- if (uploadSizeIncrementedBlock) {
- [blocks addObject:uploadSizeIncrementedBlock];
- [uploadSizeIncrementedBlock release];
- uploadSizeIncrementedBlock = nil;
- }
- if (dataReceivedBlock) {
- [blocks addObject:dataReceivedBlock];
- [dataReceivedBlock release];
- dataReceivedBlock = nil;
- }
- if (proxyAuthenticationNeededBlock) {
- [blocks addObject:proxyAuthenticationNeededBlock];
- [proxyAuthenticationNeededBlock release];
- proxyAuthenticationNeededBlock = nil;
- }
- if (authenticationNeededBlock) {
- [blocks addObject:authenticationNeededBlock];
- [authenticationNeededBlock release];
- authenticationNeededBlock = nil;
- }
- if (requestRedirectedBlock) {
- [blocks addObject:requestRedirectedBlock];
- [requestRedirectedBlock release];
- requestRedirectedBlock = nil;
- }
- [[self class] performSelectorOnMainThread:@selector(releaseBlocks:) withObject:blocks waitUntilDone:[NSThread isMainThread]];
-}
-// Always called on main thread
-+ (void)releaseBlocks:(NSArray *)blocks
-{
- // Blocks will be released when this method exits
-}
-#endif
-
-
-#pragma mark setup request
-
-- (void)addRequestHeader:(NSString *)header value:(NSString *)value
-{
- if (!requestHeaders) {
- [self setRequestHeaders:[NSMutableDictionary dictionaryWithCapacity:1]];
- }
- [requestHeaders setObject:value forKey:header];
-}
-
-// This function will be called either just before a request starts, or when postLength is needed, whichever comes first
-// postLength must be set by the time this function is complete
-- (void)buildPostBody
-{
-
- if ([self haveBuiltPostBody]) {
- return;
- }
-
- // Are we submitting the request body from a file on disk
- if ([self postBodyFilePath]) {
-
- // If we were writing to the post body via appendPostData or appendPostDataFromFile, close the write stream
- if ([self postBodyWriteStream]) {
- [[self postBodyWriteStream] close];
- [self setPostBodyWriteStream:nil];
- }
-
-
- NSString *path;
- if ([self shouldCompressRequestBody]) {
- if (![self compressedPostBodyFilePath]) {
- [self setCompressedPostBodyFilePath:[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]];
-
- NSError *err = nil;
- if (![ASIDataCompressor compressDataFromFile:[self postBodyFilePath] toFile:[self compressedPostBodyFilePath] error:&err]) {
- [self failWithError:err];
- return;
- }
- }
- path = [self compressedPostBodyFilePath];
- } else {
- path = [self postBodyFilePath];
- }
- NSError *err = nil;
- [self setPostLength:[[[[[NSFileManager alloc] init] autorelease] attributesOfItemAtPath:path error:&err] fileSize]];
- if (err) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to get attributes for file at path '%@'",path],NSLocalizedDescriptionKey,error,NSUnderlyingErrorKey,nil]]];
- return;
- }
-
- // Otherwise, we have an in-memory request body
- } else {
- if ([self shouldCompressRequestBody]) {
- NSError *err = nil;
- NSData *compressedBody = [ASIDataCompressor compressData:[self postBody] error:&err];
- if (err) {
- [self failWithError:err];
- return;
- }
- [self setCompressedPostBody:compressedBody];
- [self setPostLength:[[self compressedPostBody] length]];
- } else {
- [self setPostLength:[[self postBody] length]];
- }
- }
-
- if ([self postLength] > 0) {
- if ([requestMethod isEqualToString:@"GET"] || [requestMethod isEqualToString:@"DELETE"] || [requestMethod isEqualToString:@"HEAD"]) {
- [self setRequestMethod:@"POST"];
- }
- [self addRequestHeader:@"Content-Length" value:[NSString stringWithFormat:@"%llu",[self postLength]]];
- }
- [self setHaveBuiltPostBody:YES];
-
-}
-
-// Sets up storage for the post body
-- (void)setupPostBody
-{
- if ([self shouldStreamPostDataFromDisk]) {
- if (![self postBodyFilePath]) {
- [self setPostBodyFilePath:[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]];
- [self setDidCreateTemporaryPostDataFile:YES];
- }
- if (![self postBodyWriteStream]) {
- [self setPostBodyWriteStream:[[[NSOutputStream alloc] initToFileAtPath:[self postBodyFilePath] append:NO] autorelease]];
- [[self postBodyWriteStream] open];
- }
- } else {
- if (![self postBody]) {
- [self setPostBody:[[[NSMutableData alloc] init] autorelease]];
- }
- }
-}
-
-- (void)appendPostData:(NSData *)data
-{
- [self setupPostBody];
- if ([data length] == 0) {
- return;
- }
- if ([self shouldStreamPostDataFromDisk]) {
- [[self postBodyWriteStream] write:[data bytes] maxLength:[data length]];
- } else {
- [[self postBody] appendData:data];
- }
-}
-
-- (void)appendPostDataFromFile:(NSString *)file
-{
- [self setupPostBody];
- NSInputStream *stream = [[[NSInputStream alloc] initWithFileAtPath:file] autorelease];
- [stream open];
- NSUInteger bytesRead;
- while ([stream hasBytesAvailable]) {
-
- unsigned char buffer[1024*256];
- bytesRead = [stream read:buffer maxLength:sizeof(buffer)];
- if (bytesRead == 0) {
- break;
- }
- if ([self shouldStreamPostDataFromDisk]) {
- [[self postBodyWriteStream] write:buffer maxLength:bytesRead];
- } else {
- [[self postBody] appendData:[NSData dataWithBytes:buffer length:bytesRead]];
- }
- }
- [stream close];
-}
-
-- (NSString *)requestMethod
-{
- [[self cancelledLock] lock];
- NSString *m = requestMethod;
- [[self cancelledLock] unlock];
- return m;
-}
-
-- (void)setRequestMethod:(NSString *)newRequestMethod
-{
- [[self cancelledLock] lock];
- if (requestMethod != newRequestMethod) {
- [requestMethod release];
- requestMethod = [newRequestMethod retain];
- if ([requestMethod isEqualToString:@"POST"] || [requestMethod isEqualToString:@"PUT"] || [postBody length] || postBodyFilePath) {
- [self setShouldAttemptPersistentConnection:NO];
- }
- }
- [[self cancelledLock] unlock];
-}
-
-- (NSURL *)url
-{
- [[self cancelledLock] lock];
- NSURL *u = url;
- [[self cancelledLock] unlock];
- return u;
-}
-
-
-- (void)setURL:(NSURL *)newURL
-{
- [[self cancelledLock] lock];
- if ([newURL isEqual:[self url]]) {
- [[self cancelledLock] unlock];
- return;
- }
- [url release];
- url = [newURL retain];
- if (requestAuthentication) {
- CFRelease(requestAuthentication);
- requestAuthentication = NULL;
- }
- if (proxyAuthentication) {
- CFRelease(proxyAuthentication);
- proxyAuthentication = NULL;
- }
- if (request) {
- CFRelease(request);
- request = NULL;
- }
- [self setRedirectURL:nil];
- [[self cancelledLock] unlock];
-}
-
-- (id)delegate
-{
- [[self cancelledLock] lock];
- id d = delegate;
- [[self cancelledLock] unlock];
- return d;
-}
-
-- (void)setDelegate:(id)newDelegate
-{
- [[self cancelledLock] lock];
- delegate = newDelegate;
- [[self cancelledLock] unlock];
-}
-
-- (id)queue
-{
- [[self cancelledLock] lock];
- id q = queue;
- [[self cancelledLock] unlock];
- return q;
-}
-
-
-- (void)setQueue:(id)newQueue
-{
- [[self cancelledLock] lock];
- if (newQueue != queue) {
- [queue release];
- queue = [newQueue retain];
- }
- [[self cancelledLock] unlock];
-}
-
-#pragma mark get information about this request
-
-// cancel the request - this must be run on the same thread as the request is running on
-- (void)cancelOnRequestThread
-{
- #if DEBUG_REQUEST_STATUS
- ASI_DEBUG_LOG(@"[STATUS] Request cancelled: %@",self);
- #endif
-
- [[self cancelledLock] lock];
-
- if ([self isCancelled] || [self complete]) {
- [[self cancelledLock] unlock];
- return;
- }
- [self failWithError:ASIRequestCancelledError];
- [self setComplete:YES];
- [self cancelLoad];
-
- CFRetain(self);
- [self willChangeValueForKey:@"isCancelled"];
- cancelled = YES;
- [self didChangeValueForKey:@"isCancelled"];
-
- [[self cancelledLock] unlock];
- CFRelease(self);
-}
-
-- (void)cancel
-{
- [self performSelector:@selector(cancelOnRequestThread) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
-}
-
-- (void)clearDelegatesAndCancel
-{
- [[self cancelledLock] lock];
-
- // Clear delegates
- [self setDelegate:nil];
- [self setQueue:nil];
- [self setDownloadProgressDelegate:nil];
- [self setUploadProgressDelegate:nil];
-
- #if NS_BLOCKS_AVAILABLE
- // Clear blocks
- [self releaseBlocksOnMainThread];
- #endif
-
- [[self cancelledLock] unlock];
- [self cancel];
-}
-
-
-- (BOOL)isCancelled
-{
- BOOL result;
-
- [[self cancelledLock] lock];
- result = cancelled;
- [[self cancelledLock] unlock];
-
- return result;
-}
-
-// Call this method to get the received data as an NSString. Don't use for binary data!
-- (NSString *)responseString
-{
- NSData *data = [self responseData];
- if (!data) {
- return nil;
- }
-
- return [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:[self responseEncoding]] autorelease];
-}
-
-- (BOOL)isResponseCompressed
-{
- NSString *encoding = [[self responseHeaders] objectForKey:@"Content-Encoding"];
- return encoding && [encoding rangeOfString:@"gzip"].location != NSNotFound;
-}
-
-- (NSData *)responseData
-{
- if ([self isResponseCompressed] && [self shouldWaitToInflateCompressedResponses]) {
- return [ASIDataDecompressor uncompressData:[self rawResponseData] error:NULL];
- } else {
- return [self rawResponseData];
- }
- return nil;
-}
-
-#pragma mark running a request
-
-- (void)startSynchronous
-{
-#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[STATUS] Starting synchronous request %@",self);
-#endif
- [self setSynchronous:YES];
- [self setRunLoopMode:ASIHTTPRequestRunLoopMode];
- [self setInProgress:YES];
-
- if (![self isCancelled] && ![self complete]) {
- [self main];
- while (!complete) {
- [[NSRunLoop currentRunLoop] runMode:[self runLoopMode] beforeDate:[NSDate distantFuture]];
- }
- }
-
- [self setInProgress:NO];
-}
-
-- (void)start
-{
- [self setInProgress:YES];
- [self performSelector:@selector(main) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
-}
-
-- (void)startAsynchronous
-{
-#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[STATUS] Starting asynchronous request %@",self);
-#endif
- [sharedQueue addOperation:self];
-}
-
-#pragma mark concurrency
-
-- (BOOL)isConcurrent
-{
- return YES;
-}
-
-- (BOOL)isFinished
-{
- return finished;
-}
-
-- (BOOL)isExecuting {
- return [self inProgress];
-}
-
-#pragma mark request logic
-
-// Create the request
-- (void)main
-{
- @try {
-
- [[self cancelledLock] lock];
-
- #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
- if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) {
- if (!backgroundTask || backgroundTask == UIBackgroundTaskInvalid) {
- backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
- // Synchronize the cleanup call on the main thread in case
- // the task actually finishes at around the same time.
- dispatch_async(dispatch_get_main_queue(), ^{
- if (backgroundTask != UIBackgroundTaskInvalid)
- {
- [[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
- backgroundTask = UIBackgroundTaskInvalid;
- [self cancel];
- }
- });
- }];
- }
- }
- #endif
-
-
- // A HEAD request generated by an ASINetworkQueue may have set the error already. If so, we should not proceed.
- if ([self error]) {
- [self setComplete:YES];
- [self markAsFinished];
- return;
- }
-
- [self setComplete:NO];
- [self setDidUseCachedResponse:NO];
-
- if (![self url]) {
- [self failWithError:ASIUnableToCreateRequestError];
- return;
- }
-
- // Must call before we create the request so that the request method can be set if needs be
- if (![self mainRequest]) {
- [self buildPostBody];
- }
-
- if (![[self requestMethod] isEqualToString:@"GET"]) {
- [self setDownloadCache:nil];
- }
-
-
- // If we're redirecting, we'll already have a CFHTTPMessageRef
- if (request) {
- CFRelease(request);
- }
-
- // Create a new HTTP request.
- request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)[self requestMethod], (CFURLRef)[self url], [self useHTTPVersionOne] ? kCFHTTPVersion1_0 : kCFHTTPVersion1_1);
- if (!request) {
- [self failWithError:ASIUnableToCreateRequestError];
- return;
- }
-
- //If this is a HEAD request generated by an ASINetworkQueue, we need to let the main request generate its headers first so we can use them
- if ([self mainRequest]) {
- [[self mainRequest] buildRequestHeaders];
- }
-
- // Even if this is a HEAD request with a mainRequest, we still need to call to give subclasses a chance to add their own to HEAD requests (ASIS3Request does this)
- [self buildRequestHeaders];
-
- if ([self downloadCache]) {
-
- // If this request should use the default policy, set its policy to the download cache's default policy
- if (![self cachePolicy]) {
- [self setCachePolicy:[[self downloadCache] defaultCachePolicy]];
- }
-
- // If have have cached data that is valid for this request, use that and stop
- if ([[self downloadCache] canUseCachedDataForRequest:self]) {
- [self useDataFromCache];
- return;
- }
-
- // If cached data is stale, or we have been told to ask the server if it has been modified anyway, we need to add headers for a conditional GET
- if ([self cachePolicy] & (ASIAskServerIfModifiedWhenStaleCachePolicy|ASIAskServerIfModifiedCachePolicy)) {
-
- NSDictionary *cachedHeaders = [[self downloadCache] cachedResponseHeadersForURL:[self url]];
- if (cachedHeaders) {
- NSString *etag = [cachedHeaders objectForKey:@"Etag"];
- if (etag) {
- [[self requestHeaders] setObject:etag forKey:@"If-None-Match"];
- }
- NSString *lastModified = [cachedHeaders objectForKey:@"Last-Modified"];
- if (lastModified) {
- [[self requestHeaders] setObject:lastModified forKey:@"If-Modified-Since"];
- }
- }
- }
- }
-
- [self applyAuthorizationHeader];
-
-
- NSString *header;
- for (header in [self requestHeaders]) {
- CFHTTPMessageSetHeaderFieldValue(request, (CFStringRef)header, (CFStringRef)[[self requestHeaders] objectForKey:header]);
- }
-
- // If we immediately have access to proxy settings, start the request
- // Otherwise, we'll start downloading the proxy PAC file, and call startRequest once that process is complete
- if ([self configureProxies]) {
- [self startRequest];
- }
-
- } @catch (NSException *exception) {
- NSError *underlyingError = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIUnhandledExceptionError userInfo:[exception userInfo]];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIUnhandledExceptionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[exception name],NSLocalizedDescriptionKey,[exception reason],NSLocalizedFailureReasonErrorKey,underlyingError,NSUnderlyingErrorKey,nil]]];
-
- } @finally {
- [[self cancelledLock] unlock];
- }
-}
-
-- (void)applyAuthorizationHeader
-{
- // Do we want to send credentials before we are asked for them?
- if (![self shouldPresentCredentialsBeforeChallenge]) {
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will not send credentials to the server until it asks for them",self);
- #endif
- return;
- }
-
- NSDictionary *credentials = nil;
-
- // Do we already have an auth header?
- if (![[self requestHeaders] objectForKey:@"Authorization"]) {
-
- // If we have basic authentication explicitly set and a username and password set on the request, add a basic auth header
- if ([self username] && [self password] && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic]) {
- [self addBasicAuthenticationHeaderWithUsername:[self username] andPassword:[self password]];
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ has a username and password set, and was manually configured to use BASIC. Will send credentials without waiting for an authentication challenge",self);
- #endif
-
- } else {
-
- // See if we have any cached credentials we can use in the session store
- if ([self useSessionPersistence]) {
- credentials = [self findSessionAuthenticationCredentials];
-
- if (credentials) {
-
- // When the Authentication key is set, the credentials were stored after an authentication challenge, so we can let CFNetwork apply them
- // (credentials for Digest and NTLM will always be stored like this)
- if ([credentials objectForKey:@"Authentication"]) {
-
- // If we've already talked to this server and have valid credentials, let's apply them to the request
- if (CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) {
- [self setAuthenticationScheme:[credentials objectForKey:@"AuthenticationScheme"]];
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached credentials (%@), will reuse without waiting for an authentication challenge",self,[credentials objectForKey:@"AuthenticationScheme"]);
- #endif
- } else {
- [[self class] removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Failed to apply cached credentials to request %@. These will be removed from the session store, and this request will wait for an authentication challenge",self);
- #endif
- }
-
- // If the Authentication key is not set, these credentials were stored after a username and password set on a previous request passed basic authentication
- // When this happens, we'll need to create the Authorization header ourselves
- } else {
- NSDictionary *usernameAndPassword = [credentials objectForKey:@"Credentials"];
- [self addBasicAuthenticationHeaderWithUsername:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername] andPassword:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword]];
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached BASIC credentials from a previous request. Will send credentials without waiting for an authentication challenge",self);
- #endif
- }
- }
- }
- }
- }
-
- // Apply proxy authentication credentials
- if ([self useSessionPersistence]) {
- credentials = [self findSessionProxyAuthenticationCredentials];
- if (credentials) {
- if (!CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) {
- [[self class] removeProxyAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
- }
- }
- }
-}
-
-- (void)applyCookieHeader
-{
- // Add cookies from the persistent (mac os global) store
- if ([self useCookiePersistence]) {
- NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[[self url] absoluteURL]];
- if (cookies) {
- [[self requestCookies] addObjectsFromArray:cookies];
- }
- }
-
- // Apply request cookies
- NSArray *cookies;
- if ([self mainRequest]) {
- cookies = [[self mainRequest] requestCookies];
- } else {
- cookies = [self requestCookies];
- }
- if ([cookies count] > 0) {
- NSHTTPCookie *cookie;
- NSString *cookieHeader = nil;
- for (cookie in cookies) {
- if (!cookieHeader) {
- cookieHeader = [NSString stringWithFormat: @"%@=%@",[cookie name],[cookie value]];
- } else {
- cookieHeader = [NSString stringWithFormat: @"%@; %@=%@",cookieHeader,[cookie name],[cookie value]];
- }
- }
- if (cookieHeader) {
- [self addRequestHeader:@"Cookie" value:cookieHeader];
- }
- }
-}
-
-- (void)buildRequestHeaders
-{
- if ([self haveBuiltRequestHeaders]) {
- return;
- }
- [self setHaveBuiltRequestHeaders:YES];
-
- if ([self mainRequest]) {
- for (NSString *header in [[self mainRequest] requestHeaders]) {
- [self addRequestHeader:header value:[[[self mainRequest] requestHeaders] valueForKey:header]];
- }
- return;
- }
-
- [self applyCookieHeader];
-
- // Build and set the user agent string if the request does not already have a custom user agent specified
- if (![[self requestHeaders] objectForKey:@"User-Agent"]) {
- NSString *tempUserAgentString = [self userAgentString];
- if (!tempUserAgentString) {
- tempUserAgentString = [ASIHTTPRequest defaultUserAgentString];
- }
- if (tempUserAgentString) {
- [self addRequestHeader:@"User-Agent" value:tempUserAgentString];
- }
- }
-
-
- // Accept a compressed response
- if ([self allowCompressedResponse]) {
- [self addRequestHeader:@"Accept-Encoding" value:@"gzip"];
- }
-
- // Configure a compressed request body
- if ([self shouldCompressRequestBody]) {
- [self addRequestHeader:@"Content-Encoding" value:@"gzip"];
- }
-
- // Should this request resume an existing download?
- [self updatePartialDownloadSize];
- if ([self partialDownloadSize]) {
- [self addRequestHeader:@"Range" value:[NSString stringWithFormat:@"bytes=%llu-",[self partialDownloadSize]]];
- }
-}
-
-- (void)updatePartialDownloadSize
-{
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- if ([self allowResumeForFileDownloads] && [self downloadDestinationPath] && [self temporaryFileDownloadPath] && [fileManager fileExistsAtPath:[self temporaryFileDownloadPath]]) {
- NSError *err = nil;
- [self setPartialDownloadSize:[[fileManager attributesOfItemAtPath:[self temporaryFileDownloadPath] error:&err] fileSize]];
- if (err) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to get attributes for file at path '%@'",[self temporaryFileDownloadPath]],NSLocalizedDescriptionKey,error,NSUnderlyingErrorKey,nil]]];
- return;
- }
- }
-}
-
-- (void)startRequest
-{
- if ([self isCancelled]) {
- return;
- }
-
- [self performSelectorOnMainThread:@selector(requestStarted) withObject:nil waitUntilDone:[NSThread isMainThread]];
-
- [self setDownloadComplete:NO];
- [self setComplete:NO];
- [self setTotalBytesRead:0];
- [self setLastBytesRead:0];
-
- if ([self redirectCount] == 0) {
- [self setOriginalURL:[self url]];
- }
-
- // If we're retrying a request, let's remove any progress we made
- if ([self lastBytesSent] > 0) {
- [self removeUploadProgressSoFar];
- }
-
- [self setLastBytesSent:0];
- [self setContentLength:0];
- [self setResponseHeaders:nil];
- if (![self downloadDestinationPath]) {
- [self setRawResponseData:[[[NSMutableData alloc] init] autorelease]];
- }
-
-
- //
- // Create the stream for the request
- //
-
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- [self setReadStreamIsScheduled:NO];
-
- // Do we need to stream the request body from disk
- if ([self shouldStreamPostDataFromDisk] && [self postBodyFilePath] && [fileManager fileExistsAtPath:[self postBodyFilePath]]) {
-
- // Are we gzipping the request body?
- if ([self compressedPostBodyFilePath] && [fileManager fileExistsAtPath:[self compressedPostBodyFilePath]]) {
- [self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self compressedPostBodyFilePath] request:self]];
- } else {
- [self setPostBodyReadStream:[ASIInputStream inputStreamWithFileAtPath:[self postBodyFilePath] request:self]];
- }
- [self setReadStream:[NSMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
- } else {
-
- // If we have a request body, we'll stream it from memory using our custom stream, so that we can measure bandwidth use and it can be bandwidth-throttled if necessary
- if ([self postBody] && [[self postBody] length] > 0) {
- if ([self shouldCompressRequestBody] && [self compressedPostBody]) {
- [self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self compressedPostBody] request:self]];
- } else if ([self postBody]) {
- [self setPostBodyReadStream:[ASIInputStream inputStreamWithData:[self postBody] request:self]];
- }
- [self setReadStream:[NSMakeCollectable(CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, request,(CFReadStreamRef)[self postBodyReadStream])) autorelease]];
-
- } else {
- [self setReadStream:[NSMakeCollectable(CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request)) autorelease]];
- }
- }
-
- if (![self readStream]) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to create read stream",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
-
-
-
- //
- // Handle SSL certificate settings
- //
-
- if([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {
-
- // Tell CFNetwork not to validate SSL certificates
- if (![self validatesSecureCertificate]) {
- // see: http://iphonedevelopment.blogspot.com/2010/05/nsstream-tcp-and-ssl.html
-
- NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates,
- [NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot,
- [NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain,
- kCFNull,kCFStreamSSLPeerName,
- nil];
-
- CFReadStreamSetProperty((CFReadStreamRef)[self readStream],
- kCFStreamPropertySSLSettings,
- (CFTypeRef)sslProperties);
- [sslProperties release];
- }
-
- // Tell CFNetwork to use a client certificate
- if (clientCertificateIdentity) {
- NSMutableDictionary *sslProperties = [NSMutableDictionary dictionaryWithCapacity:1];
-
- NSMutableArray *certificates = [NSMutableArray arrayWithCapacity:[clientCertificates count]+1];
-
- // The first object in the array is our SecIdentityRef
- [certificates addObject:(id)clientCertificateIdentity];
-
- // If we've added any additional certificates, add them too
- for (id cert in clientCertificates) {
- [certificates addObject:cert];
- }
-
- [sslProperties setObject:certificates forKey:(NSString *)kCFStreamSSLCertificates];
-
- CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySSLSettings, sslProperties);
- }
-
- }
-
- //
- // Handle proxy settings
- //
-
- if ([self proxyHost] && [self proxyPort]) {
- NSString *hostKey;
- NSString *portKey;
-
- if (![self proxyType]) {
- [self setProxyType:(NSString *)kCFProxyTypeHTTP];
- }
-
- if ([[self proxyType] isEqualToString:(NSString *)kCFProxyTypeSOCKS]) {
- hostKey = (NSString *)kCFStreamPropertySOCKSProxyHost;
- portKey = (NSString *)kCFStreamPropertySOCKSProxyPort;
- } else {
- hostKey = (NSString *)kCFStreamPropertyHTTPProxyHost;
- portKey = (NSString *)kCFStreamPropertyHTTPProxyPort;
- if ([[[[self url] scheme] lowercaseString] isEqualToString:@"https"]) {
- hostKey = (NSString *)kCFStreamPropertyHTTPSProxyHost;
- portKey = (NSString *)kCFStreamPropertyHTTPSProxyPort;
- }
- }
- NSMutableDictionary *proxyToUse = [NSMutableDictionary dictionaryWithObjectsAndKeys:[self proxyHost],hostKey,[NSNumber numberWithInt:[self proxyPort]],portKey,nil];
-
- if ([[self proxyType] isEqualToString:(NSString *)kCFProxyTypeSOCKS]) {
- CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertySOCKSProxy, proxyToUse);
- } else {
- CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPProxy, proxyToUse);
- }
- }
-
-
- //
- // Handle persistent connections
- //
-
- [ASIHTTPRequest expirePersistentConnections];
-
- [connectionsLock lock];
-
-
- if (![[self url] host] || ![[self url] scheme]) {
- [self setConnectionInfo:nil];
- [self setShouldAttemptPersistentConnection:NO];
- }
-
- // Will store the old stream that was using this connection (if there was one) so we can clean it up once we've opened our own stream
- NSInputStream *oldStream = nil;
-
- // Use a persistent connection if possible
- if ([self shouldAttemptPersistentConnection]) {
-
-
- // If we are redirecting, we will re-use the current connection only if we are connecting to the same server
- if ([self connectionInfo]) {
-
- if (![[[self connectionInfo] objectForKey:@"host"] isEqualToString:[[self url] host]] || ![[[self connectionInfo] objectForKey:@"scheme"] isEqualToString:[[self url] scheme]] || [(NSNumber *)[[self connectionInfo] objectForKey:@"port"] intValue] != [[[self url] port] intValue]) {
- [self setConnectionInfo:nil];
-
- // Check if we should have expired this connection
- } else if ([[[self connectionInfo] objectForKey:@"expires"] timeIntervalSinceNow] < 0) {
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Not re-using connection #%i because it has expired",[[[self connectionInfo] objectForKey:@"id"] intValue]);
- #endif
- [persistentConnectionsPool removeObject:[self connectionInfo]];
- [self setConnectionInfo:nil];
-
- } else if ([[self connectionInfo] objectForKey:@"request"] != nil) {
- //Some other request reused this connection already - we'll have to create a new one
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"%@ - Not re-using connection #%i for request #%i because it is already used by request #%i",self,[[[self connectionInfo] objectForKey:@"id"] intValue],[[self requestID] intValue],[[[self connectionInfo] objectForKey:@"request"] intValue]);
- #endif
- [self setConnectionInfo:nil];
- }
- }
-
-
-
- if (![self connectionInfo] && [[self url] host] && [[self url] scheme]) { // We must have a proper url with a host and scheme, or this will explode
-
- // Look for a connection to the same server in the pool
- for (NSMutableDictionary *existingConnection in persistentConnectionsPool) {
- if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"host"] isEqualToString:[[self url] host]] && [[existingConnection objectForKey:@"scheme"] isEqualToString:[[self url] scheme]] && [(NSNumber *)[existingConnection objectForKey:@"port"] intValue] == [[[self url] port] intValue]) {
- [self setConnectionInfo:existingConnection];
- }
- }
- }
-
- if ([[self connectionInfo] objectForKey:@"stream"]) {
- oldStream = [[[self connectionInfo] objectForKey:@"stream"] retain];
-
- }
-
- // No free connection was found in the pool matching the server/scheme/port we're connecting to, we'll need to create a new one
- if (![self connectionInfo]) {
- [self setConnectionInfo:[NSMutableDictionary dictionary]];
- nextConnectionNumberToCreate++;
- [[self connectionInfo] setObject:[NSNumber numberWithInt:nextConnectionNumberToCreate] forKey:@"id"];
- [[self connectionInfo] setObject:[[self url] host] forKey:@"host"];
- [[self connectionInfo] setObject:[NSNumber numberWithInt:[[[self url] port] intValue]] forKey:@"port"];
- [[self connectionInfo] setObject:[[self url] scheme] forKey:@"scheme"];
- [persistentConnectionsPool addObject:[self connectionInfo]];
- }
-
- // If we are retrying this request, it will already have a requestID
- if (![self requestID]) {
- nextRequestID++;
- [self setRequestID:[NSNumber numberWithUnsignedInt:nextRequestID]];
- }
- [[self connectionInfo] setObject:[self requestID] forKey:@"request"];
- [[self connectionInfo] setObject:[self readStream] forKey:@"stream"];
- CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
-
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ will use connection #%i",[self requestID],[[[self connectionInfo] objectForKey:@"id"] intValue]);
- #endif
-
-
- // Tag the stream with an id that tells it which connection to use behind the scenes
- // See http://lists.apple.com/archives/macnetworkprog/2008/Dec/msg00001.html for details on this approach
-
- CFReadStreamSetProperty((CFReadStreamRef)[self readStream], CFSTR("ASIStreamID"), [[self connectionInfo] objectForKey:@"id"]);
-
- } else {
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Request %@ will not use a persistent connection",self);
- #endif
- }
-
- [connectionsLock unlock];
-
- // Schedule the stream
- if (![self readStreamIsScheduled] && (!throttleWakeUpTime || [throttleWakeUpTime timeIntervalSinceDate:[NSDate date]] < 0)) {
- [self scheduleReadStream];
- }
-
- BOOL streamSuccessfullyOpened = NO;
-
-
- // Start the HTTP connection
- CFStreamClientContext ctxt = {0, self, NULL, NULL, NULL};
- if (CFReadStreamSetClient((CFReadStreamRef)[self readStream], kNetworkEvents, ReadStreamClientCallBack, &ctxt)) {
- if (CFReadStreamOpen((CFReadStreamRef)[self readStream])) {
- streamSuccessfullyOpened = YES;
- }
- }
-
- // Here, we'll close the stream that was previously using this connection, if there was one
- // We've kept it open until now (when we've just opened a new stream) so that the new stream can make use of the old connection
- // http://lists.apple.com/archives/Macnetworkprog/2006/Mar/msg00119.html
- if (oldStream) {
- [oldStream close];
- [oldStream release];
- oldStream = nil;
- }
-
- if (!streamSuccessfullyOpened) {
- [self setConnectionCanBeReused:NO];
- [self destroyReadStream];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to start HTTP connection",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
- if (![self mainRequest]) {
- if ([self shouldResetUploadProgress]) {
- if ([self showAccurateProgress]) {
- [self incrementUploadSizeBy:[self postLength]];
- } else {
- [self incrementUploadSizeBy:1];
- }
- [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:0 ofTotal:1];
- }
- if ([self shouldResetDownloadProgress] && ![self partialDownloadSize]) {
- [ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:0 ofTotal:1];
- }
- }
-
-
- // Record when the request started, so we can timeout if nothing happens
- [self setLastActivityTime:[NSDate date]];
- [self setStatusTimer:[NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(updateStatus:) userInfo:nil repeats:YES]];
- [[NSRunLoop currentRunLoop] addTimer:[self statusTimer] forMode:[self runLoopMode]];
-}
-
-- (void)setStatusTimer:(NSTimer *)timer
-{
- CFRetain(self);
- // We must invalidate the old timer here, not before we've created and scheduled a new timer
- // This is because the timer may be the only thing retaining an asynchronous request
- if (statusTimer && timer != statusTimer) {
- [statusTimer invalidate];
- [statusTimer release];
- }
- statusTimer = [timer retain];
- CFRelease(self);
-}
-
-// This gets fired every 1/4 of a second to update the progress and work out if we need to timeout
-- (void)updateStatus:(NSTimer*)timer
-{
- [self checkRequestStatus];
- if (![self inProgress]) {
- [self setStatusTimer:nil];
- }
-}
-
-- (void)performRedirect
-{
- [self setURL:[self redirectURL]];
- [self setComplete:YES];
- [self setNeedsRedirect:NO];
- [self setRedirectCount:[self redirectCount]+1];
-
- if ([self redirectCount] > RedirectionLimit) {
- // Some naughty / badly coded website is trying to force us into a redirection loop. This is not cool.
- [self failWithError:ASITooMuchRedirectionError];
- [self setComplete:YES];
- } else {
- // Go all the way back to the beginning and build the request again, so that we can apply any new cookies
- [self main];
- }
-}
-
-// Called by delegate to resume loading with a new url after the delegate received request:willRedirectToURL:
-- (void)redirectToURL:(NSURL *)newURL
-{
- [self setRedirectURL:newURL];
- [self performSelector:@selector(performRedirect) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
-}
-
-- (BOOL)shouldTimeOut
-{
- NSTimeInterval secondsSinceLastActivity = [[NSDate date] timeIntervalSinceDate:lastActivityTime];
- // See if we need to timeout
- if ([self readStream] && [self readStreamIsScheduled] && [self lastActivityTime] && [self timeOutSeconds] > 0 && secondsSinceLastActivity > [self timeOutSeconds]) {
-
- // We have no body, or we've sent more than the upload buffer size,so we can safely time out here
- if ([self postLength] == 0 || ([self uploadBufferSize] > 0 && [self totalBytesSent] > [self uploadBufferSize])) {
- return YES;
-
- // ***Black magic warning***
- // We have a body, but we've taken longer than timeOutSeconds to upload the first small chunk of data
- // Since there's no reliable way to track upload progress for the first 32KB (iPhone) or 128KB (Mac) with CFNetwork, we'll be slightly more forgiving on the timeout, as there's a strong chance our connection is just very slow.
- } else if (secondsSinceLastActivity > [self timeOutSeconds]*1.5) {
- return YES;
- }
- }
- return NO;
-}
-
-- (void)checkRequestStatus
-{
- // We won't let the request cancel while we're updating progress / checking for a timeout
- [[self cancelledLock] lock];
- // See if our NSOperationQueue told us to cancel
- if ([self isCancelled] || [self complete]) {
- [[self cancelledLock] unlock];
- return;
- }
-
- [self performThrottling];
-
- if ([self shouldTimeOut]) {
- // Do we need to auto-retry this request?
- if ([self numberOfTimesToRetryOnTimeout] > [self retryCount]) {
-
- // If we are resuming a download, we may need to update the Range header to take account of data we've just downloaded
- [self updatePartialDownloadSize];
- if ([self partialDownloadSize]) {
- CFHTTPMessageSetHeaderFieldValue(request, (CFStringRef)@"Range", (CFStringRef)[NSString stringWithFormat:@"bytes=%llu-",[self partialDownloadSize]]);
- }
- [self setRetryCount:[self retryCount]+1];
- [self unscheduleReadStream];
- [[self cancelledLock] unlock];
- [self startRequest];
- return;
- }
- [self failWithError:ASIRequestTimedOutError];
- [self cancelLoad];
- [self setComplete:YES];
- [[self cancelledLock] unlock];
- return;
- }
-
- // readStream will be null if we aren't currently running (perhaps we're waiting for a delegate to supply credentials)
- if ([self readStream]) {
-
- // If we have a post body
- if ([self postLength]) {
-
- [self setLastBytesSent:totalBytesSent];
-
- // Find out how much data we've uploaded so far
- [self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
- if (totalBytesSent > lastBytesSent) {
-
- // We've uploaded more data, reset the timeout
- [self setLastActivityTime:[NSDate date]];
- [ASIHTTPRequest incrementBandwidthUsedInLastSecond:(unsigned long)(totalBytesSent-lastBytesSent)];
-
- #if DEBUG_REQUEST_STATUS
- if ([self totalBytesSent] == [self postLength]) {
- ASI_DEBUG_LOG(@"[STATUS] Request %@ finished uploading data",self);
- }
- #endif
- }
- }
-
- [self updateProgressIndicators];
-
- }
-
- [[self cancelledLock] unlock];
-}
-
-
-// Cancel loading and clean up. DO NOT USE THIS TO CANCEL REQUESTS - use [request cancel] instead
-- (void)cancelLoad
-{
- // If we're in the middle of downloading a PAC file, let's stop that first
- if (PACFileReadStream) {
- [PACFileReadStream setDelegate:nil];
- [PACFileReadStream close];
- [self setPACFileReadStream:nil];
- [self setPACFileData:nil];
- } else if (PACFileRequest) {
- [PACFileRequest setDelegate:nil];
- [PACFileRequest cancel];
- [self setPACFileRequest:nil];
- }
-
- [self destroyReadStream];
-
- [[self postBodyReadStream] close];
- [self setPostBodyReadStream:nil];
-
- if ([self rawResponseData]) {
- if (![self complete]) {
- [self setRawResponseData:nil];
- }
- // If we were downloading to a file
- } else if ([self temporaryFileDownloadPath]) {
- [[self fileDownloadOutputStream] close];
- [self setFileDownloadOutputStream:nil];
-
- [[self inflatedFileDownloadOutputStream] close];
- [self setInflatedFileDownloadOutputStream:nil];
-
- // If we haven't said we might want to resume, let's remove the temporary file too
- if (![self complete]) {
- if (![self allowResumeForFileDownloads]) {
- [self removeTemporaryDownloadFile];
- }
- [self removeTemporaryUncompressedDownloadFile];
- }
- }
-
- // Clean up any temporary file used to store request body for streaming
- if (![self authenticationNeeded] && ![self willRetryRequest] && [self didCreateTemporaryPostDataFile]) {
- [self removeTemporaryUploadFile];
- [self removeTemporaryCompressedUploadFile];
- [self setDidCreateTemporaryPostDataFile:NO];
- }
-}
-
-#pragma mark HEAD request
-
-// Used by ASINetworkQueue to create a HEAD request appropriate for this request with the same headers (though you can use it yourself)
-- (ASIHTTPRequest *)HEADRequest
-{
- ASIHTTPRequest *headRequest = [[self class] requestWithURL:[self url]];
-
- // Copy the properties that make sense for a HEAD request
- [headRequest setRequestHeaders:[[[self requestHeaders] mutableCopy] autorelease]];
- [headRequest setRequestCookies:[[[self requestCookies] mutableCopy] autorelease]];
- [headRequest setUseCookiePersistence:[self useCookiePersistence]];
- [headRequest setUseKeychainPersistence:[self useKeychainPersistence]];
- [headRequest setUseSessionPersistence:[self useSessionPersistence]];
- [headRequest setAllowCompressedResponse:[self allowCompressedResponse]];
- [headRequest setUsername:[self username]];
- [headRequest setPassword:[self password]];
- [headRequest setDomain:[self domain]];
- [headRequest setProxyUsername:[self proxyUsername]];
- [headRequest setProxyPassword:[self proxyPassword]];
- [headRequest setProxyDomain:[self proxyDomain]];
- [headRequest setProxyHost:[self proxyHost]];
- [headRequest setProxyPort:[self proxyPort]];
- [headRequest setProxyType:[self proxyType]];
- [headRequest setShouldPresentAuthenticationDialog:[self shouldPresentAuthenticationDialog]];
- [headRequest setShouldPresentProxyAuthenticationDialog:[self shouldPresentProxyAuthenticationDialog]];
- [headRequest setTimeOutSeconds:[self timeOutSeconds]];
- [headRequest setUseHTTPVersionOne:[self useHTTPVersionOne]];
- [headRequest setValidatesSecureCertificate:[self validatesSecureCertificate]];
- [headRequest setClientCertificateIdentity:clientCertificateIdentity];
- [headRequest setClientCertificates:[[clientCertificates copy] autorelease]];
- [headRequest setPACurl:[self PACurl]];
- [headRequest setShouldPresentCredentialsBeforeChallenge:[self shouldPresentCredentialsBeforeChallenge]];
- [headRequest setNumberOfTimesToRetryOnTimeout:[self numberOfTimesToRetryOnTimeout]];
- [headRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]];
- [headRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]];
- [headRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]];
-
- [headRequest setMainRequest:self];
- [headRequest setRequestMethod:@"HEAD"];
- return headRequest;
-}
-
-
-#pragma mark upload/download progress
-
-
-- (void)updateProgressIndicators
-{
- //Only update progress if this isn't a HEAD request used to preset the content-length
- if (![self mainRequest]) {
- if ([self showAccurateProgress] || ([self complete] && ![self updatedProgress])) {
- [self updateUploadProgress];
- [self updateDownloadProgress];
- }
- }
-}
-
-- (id)uploadProgressDelegate
-{
- [[self cancelledLock] lock];
- id d = [[uploadProgressDelegate retain] autorelease];
- [[self cancelledLock] unlock];
- return d;
-}
-
-- (void)setUploadProgressDelegate:(id)newDelegate
-{
- [[self cancelledLock] lock];
- uploadProgressDelegate = newDelegate;
-
- #if !TARGET_OS_IPHONE
- // If the uploadProgressDelegate is an NSProgressIndicator, we set its MaxValue to 1.0 so we can update it as if it were a UIProgressView
- double max = 1.0;
- [ASIHTTPRequest performSelector:@selector(setMaxValue:) onTarget:&uploadProgressDelegate withObject:nil amount:&max callerToRetain:nil];
- #endif
- [[self cancelledLock] unlock];
-}
-
-- (id)downloadProgressDelegate
-{
- [[self cancelledLock] lock];
- id d = [[downloadProgressDelegate retain] autorelease];
- [[self cancelledLock] unlock];
- return d;
-}
-
-- (void)setDownloadProgressDelegate:(id)newDelegate
-{
- [[self cancelledLock] lock];
- downloadProgressDelegate = newDelegate;
-
- #if !TARGET_OS_IPHONE
- // If the downloadProgressDelegate is an NSProgressIndicator, we set its MaxValue to 1.0 so we can update it as if it were a UIProgressView
- double max = 1.0;
- [ASIHTTPRequest performSelector:@selector(setMaxValue:) onTarget:&downloadProgressDelegate withObject:nil amount:&max callerToRetain:nil];
- #endif
- [[self cancelledLock] unlock];
-}
-
-
-- (void)updateDownloadProgress
-{
- // We won't update download progress until we've examined the headers, since we might need to authenticate
- if (![self responseHeaders] || [self needsRedirect] || !([self contentLength] || [self complete])) {
- return;
- }
-
- unsigned long long bytesReadSoFar = [self totalBytesRead]+[self partialDownloadSize];
- unsigned long long value = 0;
-
- if ([self showAccurateProgress] && [self contentLength]) {
- value = bytesReadSoFar-[self lastBytesRead];
- if (value == 0) {
- return;
- }
- } else {
- value = 1;
- [self setUpdatedProgress:YES];
- }
- if (!value) {
- return;
- }
-
- [ASIHTTPRequest performSelector:@selector(request:didReceiveBytes:) onTarget:&queue withObject:self amount:&value callerToRetain:self];
- [ASIHTTPRequest performSelector:@selector(request:didReceiveBytes:) onTarget:&downloadProgressDelegate withObject:self amount:&value callerToRetain:self];
-
- [ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:[self totalBytesRead]+[self partialDownloadSize] ofTotal:[self contentLength]+[self partialDownloadSize]];
-
- #if NS_BLOCKS_AVAILABLE
- if (bytesReceivedBlock) {
- unsigned long long totalSize = [self contentLength] + [self partialDownloadSize];
- [self performBlockOnMainThread:^{ if (bytesReceivedBlock) { bytesReceivedBlock(value, totalSize); }}];
- }
- #endif
- [self setLastBytesRead:bytesReadSoFar];
-}
-
-- (void)updateUploadProgress
-{
- if ([self isCancelled] || [self totalBytesSent] == 0) {
- return;
- }
-
- // If this is the first time we've written to the buffer, totalBytesSent will be the size of the buffer (currently seems to be 128KB on both Leopard and iPhone 2.2.1, 32KB on iPhone 3.0)
- // If request body is less than the buffer size, totalBytesSent will be the total size of the request body
- // We will remove this from any progress display, as kCFStreamPropertyHTTPRequestBytesWrittenCount does not tell us how much data has actually be written
- if ([self uploadBufferSize] == 0 && [self totalBytesSent] != [self postLength]) {
- [self setUploadBufferSize:[self totalBytesSent]];
- [self incrementUploadSizeBy:-[self uploadBufferSize]];
- }
-
- unsigned long long value = 0;
-
- if ([self showAccurateProgress]) {
- if ([self totalBytesSent] == [self postLength] || [self lastBytesSent] > 0) {
- value = [self totalBytesSent]-[self lastBytesSent];
- } else {
- return;
- }
- } else {
- value = 1;
- [self setUpdatedProgress:YES];
- }
-
- if (!value) {
- return;
- }
-
- [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&queue withObject:self amount:&value callerToRetain:self];
- [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&uploadProgressDelegate withObject:self amount:&value callerToRetain:self];
- [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:[self totalBytesSent]-[self uploadBufferSize] ofTotal:[self postLength]-[self uploadBufferSize]];
-
- #if NS_BLOCKS_AVAILABLE
- if(bytesSentBlock){
- unsigned long long totalSize = [self postLength];
- [self performBlockOnMainThread:^{ if (bytesSentBlock) { bytesSentBlock(value, totalSize); }}];
- }
- #endif
-}
-
-
-- (void)incrementDownloadSizeBy:(long long)length
-{
- [ASIHTTPRequest performSelector:@selector(request:incrementDownloadSizeBy:) onTarget:&queue withObject:self amount:&length callerToRetain:self];
- [ASIHTTPRequest performSelector:@selector(request:incrementDownloadSizeBy:) onTarget:&downloadProgressDelegate withObject:self amount:&length callerToRetain:self];
-
- #if NS_BLOCKS_AVAILABLE
- if(downloadSizeIncrementedBlock){
- [self performBlockOnMainThread:^{ if (downloadSizeIncrementedBlock) { downloadSizeIncrementedBlock(length); }}];
- }
- #endif
-}
-
-- (void)incrementUploadSizeBy:(long long)length
-{
- [ASIHTTPRequest performSelector:@selector(request:incrementUploadSizeBy:) onTarget:&queue withObject:self amount:&length callerToRetain:self];
- [ASIHTTPRequest performSelector:@selector(request:incrementUploadSizeBy:) onTarget:&uploadProgressDelegate withObject:self amount:&length callerToRetain:self];
-
- #if NS_BLOCKS_AVAILABLE
- if(uploadSizeIncrementedBlock) {
- [self performBlockOnMainThread:^{ if (uploadSizeIncrementedBlock) { uploadSizeIncrementedBlock(length); }}];
- }
- #endif
-}
-
-
--(void)removeUploadProgressSoFar
-{
- long long progressToRemove = -[self totalBytesSent];
- [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&queue withObject:self amount:&progressToRemove callerToRetain:self];
- [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&uploadProgressDelegate withObject:self amount:&progressToRemove callerToRetain:self];
- [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:0 ofTotal:[self postLength]];
-
- #if NS_BLOCKS_AVAILABLE
- if(bytesSentBlock){
- unsigned long long totalSize = [self postLength];
- [self performBlockOnMainThread:^{ if (bytesSentBlock) { bytesSentBlock(progressToRemove, totalSize); }}];
- }
- #endif
-}
-
-#if NS_BLOCKS_AVAILABLE
-- (void)performBlockOnMainThread:(ASIBasicBlock)block
-{
- [self performSelectorOnMainThread:@selector(callBlock:) withObject:[[block copy] autorelease] waitUntilDone:[NSThread isMainThread]];
-}
-
-- (void)callBlock:(ASIBasicBlock)block
-{
- block();
-}
-#endif
-
-
-+ (void)performSelector:(SEL)selector onTarget:(id *)target withObject:(id)object amount:(void *)amount callerToRetain:(id)callerToRetain
-{
- if ([*target respondsToSelector:selector]) {
- NSMethodSignature *signature = nil;
- signature = [*target methodSignatureForSelector:selector];
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
-
- [invocation setSelector:selector];
-
- int argumentNumber = 2;
-
- // If we got an object parameter, we pass a pointer to the object pointer
- if (object) {
- [invocation setArgument:&object atIndex:argumentNumber];
- argumentNumber++;
- }
-
- // For the amount we'll just pass the pointer directly so NSInvocation will call the method using the number itself rather than a pointer to it
- if (amount) {
- [invocation setArgument:amount atIndex:argumentNumber];
- }
-
- SEL callback = @selector(performInvocation:onTarget:releasingObject:);
- NSMethodSignature *cbSignature = [ASIHTTPRequest methodSignatureForSelector:callback];
- NSInvocation *cbInvocation = [NSInvocation invocationWithMethodSignature:cbSignature];
- [cbInvocation setSelector:callback];
- [cbInvocation setTarget:self];
- [cbInvocation setArgument:&invocation atIndex:2];
- [cbInvocation setArgument:&target atIndex:3];
- if (callerToRetain) {
- [cbInvocation setArgument:&callerToRetain atIndex:4];
- }
-
- CFRetain(invocation);
-
- // Used to pass in a request that we must retain until after the call
- // We're using CFRetain rather than [callerToRetain retain] so things to avoid earthquakes when using garbage collection
- if (callerToRetain) {
- CFRetain(callerToRetain);
- }
- [cbInvocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:[NSThread isMainThread]];
- }
-}
-
-+ (void)performInvocation:(NSInvocation *)invocation onTarget:(id *)target releasingObject:(id)objectToRelease
-{
- if (*target && [*target respondsToSelector:[invocation selector]]) {
- [invocation invokeWithTarget:*target];
- }
- CFRelease(invocation);
- if (objectToRelease) {
- CFRelease(objectToRelease);
- }
-}
-
-
-+ (void)updateProgressIndicator:(id *)indicator withProgress:(unsigned long long)progress ofTotal:(unsigned long long)total
-{
- #if TARGET_OS_IPHONE
- // Cocoa Touch: UIProgressView
- SEL selector = @selector(setProgress:);
- float progressAmount = (float)((progress*1.0)/(total*1.0));
-
- #else
- // Cocoa: NSProgressIndicator
- double progressAmount = progressAmount = (progress*1.0)/(total*1.0);
- SEL selector = @selector(setDoubleValue:);
- #endif
-
- if (![*indicator respondsToSelector:selector]) {
- return;
- }
-
- [progressLock lock];
- [ASIHTTPRequest performSelector:selector onTarget:indicator withObject:nil amount:&progressAmount callerToRetain:nil];
- [progressLock unlock];
-}
-
-
-#pragma mark talking to delegates / calling blocks
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)requestStarted
-{
- if ([self error] || [self mainRequest]) {
- return;
- }
- if (delegate && [delegate respondsToSelector:didStartSelector]) {
- [delegate performSelector:didStartSelector withObject:self];
- }
- #if NS_BLOCKS_AVAILABLE
- if(startedBlock){
- startedBlock();
- }
- #endif
- if (queue && [queue respondsToSelector:@selector(requestStarted:)]) {
- [queue performSelector:@selector(requestStarted:) withObject:self];
- }
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)requestRedirected
-{
- if ([self error] || [self mainRequest]) {
- return;
- }
-
- if([[self delegate] respondsToSelector:@selector(requestRedirected:)]){
- [[self delegate] performSelector:@selector(requestRedirected:) withObject:self];
- }
-
- #if NS_BLOCKS_AVAILABLE
- if(requestRedirectedBlock){
- requestRedirectedBlock();
- }
- #endif
-}
-
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)requestReceivedResponseHeaders:(NSMutableDictionary *)newResponseHeaders
-{
- if ([self error] || [self mainRequest]) {
- return;
- }
-
- if (delegate && [delegate respondsToSelector:didReceiveResponseHeadersSelector]) {
- [delegate performSelector:didReceiveResponseHeadersSelector withObject:self withObject:newResponseHeaders];
- }
-
- #if NS_BLOCKS_AVAILABLE
- if(headersReceivedBlock){
- headersReceivedBlock(newResponseHeaders);
- }
- #endif
-
- if (queue && [queue respondsToSelector:@selector(request:didReceiveResponseHeaders:)]) {
- [queue performSelector:@selector(request:didReceiveResponseHeaders:) withObject:self withObject:newResponseHeaders];
- }
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)requestWillRedirectToURL:(NSURL *)newURL
-{
- if ([self error] || [self mainRequest]) {
- return;
- }
- if (delegate && [delegate respondsToSelector:willRedirectSelector]) {
- [delegate performSelector:willRedirectSelector withObject:self withObject:newURL];
- }
- if (queue && [queue respondsToSelector:@selector(request:willRedirectToURL:)]) {
- [queue performSelector:@selector(request:willRedirectToURL:) withObject:self withObject:newURL];
- }
-}
-
-// Subclasses might override this method to process the result in the same thread
-// If you do this, don't forget to call [super requestFinished] to let the queue / delegate know we're done
-- (void)requestFinished
-{
-#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[STATUS] Request finished: %@",self);
-#endif
- if ([self error] || [self mainRequest]) {
- return;
- }
- if ([self isPACFileRequest]) {
- [self reportFinished];
- } else {
- [self performSelectorOnMainThread:@selector(reportFinished) withObject:nil waitUntilDone:[NSThread isMainThread]];
- }
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)reportFinished
-{
- if (delegate && [delegate respondsToSelector:didFinishSelector]) {
- [delegate performSelector:didFinishSelector withObject:self];
- }
-
- #if NS_BLOCKS_AVAILABLE
- if(completionBlock){
- completionBlock();
- }
- #endif
-
- if (queue && [queue respondsToSelector:@selector(requestFinished:)]) {
- [queue performSelector:@selector(requestFinished:) withObject:self];
- }
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)reportFailure
-{
- if (delegate && [delegate respondsToSelector:didFailSelector]) {
- [delegate performSelector:didFailSelector withObject:self];
- }
-
- #if NS_BLOCKS_AVAILABLE
- if(failureBlock){
- failureBlock();
- }
- #endif
-
- if (queue && [queue respondsToSelector:@selector(requestFailed:)]) {
- [queue performSelector:@selector(requestFailed:) withObject:self];
- }
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)passOnReceivedData:(NSData *)data
-{
- if (delegate && [delegate respondsToSelector:didReceiveDataSelector]) {
- [delegate performSelector:didReceiveDataSelector withObject:self withObject:data];
- }
-
- #if NS_BLOCKS_AVAILABLE
- if (dataReceivedBlock) {
- dataReceivedBlock(data);
- }
- #endif
-}
-
-// Subclasses might override this method to perform error handling in the same thread
-// If you do this, don't forget to call [super failWithError:] to let the queue / delegate know we're done
-- (void)failWithError:(NSError *)theError
-{
-#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[STATUS] Request %@: %@",self,(theError == ASIRequestCancelledError ? @"Cancelled" : @"Failed"));
-#endif
- [self setComplete:YES];
-
- // Invalidate the current connection so subsequent requests don't attempt to reuse it
- if (theError && [theError code] != ASIAuthenticationErrorType && [theError code] != ASITooMuchRedirectionErrorType) {
- [connectionsLock lock];
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ failed and will invalidate connection #%@",[self requestID],[[self connectionInfo] objectForKey:@"id"]);
- #endif
- [[self connectionInfo] removeObjectForKey:@"request"];
- [persistentConnectionsPool removeObject:[self connectionInfo]];
- [connectionsLock unlock];
- [self destroyReadStream];
- }
- if ([self connectionCanBeReused]) {
- [[self connectionInfo] setObject:[NSDate dateWithTimeIntervalSinceNow:[self persistentConnectionTimeoutSeconds]] forKey:@"expires"];
- }
-
- if ([self isCancelled] || [self error]) {
- return;
- }
-
- // If we have cached data, use it and ignore the error when using ASIFallbackToCacheIfLoadFailsCachePolicy
- if ([self downloadCache] && ([self cachePolicy] & ASIFallbackToCacheIfLoadFailsCachePolicy)) {
- if ([[self downloadCache] canUseCachedDataForRequest:self]) {
- [self useDataFromCache];
- return;
- }
- }
-
-
- [self setError:theError];
-
- ASIHTTPRequest *failedRequest = self;
-
- // If this is a HEAD request created by an ASINetworkQueue or compatible queue delegate, make the main request fail
- if ([self mainRequest]) {
- failedRequest = [self mainRequest];
- [failedRequest setError:theError];
- }
-
- if ([self isPACFileRequest]) {
- [failedRequest reportFailure];
- } else {
- [failedRequest performSelectorOnMainThread:@selector(reportFailure) withObject:nil waitUntilDone:[NSThread isMainThread]];
- }
-
- if (!inProgress)
- {
- // if we're not in progress, we can't notify the queue we've finished (doing so can cause a crash later on)
- // "markAsFinished" will be at the start of main() when we are started
- return;
- }
- [self markAsFinished];
-}
-
-#pragma mark parsing HTTP response headers
-
-- (void)readResponseHeaders
-{
- [self setAuthenticationNeeded:ASINoAuthenticationNeededYet];
-
- CFHTTPMessageRef message = (CFHTTPMessageRef)CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPResponseHeader);
- if (!message) {
- return;
- }
-
- // Make sure we've received all the headers
- if (!CFHTTPMessageIsHeaderComplete(message)) {
- CFRelease(message);
- return;
- }
-
- #if DEBUG_REQUEST_STATUS
- if ([self totalBytesSent] == [self postLength]) {
- ASI_DEBUG_LOG(@"[STATUS] Request %@ received response headers",self);
- }
- #endif
-
- [self setResponseHeaders:[NSMakeCollectable(CFHTTPMessageCopyAllHeaderFields(message)) autorelease]];
- [self setResponseStatusCode:(int)CFHTTPMessageGetResponseStatusCode(message)];
- [self setResponseStatusMessage:[NSMakeCollectable(CFHTTPMessageCopyResponseStatusLine(message)) autorelease]];
-
- if ([self downloadCache] && ([[self downloadCache] canUseCachedDataForRequest:self])) {
-
- // Update the expiry date
- [[self downloadCache] updateExpiryForRequest:self maxAge:[self secondsToCache]];
-
- // Read the response from the cache
- [self useDataFromCache];
-
- CFRelease(message);
- return;
- }
-
- // Is the server response a challenge for credentials?
- if ([self responseStatusCode] == 401) {
- [self setAuthenticationNeeded:ASIHTTPAuthenticationNeeded];
- } else if ([self responseStatusCode] == 407) {
- [self setAuthenticationNeeded:ASIProxyAuthenticationNeeded];
- } else {
- #if DEBUG_HTTP_AUTHENTICATION
- if ([self authenticationScheme]) {
- ASI_DEBUG_LOG(@"[AUTH] Request %@ has passed %@ authentication",self,[self authenticationScheme]);
- }
- #endif
- }
-
- // Authentication succeeded, or no authentication was required
- if (![self authenticationNeeded]) {
-
- // Did we get here without an authentication challenge? (which can happen when shouldPresentCredentialsBeforeChallenge is YES and basic auth was successful)
- if (!requestAuthentication && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && [self username] && [self password] && [self useSessionPersistence]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ passed BASIC authentication, and will save credentials in the session store for future use",self);
- #endif
-
- NSMutableDictionary *newCredentials = [NSMutableDictionary dictionaryWithCapacity:2];
- [newCredentials setObject:[self username] forKey:(NSString *)kCFHTTPAuthenticationUsername];
- [newCredentials setObject:[self password] forKey:(NSString *)kCFHTTPAuthenticationPassword];
-
- // Store the credentials in the session
- NSMutableDictionary *sessionCredentials = [NSMutableDictionary dictionary];
- [sessionCredentials setObject:newCredentials forKey:@"Credentials"];
- [sessionCredentials setObject:[self url] forKey:@"URL"];
- [sessionCredentials setObject:(NSString *)kCFHTTPAuthenticationSchemeBasic forKey:@"AuthenticationScheme"];
- [[self class] storeAuthenticationCredentialsInSessionStore:sessionCredentials];
- }
- }
-
- // Read response textEncoding
- [self parseStringEncodingFromHeaders];
-
- // Handle cookies
- NSArray *newCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:[self responseHeaders] forURL:[self url]];
- [self setResponseCookies:newCookies];
-
- if ([self useCookiePersistence]) {
-
- // Store cookies in global persistent store
- [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:newCookies forURL:[self url] mainDocumentURL:nil];
-
- // We also keep any cookies in the sessionCookies array, so that we have a reference to them if we need to remove them later
- NSHTTPCookie *cookie;
- for (cookie in newCookies) {
- [ASIHTTPRequest addSessionCookie:cookie];
- }
- }
-
- // Do we need to redirect?
- if (![self willRedirect]) {
- // See if we got a Content-length header
- NSString *cLength = [responseHeaders valueForKey:@"Content-Length"];
- ASIHTTPRequest *theRequest = self;
- if ([self mainRequest]) {
- theRequest = [self mainRequest];
- }
-
- if (cLength) {
- unsigned long long length = strtoull([cLength UTF8String], NULL, 0);
-
- // Workaround for Apache HEAD requests for dynamically generated content returning the wrong Content-Length when using gzip
- if ([self mainRequest] && [self allowCompressedResponse] && length == 20 && [self showAccurateProgress] && [self shouldResetDownloadProgress]) {
- [[self mainRequest] setShowAccurateProgress:NO];
- [[self mainRequest] incrementDownloadSizeBy:1];
-
- } else {
- [theRequest setContentLength:length];
- if ([self showAccurateProgress] && [self shouldResetDownloadProgress]) {
- [theRequest incrementDownloadSizeBy:[theRequest contentLength]+[theRequest partialDownloadSize]];
- }
- }
-
- } else if ([self showAccurateProgress] && [self shouldResetDownloadProgress]) {
- [theRequest setShowAccurateProgress:NO];
- [theRequest incrementDownloadSizeBy:1];
- }
- }
-
- // Handle connection persistence
- if ([self shouldAttemptPersistentConnection]) {
-
- NSString *connectionHeader = [[[self responseHeaders] objectForKey:@"Connection"] lowercaseString];
-
- NSString *httpVersion = [NSMakeCollectable(CFHTTPMessageCopyVersion(message)) autorelease];
-
- // Don't re-use the connection if the server is HTTP 1.0 and didn't send Connection: Keep-Alive
- if (![httpVersion isEqualToString:(NSString *)kCFHTTPVersion1_0] || [connectionHeader isEqualToString:@"keep-alive"]) {
-
- // See if server explicitly told us to close the connection
- if (![connectionHeader isEqualToString:@"close"]) {
-
- NSString *keepAliveHeader = [[self responseHeaders] objectForKey:@"Keep-Alive"];
-
- // If we got a keep alive header, we'll reuse the connection for as long as the server tells us
- if (keepAliveHeader) {
- int timeout = 0;
- int max = 0;
- NSScanner *scanner = [NSScanner scannerWithString:keepAliveHeader];
- [scanner scanString:@"timeout=" intoString:NULL];
- [scanner scanInt:&timeout];
- [scanner scanUpToString:@"max=" intoString:NULL];
- [scanner scanString:@"max=" intoString:NULL];
- [scanner scanInt:&max];
- if (max > 5) {
- [self setConnectionCanBeReused:YES];
- [self setPersistentConnectionTimeoutSeconds:timeout];
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Got a keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]);
- #endif
- }
-
- // Otherwise, we'll assume we can keep this connection open
- } else {
- [self setConnectionCanBeReused:YES];
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Got no keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]);
- #endif
- }
- }
- }
- }
-
- CFRelease(message);
- [self performSelectorOnMainThread:@selector(requestReceivedResponseHeaders:) withObject:[[[self responseHeaders] copy] autorelease] waitUntilDone:[NSThread isMainThread]];
-}
-
-- (BOOL)willRedirect
-{
- // Do we need to redirect?
- if (![self shouldRedirect] || ![responseHeaders valueForKey:@"Location"]) {
- return NO;
- }
-
- // Note that ASIHTTPRequest does not currently support 305 Use Proxy
- int responseCode = [self responseStatusCode];
- if (responseCode != 301 && responseCode != 302 && responseCode != 303 && responseCode != 307) {
- return NO;
- }
-
- [self performSelectorOnMainThread:@selector(requestRedirected) withObject:nil waitUntilDone:[NSThread isMainThread]];
-
- // By default, we redirect 301 and 302 response codes as GET requests
- // According to RFC 2616 this is wrong, but this is what most browsers do, so it's probably what you're expecting to happen
- // See also:
- // http://allseeing-i.lighthouseapp.com/projects/27881/tickets/27-302-redirection-issue
-
- if (responseCode != 307 && (![self shouldUseRFC2616RedirectBehaviour] || responseCode == 303)) {
- [self setRequestMethod:@"GET"];
- [self setPostBody:nil];
- [self setPostLength:0];
-
- // Perhaps there are other headers we should be preserving, but it's hard to know what we need to keep and what to throw away.
- NSString *userAgentHeader = [[self requestHeaders] objectForKey:@"User-Agent"];
- NSString *acceptHeader = [[self requestHeaders] objectForKey:@"Accept"];
- [self setRequestHeaders:nil];
- if (userAgentHeader) {
- [self addRequestHeader:@"User-Agent" value:userAgentHeader];
- }
- if (acceptHeader) {
- [self addRequestHeader:@"Accept" value:acceptHeader];
- }
- [self setHaveBuiltRequestHeaders:NO];
-
- } else {
- // Force rebuild the cookie header incase we got some new cookies from this request
- // All other request headers will remain as they are for 301 / 302 redirects
- [self applyCookieHeader];
- }
-
- // Force the redirected request to rebuild the request headers (if not a 303, it will re-use old ones, and add any new ones)
- [self setRedirectURL:[[NSURL URLWithString:[responseHeaders valueForKey:@"Location"] relativeToURL:[self url]] absoluteURL]];
- [self setNeedsRedirect:YES];
-
- // Clear the request cookies
- // This means manually added cookies will not be added to the redirect request - only those stored in the global persistent store
- // But, this is probably the safest option - we might be redirecting to a different domain
- [self setRequestCookies:[NSMutableArray array]];
-
- #if DEBUG_REQUEST_STATUS
- ASI_DEBUG_LOG(@"[STATUS] Request will redirect (code: %i): %@",responseCode,self);
- #endif
-
- return YES;
-}
-
-- (void)parseStringEncodingFromHeaders
-{
- // Handle response text encoding
- NSStringEncoding charset = 0;
- NSString *mimeType = nil;
- [[self class] parseMimeType:&mimeType andResponseEncoding:&charset fromContentType:[[self responseHeaders] valueForKey:@"Content-Type"]];
- if (charset != 0) {
- [self setResponseEncoding:charset];
- } else {
- [self setResponseEncoding:[self defaultResponseEncoding]];
- }
-}
-
-#pragma mark http authentication
-
-- (void)saveProxyCredentialsToKeychain:(NSDictionary *)newCredentials
-{
- NSURLCredential *authenticationCredentials = [NSURLCredential credentialWithUser:[newCredentials objectForKey:(NSString *)kCFHTTPAuthenticationUsername] password:[newCredentials objectForKey:(NSString *)kCFHTTPAuthenticationPassword] persistence:NSURLCredentialPersistencePermanent];
- if (authenticationCredentials) {
- [ASIHTTPRequest saveCredentials:authenticationCredentials forProxy:[self proxyHost] port:[self proxyPort] realm:[self proxyAuthenticationRealm]];
- }
-}
-
-
-- (void)saveCredentialsToKeychain:(NSDictionary *)newCredentials
-{
- NSURLCredential *authenticationCredentials = [NSURLCredential credentialWithUser:[newCredentials objectForKey:(NSString *)kCFHTTPAuthenticationUsername] password:[newCredentials objectForKey:(NSString *)kCFHTTPAuthenticationPassword] persistence:NSURLCredentialPersistencePermanent];
-
- if (authenticationCredentials) {
- [ASIHTTPRequest saveCredentials:authenticationCredentials forHost:[[self url] host] port:[[[self url] port] intValue] protocol:[[self url] scheme] realm:[self authenticationRealm]];
- }
-}
-
-- (BOOL)applyProxyCredentials:(NSDictionary *)newCredentials
-{
- [self setProxyAuthenticationRetryCount:[self proxyAuthenticationRetryCount]+1];
-
- if (newCredentials && proxyAuthentication && request) {
-
- // Apply whatever credentials we've built up to the old request
- if (CFHTTPMessageApplyCredentialDictionary(request, proxyAuthentication, (CFMutableDictionaryRef)newCredentials, NULL)) {
-
- //If we have credentials and they're ok, let's save them to the keychain
- if (useKeychainPersistence) {
- [self saveProxyCredentialsToKeychain:newCredentials];
- }
- if (useSessionPersistence) {
- NSMutableDictionary *sessionProxyCredentials = [NSMutableDictionary dictionary];
- [sessionProxyCredentials setObject:(id)proxyAuthentication forKey:@"Authentication"];
- [sessionProxyCredentials setObject:newCredentials forKey:@"Credentials"];
- [sessionProxyCredentials setObject:[self proxyHost] forKey:@"Host"];
- [sessionProxyCredentials setObject:[NSNumber numberWithInt:[self proxyPort]] forKey:@"Port"];
- [sessionProxyCredentials setObject:[self proxyAuthenticationScheme] forKey:@"AuthenticationScheme"];
- [[self class] storeProxyAuthenticationCredentialsInSessionStore:sessionProxyCredentials];
- }
- [self setProxyCredentials:newCredentials];
- return YES;
- } else {
- [[self class] removeProxyAuthenticationCredentialsFromSessionStore:newCredentials];
- }
- }
- return NO;
-}
-
-- (BOOL)applyCredentials:(NSDictionary *)newCredentials
-{
- [self setAuthenticationRetryCount:[self authenticationRetryCount]+1];
-
- if (newCredentials && requestAuthentication && request) {
- // Apply whatever credentials we've built up to the old request
- if (CFHTTPMessageApplyCredentialDictionary(request, requestAuthentication, (CFMutableDictionaryRef)newCredentials, NULL)) {
-
- //If we have credentials and they're ok, let's save them to the keychain
- if (useKeychainPersistence) {
- [self saveCredentialsToKeychain:newCredentials];
- }
- if (useSessionPersistence) {
-
- NSMutableDictionary *sessionCredentials = [NSMutableDictionary dictionary];
- [sessionCredentials setObject:(id)requestAuthentication forKey:@"Authentication"];
- [sessionCredentials setObject:newCredentials forKey:@"Credentials"];
- [sessionCredentials setObject:[self url] forKey:@"URL"];
- [sessionCredentials setObject:[self authenticationScheme] forKey:@"AuthenticationScheme"];
- if ([self authenticationRealm]) {
- [sessionCredentials setObject:[self authenticationRealm] forKey:@"AuthenticationRealm"];
- }
- [[self class] storeAuthenticationCredentialsInSessionStore:sessionCredentials];
-
- }
- [self setRequestCredentials:newCredentials];
- return YES;
- } else {
- [[self class] removeAuthenticationCredentialsFromSessionStore:newCredentials];
- }
- }
- return NO;
-}
-
-- (NSMutableDictionary *)findProxyCredentials
-{
- NSMutableDictionary *newCredentials = [[[NSMutableDictionary alloc] init] autorelease];
-
- NSString *user = nil;
- NSString *pass = nil;
-
- ASIHTTPRequest *theRequest = [self mainRequest];
- // If this is a HEAD request generated by an ASINetworkQueue, we'll try to use the details from the main request
- if ([theRequest proxyUsername] && [theRequest proxyPassword]) {
- user = [theRequest proxyUsername];
- pass = [theRequest proxyPassword];
-
- // Let's try to use the ones set in this object
- } else if ([self proxyUsername] && [self proxyPassword]) {
- user = [self proxyUsername];
- pass = [self proxyPassword];
- }
-
- // When we connect to a website using NTLM via a proxy, we will use the main credentials
- if ((!user || !pass) && [self proxyAuthenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM) {
- user = [self username];
- pass = [self password];
- }
-
-
-
- // Ok, that didn't work, let's try the keychain
- // For authenticating proxies, we'll look in the keychain regardless of the value of useKeychainPersistence
- if ((!user || !pass)) {
- NSURLCredential *authenticationCredentials = [ASIHTTPRequest savedCredentialsForProxy:[self proxyHost] port:[self proxyPort] protocol:[[self url] scheme] realm:[self proxyAuthenticationRealm]];
- if (authenticationCredentials) {
- user = [authenticationCredentials user];
- pass = [authenticationCredentials password];
- }
-
- }
-
- // Handle NTLM, which requires a domain to be set too
- if (CFHTTPAuthenticationRequiresAccountDomain(proxyAuthentication)) {
-
- NSString *ntlmDomain = [self proxyDomain];
-
- // If we have no domain yet
- if (!ntlmDomain || [ntlmDomain length] == 0) {
-
- // Let's try to extract it from the username
- NSArray* ntlmComponents = [user componentsSeparatedByString:@"\\"];
- if ([ntlmComponents count] == 2) {
- ntlmDomain = [ntlmComponents objectAtIndex:0];
- user = [ntlmComponents objectAtIndex:1];
-
- // If we are connecting to a website using NTLM, but we are connecting via a proxy, the string we need may be in the domain property
- } else {
- ntlmDomain = [self domain];
- }
- if (!ntlmDomain) {
- ntlmDomain = @"";
- }
- }
- [newCredentials setObject:ntlmDomain forKey:(NSString *)kCFHTTPAuthenticationAccountDomain];
- }
-
-
- // If we have a username and password, let's apply them to the request and continue
- if (user && pass) {
- [newCredentials setObject:user forKey:(NSString *)kCFHTTPAuthenticationUsername];
- [newCredentials setObject:pass forKey:(NSString *)kCFHTTPAuthenticationPassword];
- return newCredentials;
- }
- return nil;
-}
-
-
-- (NSMutableDictionary *)findCredentials
-{
- NSMutableDictionary *newCredentials = [[[NSMutableDictionary alloc] init] autorelease];
-
- // First, let's look at the url to see if the username and password were included
- NSString *user = [[self url] user];
- NSString *pass = [[self url] password];
-
- if (user && pass) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials set on its url",self);
- #endif
-
- } else {
-
- // If this is a HEAD request generated by an ASINetworkQueue, we'll try to use the details from the main request
- if ([self mainRequest] && [[self mainRequest] username] && [[self mainRequest] password]) {
- user = [[self mainRequest] username];
- pass = [[self mainRequest] password];
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials from its parent request",self);
- #endif
-
- // Let's try to use the ones set in this object
- } else if ([self username] && [self password]) {
- user = [self username];
- pass = [self password];
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will use username and password properties as credentials",self);
- #endif
- }
- }
-
- // Ok, that didn't work, let's try the keychain
- if ((!user || !pass) && useKeychainPersistence) {
- NSURLCredential *authenticationCredentials = [ASIHTTPRequest savedCredentialsForHost:[[self url] host] port:[[[self url] port] intValue] protocol:[[self url] scheme] realm:[self authenticationRealm]];
- if (authenticationCredentials) {
- user = [authenticationCredentials user];
- pass = [authenticationCredentials password];
- #if DEBUG_HTTP_AUTHENTICATION
- if (user && pass) {
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials from the keychain",self);
- }
- #endif
- }
- }
-
- // Handle NTLM, which requires a domain to be set too
- if (CFHTTPAuthenticationRequiresAccountDomain(requestAuthentication)) {
-
- NSString *ntlmDomain = [self domain];
-
- // If we have no domain yet, let's try to extract it from the username
- if (!ntlmDomain || [ntlmDomain length] == 0) {
- ntlmDomain = @"";
- NSArray* ntlmComponents = [user componentsSeparatedByString:@"\\"];
- if ([ntlmComponents count] == 2) {
- ntlmDomain = [ntlmComponents objectAtIndex:0];
- user = [ntlmComponents objectAtIndex:1];
- }
- }
- [newCredentials setObject:ntlmDomain forKey:(NSString *)kCFHTTPAuthenticationAccountDomain];
- }
-
- // If we have a username and password, let's apply them to the request and continue
- if (user && pass) {
- [newCredentials setObject:user forKey:(NSString *)kCFHTTPAuthenticationUsername];
- [newCredentials setObject:pass forKey:(NSString *)kCFHTTPAuthenticationPassword];
- return newCredentials;
- }
- return nil;
-}
-
-// Called by delegate or authentication dialog to resume loading once authentication info has been populated
-- (void)retryUsingSuppliedCredentials
-{
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ received credentials from its delegate or an ASIAuthenticationDialog, will retry",self);
- #endif
- //If the url was changed by the delegate, our CFHTTPMessageRef will be NULL and we'll go back to the start
- if (!request) {
- [self performSelector:@selector(main) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
- return;
- }
- [self performSelector:@selector(attemptToApplyCredentialsAndResume) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
-}
-
-// Called by delegate or authentication dialog to cancel authentication
-- (void)cancelAuthentication
-{
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ had authentication cancelled by its delegate or an ASIAuthenticationDialog",self);
- #endif
- [self performSelector:@selector(failAuthentication) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO];
-}
-
-- (void)failAuthentication
-{
- [self failWithError:ASIAuthenticationError];
-}
-
-- (BOOL)showProxyAuthenticationDialog
-{
- if ([self isSynchronous]) {
- return NO;
- }
-
- // Mac authentication dialog coming soon!
- #if TARGET_OS_IPHONE
- if ([self shouldPresentProxyAuthenticationDialog]) {
- [ASIAuthenticationDialog performSelectorOnMainThread:@selector(presentAuthenticationDialogForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
- return YES;
- }
- return NO;
- #else
- return NO;
- #endif
-}
-
-
-- (BOOL)willAskDelegateForProxyCredentials
-{
- if ([self isSynchronous]) {
- return NO;
- }
-
- // If we have a delegate, we'll see if it can handle proxyAuthenticationNeededForRequest:.
- // Otherwise, we'll try the queue (if this request is part of one) and it will pass the message on to its own delegate
- id authenticationDelegate = [self delegate];
- if (!authenticationDelegate) {
- authenticationDelegate = [self queue];
- }
-
- BOOL delegateOrBlockWillHandleAuthentication = NO;
-
- if ([authenticationDelegate respondsToSelector:@selector(proxyAuthenticationNeededForRequest:)]) {
- delegateOrBlockWillHandleAuthentication = YES;
- }
-
- #if NS_BLOCKS_AVAILABLE
- if(proxyAuthenticationNeededBlock){
- delegateOrBlockWillHandleAuthentication = YES;
- }
- #endif
-
- if (delegateOrBlockWillHandleAuthentication) {
- [self performSelectorOnMainThread:@selector(askDelegateForProxyCredentials) withObject:nil waitUntilDone:NO];
- }
-
- return delegateOrBlockWillHandleAuthentication;
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)askDelegateForProxyCredentials
-{
- id authenticationDelegate = [self delegate];
- if (!authenticationDelegate) {
- authenticationDelegate = [self queue];
- }
- if ([authenticationDelegate respondsToSelector:@selector(proxyAuthenticationNeededForRequest:)]) {
- [authenticationDelegate performSelector:@selector(proxyAuthenticationNeededForRequest:) withObject:self];
- return;
- }
- #if NS_BLOCKS_AVAILABLE
- if(proxyAuthenticationNeededBlock){
- proxyAuthenticationNeededBlock();
- }
- #endif
-}
-
-
-- (BOOL)willAskDelegateForCredentials
-{
- if ([self isSynchronous]) {
- return NO;
- }
-
- // If we have a delegate, we'll see if it can handle proxyAuthenticationNeededForRequest:.
- // Otherwise, we'll try the queue (if this request is part of one) and it will pass the message on to its own delegate
- id authenticationDelegate = [self delegate];
- if (!authenticationDelegate) {
- authenticationDelegate = [self queue];
- }
-
- BOOL delegateOrBlockWillHandleAuthentication = NO;
-
- if ([authenticationDelegate respondsToSelector:@selector(authenticationNeededForRequest:)]) {
- delegateOrBlockWillHandleAuthentication = YES;
- }
-
- #if NS_BLOCKS_AVAILABLE
- if (authenticationNeededBlock) {
- delegateOrBlockWillHandleAuthentication = YES;
- }
- #endif
-
- if (delegateOrBlockWillHandleAuthentication) {
- [self performSelectorOnMainThread:@selector(askDelegateForCredentials) withObject:nil waitUntilDone:NO];
- }
- return delegateOrBlockWillHandleAuthentication;
-}
-
-/* ALWAYS CALLED ON MAIN THREAD! */
-- (void)askDelegateForCredentials
-{
- id authenticationDelegate = [self delegate];
- if (!authenticationDelegate) {
- authenticationDelegate = [self queue];
- }
-
- if ([authenticationDelegate respondsToSelector:@selector(authenticationNeededForRequest:)]) {
- [authenticationDelegate performSelector:@selector(authenticationNeededForRequest:) withObject:self];
- return;
- }
-
- #if NS_BLOCKS_AVAILABLE
- if (authenticationNeededBlock) {
- authenticationNeededBlock();
- }
- #endif
-}
-
-- (void)attemptToApplyProxyCredentialsAndResume
-{
-
- if ([self error] || [self isCancelled]) {
- return;
- }
-
- // Read authentication data
- if (!proxyAuthentication) {
- CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader);
- proxyAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
- CFRelease(responseHeader);
- [self setProxyAuthenticationScheme:[NSMakeCollectable(CFHTTPAuthenticationCopyMethod(proxyAuthentication)) autorelease]];
- }
-
- // If we haven't got a CFHTTPAuthenticationRef by now, something is badly wrong, so we'll have to give up
- if (!proxyAuthentication) {
- [self cancelLoad];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to get authentication object from response headers",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
- // Get the authentication realm
- [self setProxyAuthenticationRealm:nil];
- if (!CFHTTPAuthenticationRequiresAccountDomain(proxyAuthentication)) {
- [self setProxyAuthenticationRealm:[NSMakeCollectable(CFHTTPAuthenticationCopyRealm(proxyAuthentication)) autorelease]];
- }
-
- // See if authentication is valid
- CFStreamError err;
- if (!CFHTTPAuthenticationIsValid(proxyAuthentication, &err)) {
-
- CFRelease(proxyAuthentication);
- proxyAuthentication = NULL;
-
- // check for bad credentials, so we can give the delegate a chance to replace them
- if (err.domain == kCFStreamErrorDomainHTTP && (err.error == kCFStreamErrorHTTPAuthenticationBadUserName || err.error == kCFStreamErrorHTTPAuthenticationBadPassword)) {
-
- // Prevent more than one request from asking for credentials at once
- [delegateAuthenticationLock lock];
-
- // We know the credentials we just presented are bad, we should remove them from the session store too
- [[self class] removeProxyAuthenticationCredentialsFromSessionStore:proxyCredentials];
- [self setProxyCredentials:nil];
-
-
- // If the user cancelled authentication via a dialog presented by another request, our queue may have cancelled us
- if ([self error] || [self isCancelled]) {
- [delegateAuthenticationLock unlock];
- return;
- }
-
-
- // Now we've acquired the lock, it may be that the session contains credentials we can re-use for this request
- if ([self useSessionPersistence]) {
- NSDictionary *credentials = [self findSessionProxyAuthenticationCredentials];
- if (credentials && [self applyProxyCredentials:[credentials objectForKey:@"Credentials"]]) {
- [delegateAuthenticationLock unlock];
- [self startRequest];
- return;
- }
- }
-
- [self setLastActivityTime:nil];
-
- if ([self willAskDelegateForProxyCredentials]) {
- [self attemptToApplyProxyCredentialsAndResume];
- [delegateAuthenticationLock unlock];
- return;
- }
- if ([self showProxyAuthenticationDialog]) {
- [self attemptToApplyProxyCredentialsAndResume];
- [delegateAuthenticationLock unlock];
- return;
- }
- [delegateAuthenticationLock unlock];
- }
- [self cancelLoad];
- [self failWithError:ASIAuthenticationError];
- return;
- }
-
- [self cancelLoad];
-
- if (proxyCredentials) {
-
- // We use startRequest rather than starting all over again in load request because NTLM requires we reuse the request
- if ((([self proxyAuthenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM) || [self proxyAuthenticationRetryCount] < 2) && [self applyProxyCredentials:proxyCredentials]) {
- [self startRequest];
-
- // We've failed NTLM authentication twice, we should assume our credentials are wrong
- } else if ([self proxyAuthenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && [self proxyAuthenticationRetryCount] == 2) {
- [self failWithError:ASIAuthenticationError];
-
- // Something went wrong, we'll have to give up
- } else {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply proxy credentials to request",NSLocalizedDescriptionKey,nil]]];
- }
-
- // Are a user name & password needed?
- } else if (CFHTTPAuthenticationRequiresUserNameAndPassword(proxyAuthentication)) {
-
- // Prevent more than one request from asking for credentials at once
- [delegateAuthenticationLock lock];
-
- // If the user cancelled authentication via a dialog presented by another request, our queue may have cancelled us
- if ([self error] || [self isCancelled]) {
- [delegateAuthenticationLock unlock];
- return;
- }
-
- // Now we've acquired the lock, it may be that the session contains credentials we can re-use for this request
- if ([self useSessionPersistence]) {
- NSDictionary *credentials = [self findSessionProxyAuthenticationCredentials];
- if (credentials && [self applyProxyCredentials:[credentials objectForKey:@"Credentials"]]) {
- [delegateAuthenticationLock unlock];
- [self startRequest];
- return;
- }
- }
-
- NSMutableDictionary *newCredentials = [self findProxyCredentials];
-
- //If we have some credentials to use let's apply them to the request and continue
- if (newCredentials) {
-
- if ([self applyProxyCredentials:newCredentials]) {
- [delegateAuthenticationLock unlock];
- [self startRequest];
- } else {
- [delegateAuthenticationLock unlock];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply proxy credentials to request",NSLocalizedDescriptionKey,nil]]];
- }
-
- return;
- }
-
- if ([self willAskDelegateForProxyCredentials]) {
- [delegateAuthenticationLock unlock];
- return;
- }
-
- if ([self showProxyAuthenticationDialog]) {
- [delegateAuthenticationLock unlock];
- return;
- }
- [delegateAuthenticationLock unlock];
-
- // The delegate isn't interested and we aren't showing the authentication dialog, we'll have to give up
- [self failWithError:ASIAuthenticationError];
- return;
- }
-
-}
-
-- (BOOL)showAuthenticationDialog
-{
- if ([self isSynchronous]) {
- return NO;
- }
- // Mac authentication dialog coming soon!
- #if TARGET_OS_IPHONE
- if ([self shouldPresentAuthenticationDialog]) {
- [ASIAuthenticationDialog performSelectorOnMainThread:@selector(presentAuthenticationDialogForRequest:) withObject:self waitUntilDone:[NSThread isMainThread]];
- return YES;
- }
- return NO;
- #else
- return NO;
- #endif
-}
-
-- (void)attemptToApplyCredentialsAndResume
-{
- if ([self error] || [self isCancelled]) {
- return;
- }
-
- // Do we actually need to authenticate with a proxy?
- if ([self authenticationNeeded] == ASIProxyAuthenticationNeeded) {
- [self attemptToApplyProxyCredentialsAndResume];
- return;
- }
-
- // Read authentication data
- if (!requestAuthentication) {
- CFHTTPMessageRef responseHeader = (CFHTTPMessageRef) CFReadStreamCopyProperty((CFReadStreamRef)[self readStream],kCFStreamPropertyHTTPResponseHeader);
- requestAuthentication = CFHTTPAuthenticationCreateFromResponse(NULL, responseHeader);
- CFRelease(responseHeader);
- [self setAuthenticationScheme:[NSMakeCollectable(CFHTTPAuthenticationCopyMethod(requestAuthentication)) autorelease]];
- }
-
- if (!requestAuthentication) {
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ failed to read authentication information from response headers",self);
- #endif
-
- [self cancelLoad];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to get authentication object from response headers",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
- // Get the authentication realm
- [self setAuthenticationRealm:nil];
- if (!CFHTTPAuthenticationRequiresAccountDomain(requestAuthentication)) {
- [self setAuthenticationRealm:[NSMakeCollectable(CFHTTPAuthenticationCopyRealm(requestAuthentication)) autorelease]];
- }
-
- #if DEBUG_HTTP_AUTHENTICATION
- NSString *realm = [self authenticationRealm];
- if (realm) {
- realm = [NSString stringWithFormat:@" (Realm: %@)",realm];
- } else {
- realm = @"";
- }
- if ([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM || [self authenticationRetryCount] == 0) {
- ASI_DEBUG_LOG(@"[AUTH] Request %@ received 401 challenge and must authenticate using %@%@",self,[self authenticationScheme],realm);
- } else {
- ASI_DEBUG_LOG(@"[AUTH] Request %@ NTLM handshake step %i",self,[self authenticationRetryCount]+1);
- }
- #endif
-
- // See if authentication is valid
- CFStreamError err;
- if (!CFHTTPAuthenticationIsValid(requestAuthentication, &err)) {
-
- CFRelease(requestAuthentication);
- requestAuthentication = NULL;
-
- // check for bad credentials, so we can give the delegate a chance to replace them
- if (err.domain == kCFStreamErrorDomainHTTP && (err.error == kCFStreamErrorHTTPAuthenticationBadUserName || err.error == kCFStreamErrorHTTPAuthenticationBadPassword)) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ had bad credentials, will remove them from the session store if they are cached",self);
- #endif
-
- // Prevent more than one request from asking for credentials at once
- [delegateAuthenticationLock lock];
-
- // We know the credentials we just presented are bad, we should remove them from the session store too
- [[self class] removeAuthenticationCredentialsFromSessionStore:requestCredentials];
- [self setRequestCredentials:nil];
-
- // If the user cancelled authentication via a dialog presented by another request, our queue may have cancelled us
- if ([self error] || [self isCancelled]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self);
- #endif
-
- [delegateAuthenticationLock unlock];
- return;
- }
-
- // Now we've acquired the lock, it may be that the session contains credentials we can re-use for this request
- if ([self useSessionPersistence]) {
- NSDictionary *credentials = [self findSessionAuthenticationCredentials];
- if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]);
- #endif
-
- [delegateAuthenticationLock unlock];
- [self startRequest];
- return;
- }
- }
-
- [self setLastActivityTime:nil];
-
- if ([self willAskDelegateForCredentials]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask its delegate for credentials to use",self);
- #endif
-
- [delegateAuthenticationLock unlock];
- return;
- }
- if ([self showAuthenticationDialog]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self);
- #endif
-
- [delegateAuthenticationLock unlock];
- return;
- }
- [delegateAuthenticationLock unlock];
- }
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ has no credentials to present and must give up",self);
- #endif
-
- [self cancelLoad];
- [self failWithError:ASIAuthenticationError];
- return;
- }
-
- [self cancelLoad];
-
- if (requestCredentials) {
-
- if ((([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM) || [self authenticationRetryCount] < 2) && [self applyCredentials:requestCredentials]) {
- [self startRequest];
-
- // We've failed NTLM authentication twice, we should assume our credentials are wrong
- } else if ([self authenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && [self authenticationRetryCount ] == 2) {
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ has failed NTLM authentication",self);
- #endif
-
- [self failWithError:ASIAuthenticationError];
-
- } else {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ had credentials and they were not marked as bad, but we got a 401 all the same.",self);
- #endif
-
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]];
- }
-
- // Are a user name & password needed?
- } else if (CFHTTPAuthenticationRequiresUserNameAndPassword(requestAuthentication)) {
-
- // Prevent more than one request from asking for credentials at once
- [delegateAuthenticationLock lock];
-
- // If the user cancelled authentication via a dialog presented by another request, our queue may have cancelled us
- if ([self error] || [self isCancelled]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self);
- #endif
-
- [delegateAuthenticationLock unlock];
- return;
- }
-
- // Now we've acquired the lock, it may be that the session contains credentials we can re-use for this request
- if ([self useSessionPersistence]) {
- NSDictionary *credentials = [self findSessionAuthenticationCredentials];
- if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]);
- #endif
-
- [delegateAuthenticationLock unlock];
- [self startRequest];
- return;
- }
- }
-
-
- NSMutableDictionary *newCredentials = [self findCredentials];
-
- //If we have some credentials to use let's apply them to the request and continue
- if (newCredentials) {
-
- if ([self applyCredentials:newCredentials]) {
- [delegateAuthenticationLock unlock];
- [self startRequest];
- } else {
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ failed to apply credentials",self);
- #endif
- [delegateAuthenticationLock unlock];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]];
- }
- return;
- }
- if ([self willAskDelegateForCredentials]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask its delegate for credentials to use",self);
- #endif
-
- [delegateAuthenticationLock unlock];
- return;
- }
- if ([self showAuthenticationDialog]) {
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self);
- #endif
-
- [delegateAuthenticationLock unlock];
- return;
- }
-
- #if DEBUG_HTTP_AUTHENTICATION
- ASI_DEBUG_LOG(@"[AUTH] Request %@ has no credentials to present and must give up",self);
- #endif
- [delegateAuthenticationLock unlock];
- [self failWithError:ASIAuthenticationError];
- return;
- }
-
-}
-
-- (void)addBasicAuthenticationHeaderWithUsername:(NSString *)theUsername andPassword:(NSString *)thePassword
-{
- [self addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"Basic %@",[ASIHTTPRequest base64forData:[[NSString stringWithFormat:@"%@:%@",theUsername,thePassword] dataUsingEncoding:NSUTF8StringEncoding]]]];
- [self setAuthenticationScheme:(NSString *)kCFHTTPAuthenticationSchemeBasic];
-
-}
-
-
-#pragma mark stream status handlers
-
-- (void)handleNetworkEvent:(CFStreamEventType)type
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- [[self cancelledLock] lock];
-
- if ([self complete] || [self isCancelled]) {
- [[self cancelledLock] unlock];
- [pool drain];
- return;
- }
-
- CFRetain(self);
-
- // Dispatch the stream events.
- switch (type) {
- case kCFStreamEventHasBytesAvailable:
- [self handleBytesAvailable];
- break;
-
- case kCFStreamEventEndEncountered:
- [self handleStreamComplete];
- break;
-
- case kCFStreamEventErrorOccurred:
- [self handleStreamError];
- break;
-
- default:
- break;
- }
-
- [self performThrottling];
-
- [[self cancelledLock] unlock];
-
- if ([self downloadComplete] && [self needsRedirect]) {
- if (![self willAskDelegateToConfirmRedirect]) {
- [self performRedirect];
- }
- } else if ([self downloadComplete] && [self authenticationNeeded]) {
- [self attemptToApplyCredentialsAndResume];
- }
-
- CFRelease(self);
- [pool drain];
-}
-
-- (BOOL)willAskDelegateToConfirmRedirect
-{
- // We must lock to ensure delegate / queue aren't changed while we check them
- [[self cancelledLock] lock];
-
- // Here we perform an initial check to see if either the delegate or the queue wants to be asked about the redirect, because if not we should redirect straight away
- // We will check again on the main thread later
- BOOL needToAskDelegateAboutRedirect = (([self delegate] && [[self delegate] respondsToSelector:[self willRedirectSelector]]) || ([self queue] && [[self queue] respondsToSelector:@selector(request:willRedirectToURL:)]));
-
- [[self cancelledLock] unlock];
-
- // Either the delegate or the queue's delegate is interested in being told when we are about to redirect
- if (needToAskDelegateAboutRedirect) {
- NSURL *newURL = [[[self redirectURL] copy] autorelease];
- [self setRedirectURL:nil];
- [self performSelectorOnMainThread:@selector(requestWillRedirectToURL:) withObject:newURL waitUntilDone:[NSThread isMainThread]];
- return true;
- }
- return false;
-}
-
-- (void)handleBytesAvailable
-{
- if (![self responseHeaders]) {
- [self readResponseHeaders];
- }
-
- // If we've cancelled the load part way through (for example, after deciding to use a cached version)
- if ([self complete]) {
- return;
- }
-
- // In certain (presumably very rare) circumstances, handleBytesAvailable seems to be called when there isn't actually any data available
- // We'll check that there is actually data available to prevent blocking on CFReadStreamRead()
- // So far, I've only seen this in the stress tests, so it might never happen in real-world situations.
- if (!CFReadStreamHasBytesAvailable((CFReadStreamRef)[self readStream])) {
- return;
- }
-
- long long bufferSize = 16384;
- if (contentLength > 262144) {
- bufferSize = 262144;
- } else if (contentLength > 65536) {
- bufferSize = 65536;
- }
-
- // Reduce the buffer size if we're receiving data too quickly when bandwidth throttling is active
- // This just augments the throttling done in measureBandwidthUsage to reduce the amount we go over the limit
-
- if ([[self class] isBandwidthThrottled]) {
- [bandwidthThrottlingLock lock];
- if (maxBandwidthPerSecond > 0) {
- long long maxiumumSize = (long long)maxBandwidthPerSecond-(long long)bandwidthUsedInLastSecond;
- if (maxiumumSize < 0) {
- // We aren't supposed to read any more data right now, but we'll read a single byte anyway so the CFNetwork's buffer isn't full
- bufferSize = 1;
- } else if (maxiumumSize/4 < bufferSize) {
- // We were going to fetch more data that we should be allowed, so we'll reduce the size of our read
- bufferSize = maxiumumSize/4;
- }
- }
- if (bufferSize < 1) {
- bufferSize = 1;
- }
- [bandwidthThrottlingLock unlock];
- }
-
-
- UInt8 buffer[bufferSize];
- NSInteger bytesRead = [[self readStream] read:buffer maxLength:sizeof(buffer)];
-
- // Less than zero is an error
- if (bytesRead < 0) {
- [self handleStreamError];
-
- // If zero bytes were read, wait for the EOF to come.
- } else if (bytesRead) {
-
- // If we are inflating the response on the fly
- NSData *inflatedData = nil;
- if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) {
- if (![self dataDecompressor]) {
- [self setDataDecompressor:[ASIDataDecompressor decompressor]];
- }
- NSError *err = nil;
- inflatedData = [[self dataDecompressor] uncompressBytes:buffer length:bytesRead error:&err];
- if (err) {
- [self failWithError:err];
- return;
- }
- }
-
- [self setTotalBytesRead:[self totalBytesRead]+bytesRead];
- [self setLastActivityTime:[NSDate date]];
-
- // For bandwidth measurement / throttling
- [ASIHTTPRequest incrementBandwidthUsedInLastSecond:bytesRead];
-
- // If we need to redirect, and have automatic redirect on, and might be resuming a download, let's do nothing with the content
- if ([self needsRedirect] && [self shouldRedirect] && [self allowResumeForFileDownloads]) {
- return;
- }
-
- BOOL dataWillBeHandledExternally = NO;
- if ([[self delegate] respondsToSelector:[self didReceiveDataSelector]]) {
- dataWillBeHandledExternally = YES;
- }
- #if NS_BLOCKS_AVAILABLE
- if (dataReceivedBlock) {
- dataWillBeHandledExternally = YES;
- }
- #endif
- // Does the delegate want to handle the data manually?
- if (dataWillBeHandledExternally) {
-
- NSData *data = nil;
- if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) {
- data = inflatedData;
- } else {
- data = [NSData dataWithBytes:buffer length:bytesRead];
- }
- [self performSelectorOnMainThread:@selector(passOnReceivedData:) withObject:data waitUntilDone:[NSThread isMainThread]];
-
- // Are we downloading to a file?
- } else if ([self downloadDestinationPath]) {
- BOOL append = NO;
- if (![self fileDownloadOutputStream]) {
- if (![self temporaryFileDownloadPath]) {
- [self setTemporaryFileDownloadPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]];
- } else if ([self allowResumeForFileDownloads] && [[self requestHeaders] objectForKey:@"Range"]) {
- if ([[self responseHeaders] objectForKey:@"Content-Range"]) {
- append = YES;
- } else {
- [self incrementDownloadSizeBy:-[self partialDownloadSize]];
- [self setPartialDownloadSize:0];
- }
- }
-
- [self setFileDownloadOutputStream:[[[NSOutputStream alloc] initToFileAtPath:[self temporaryFileDownloadPath] append:append] autorelease]];
- [[self fileDownloadOutputStream] open];
-
- }
- [[self fileDownloadOutputStream] write:buffer maxLength:bytesRead];
-
- if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) {
-
- if (![self inflatedFileDownloadOutputStream]) {
- if (![self temporaryUncompressedDataDownloadPath]) {
- [self setTemporaryUncompressedDataDownloadPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]];
- }
-
- [self setInflatedFileDownloadOutputStream:[[[NSOutputStream alloc] initToFileAtPath:[self temporaryUncompressedDataDownloadPath] append:append] autorelease]];
- [[self inflatedFileDownloadOutputStream] open];
- }
-
- [[self inflatedFileDownloadOutputStream] write:[inflatedData bytes] maxLength:[inflatedData length]];
- }
-
-
- //Otherwise, let's add the data to our in-memory store
- } else {
- if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) {
- [rawResponseData appendData:inflatedData];
- } else {
- [rawResponseData appendBytes:buffer length:bytesRead];
- }
- }
- }
-}
-
-- (void)handleStreamComplete
-{
-
-#if DEBUG_REQUEST_STATUS
- ASI_DEBUG_LOG(@"[STATUS] Request %@ finished downloading data (%qu bytes)",self, [self totalBytesRead]);
-#endif
- [self setStatusTimer:nil];
- [self setDownloadComplete:YES];
-
- if (![self responseHeaders]) {
- [self readResponseHeaders];
- }
-
- [progressLock lock];
- // Find out how much data we've uploaded so far
- [self setLastBytesSent:totalBytesSent];
- [self setTotalBytesSent:[[NSMakeCollectable(CFReadStreamCopyProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease] unsignedLongLongValue]];
- [self setComplete:YES];
- if (![self contentLength]) {
- [self setContentLength:[self totalBytesRead]];
- }
- [self updateProgressIndicators];
-
-
- [[self postBodyReadStream] close];
- [self setPostBodyReadStream:nil];
-
- [self setDataDecompressor:nil];
-
- NSError *fileError = nil;
-
- // Delete up the request body temporary file, if it exists
- if ([self didCreateTemporaryPostDataFile] && ![self authenticationNeeded]) {
- [self removeTemporaryUploadFile];
- [self removeTemporaryCompressedUploadFile];
- }
-
- // Close the output stream as we're done writing to the file
- if ([self temporaryFileDownloadPath]) {
-
- [[self fileDownloadOutputStream] close];
- [self setFileDownloadOutputStream:nil];
-
- [[self inflatedFileDownloadOutputStream] close];
- [self setInflatedFileDownloadOutputStream:nil];
-
- // If we are going to redirect and we are resuming, let's ignore this download
- if ([self shouldRedirect] && [self needsRedirect] && [self allowResumeForFileDownloads]) {
-
- } else if ([self isResponseCompressed]) {
-
- // Decompress the file directly to the destination path
- if ([self shouldWaitToInflateCompressedResponses]) {
- [ASIDataDecompressor uncompressDataFromFile:[self temporaryFileDownloadPath] toFile:[self downloadDestinationPath] error:&fileError];
-
- // Response should already have been inflated, move the temporary file to the destination path
- } else {
- NSError *moveError = nil;
- [[[[NSFileManager alloc] init] autorelease] moveItemAtPath:[self temporaryUncompressedDataDownloadPath] toPath:[self downloadDestinationPath] error:&moveError];
- if (moveError) {
- fileError = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to move file from '%@' to '%@'",[self temporaryFileDownloadPath],[self downloadDestinationPath]],NSLocalizedDescriptionKey,moveError,NSUnderlyingErrorKey,nil]];
- }
- [self setTemporaryUncompressedDataDownloadPath:nil];
-
- }
- [self removeTemporaryDownloadFile];
-
- } else {
-
- //Remove any file at the destination path
- NSError *moveError = nil;
- if (![[self class] removeFileAtPath:[self downloadDestinationPath] error:&moveError]) {
- fileError = moveError;
-
- }
-
- //Move the temporary file to the destination path
- if (!fileError) {
- [[[[NSFileManager alloc] init] autorelease] moveItemAtPath:[self temporaryFileDownloadPath] toPath:[self downloadDestinationPath] error:&moveError];
- if (moveError) {
- fileError = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to move file from '%@' to '%@'",[self temporaryFileDownloadPath],[self downloadDestinationPath]],NSLocalizedDescriptionKey,moveError,NSUnderlyingErrorKey,nil]];
- }
- [self setTemporaryFileDownloadPath:nil];
- }
-
- }
- }
-
- // Save to the cache
- if ([self downloadCache] && ![self didUseCachedResponse]) {
- [[self downloadCache] storeResponseForRequest:self maxAge:[self secondsToCache]];
- }
-
- [progressLock unlock];
-
-
- [connectionsLock lock];
- if (![self connectionCanBeReused]) {
- [self unscheduleReadStream];
- }
- #if DEBUG_PERSISTENT_CONNECTIONS
- if ([self requestID]) {
- ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ finished using connection #%@",[self requestID], [[self connectionInfo] objectForKey:@"id"]);
- }
- #endif
- [[self connectionInfo] removeObjectForKey:@"request"];
- [[self connectionInfo] setObject:[NSDate dateWithTimeIntervalSinceNow:[self persistentConnectionTimeoutSeconds]] forKey:@"expires"];
- [connectionsLock unlock];
-
- if (![self authenticationNeeded]) {
- [self destroyReadStream];
- }
-
-
- if (![self needsRedirect] && ![self authenticationNeeded] && ![self didUseCachedResponse]) {
-
- if (fileError) {
- [self failWithError:fileError];
- } else {
- [self requestFinished];
- }
-
- [self markAsFinished];
-
- // If request has asked delegate or ASIAuthenticationDialog for credentials
- } else if ([self authenticationNeeded]) {
- // Do nothing.
- }
-
-}
-
-- (void)markAsFinished
-{
- // Autoreleased requests may well be dealloced here otherwise
- CFRetain(self);
-
- // dealloc won't be called when running with GC, so we'll clean these up now
- if (request) {
- CFRelease(request);
- request = nil;
- }
- if (requestAuthentication) {
- CFRelease(requestAuthentication);
- requestAuthentication = nil;
- }
- if (proxyAuthentication) {
- CFRelease(proxyAuthentication);
- proxyAuthentication = nil;
- }
-
- BOOL wasInProgress = inProgress;
- BOOL wasFinished = finished;
-
- if (!wasFinished)
- [self willChangeValueForKey:@"isFinished"];
- if (wasInProgress)
- [self willChangeValueForKey:@"isExecuting"];
-
- [self setInProgress:NO];
- finished = YES;
-
- if (wasInProgress)
- [self didChangeValueForKey:@"isExecuting"];
- if (!wasFinished)
- [self didChangeValueForKey:@"isFinished"];
-
- #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
- if ([ASIHTTPRequest isMultitaskingSupported] && [self shouldContinueWhenAppEntersBackground]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (backgroundTask != UIBackgroundTaskInvalid) {
- [[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
- backgroundTask = UIBackgroundTaskInvalid;
- }
- });
- }
- #endif
- CFRelease(self);
-}
-
-- (void)useDataFromCache
-{
- NSDictionary *headers = [[self downloadCache] cachedResponseHeadersForURL:[self url]];
- NSString *dataPath = [[self downloadCache] pathToCachedResponseDataForURL:[self url]];
-
- ASIHTTPRequest *theRequest = self;
- if ([self mainRequest]) {
- theRequest = [self mainRequest];
- }
-
- if (headers && dataPath) {
-
- [self setResponseStatusCode:[[headers objectForKey:@"X-ASIHTTPRequest-Response-Status-Code"] intValue]];
- [self setDidUseCachedResponse:YES];
- [theRequest setResponseHeaders:headers];
-
- if ([theRequest downloadDestinationPath]) {
- [theRequest setDownloadDestinationPath:dataPath];
- } else {
- [theRequest setRawResponseData:[NSMutableData dataWithData:[[self downloadCache] cachedResponseDataForURL:[self url]]]];
- }
- [theRequest setContentLength:[[[self responseHeaders] objectForKey:@"Content-Length"] longLongValue]];
- [theRequest setTotalBytesRead:[self contentLength]];
-
- [theRequest parseStringEncodingFromHeaders];
-
- [theRequest setResponseCookies:[NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:[self url]]];
-
- // See if we need to redirect
- if ([self willRedirect]) {
- if (![self willAskDelegateToConfirmRedirect]) {
- [self performRedirect];
- }
- return;
- }
- }
-
- [theRequest setComplete:YES];
- [theRequest setDownloadComplete:YES];
-
- // If we're pulling data from the cache without contacting the server at all, we won't have set originalURL yet
- if ([self redirectCount] == 0) {
- [theRequest setOriginalURL:[theRequest url]];
- }
-
- [theRequest updateProgressIndicators];
- [theRequest requestFinished];
- [theRequest markAsFinished];
- if ([self mainRequest]) {
- [self markAsFinished];
- }
-}
-
-- (BOOL)retryUsingNewConnection
-{
- if ([self retryCount] == 0) {
-
- [self setWillRetryRequest:YES];
- [self cancelLoad];
- [self setWillRetryRequest:NO];
-
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]);
- #endif
- [connectionsLock lock];
- [[self connectionInfo] removeObjectForKey:@"request"];
- [persistentConnectionsPool removeObject:[self connectionInfo]];
- [self setConnectionInfo:nil];
- [connectionsLock unlock];
- [self setRetryCount:[self retryCount]+1];
- [self startRequest];
- return YES;
- }
- #if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - we have already retried with a new connection, so we must give up", [[self connectionInfo] objectForKey:@"id"]);
- #endif
- return NO;
-}
-
-- (void)handleStreamError
-
-{
- NSError *underlyingError = [NSMakeCollectable(CFReadStreamCopyError((CFReadStreamRef)[self readStream])) autorelease];
-
- if (![self error]) { // We may already have handled this error
-
- // First, check for a 'socket not connected', 'broken pipe' or 'connection lost' error
- // This may occur when we've attempted to reuse a connection that should have been closed
- // If we get this, we need to retry the request
- // We'll only do this once - if it happens again on retry, we'll give up
- // -1005 = kCFURLErrorNetworkConnectionLost - this doesn't seem to be declared on Mac OS 10.5
- if (([[underlyingError domain] isEqualToString:NSPOSIXErrorDomain] && ([underlyingError code] == ENOTCONN || [underlyingError code] == EPIPE))
- || ([[underlyingError domain] isEqualToString:(NSString *)kCFErrorDomainCFNetwork] && [underlyingError code] == -1005)) {
- if ([self retryUsingNewConnection]) {
- return;
- }
- }
-
- NSString *reason = @"A connection failure occurred";
-
- // We'll use a custom error message for SSL errors, but you should always check underlying error if you want more details
- // For some reason SecureTransport.h doesn't seem to be available on iphone, so error codes hard-coded
- // Also, iPhone seems to handle errors differently from Mac OS X - a self-signed certificate returns a different error code on each platform, so we'll just provide a general error
- if ([[underlyingError domain] isEqualToString:NSOSStatusErrorDomain]) {
- if ([underlyingError code] <= -9800 && [underlyingError code] >= -9818) {
- reason = [NSString stringWithFormat:@"%@: SSL problem (Possible causes may include a bad/expired/self-signed certificate, clock set to wrong date)",reason];
- }
- }
- [self cancelLoad];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIConnectionFailureErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:reason,NSLocalizedDescriptionKey,underlyingError,NSUnderlyingErrorKey,nil]]];
- } else {
- [self cancelLoad];
- }
- [self checkRequestStatus];
-}
-
-#pragma mark managing the read stream
-
-- (void)destroyReadStream
-{
- if ([self readStream]) {
- [self unscheduleReadStream];
- if (![self connectionCanBeReused]) {
- [[self readStream] removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:[self runLoopMode]];
- [[self readStream] close];
- }
- [self setReadStream:nil];
- }
-}
-
-- (void)scheduleReadStream
-{
- if ([self readStream] && ![self readStreamIsScheduled]) {
-
- [connectionsLock lock];
- runningRequestCount++;
- if (shouldUpdateNetworkActivityIndicator) {
- [[self class] showNetworkActivityIndicator];
- }
- [connectionsLock unlock];
-
- // Reset the timeout
- [self setLastActivityTime:[NSDate date]];
- CFStreamClientContext ctxt = {0, self, NULL, NULL, NULL};
- CFReadStreamSetClient((CFReadStreamRef)[self readStream], kNetworkEvents, ReadStreamClientCallBack, &ctxt);
- [[self readStream] scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:[self runLoopMode]];
- [self setReadStreamIsScheduled:YES];
- }
-}
-
-
-- (void)unscheduleReadStream
-{
- if ([self readStream] && [self readStreamIsScheduled]) {
-
- [connectionsLock lock];
- runningRequestCount--;
- if (shouldUpdateNetworkActivityIndicator && runningRequestCount == 0) {
- // This call will wait half a second before turning off the indicator
- // This can prevent flicker when you have a single request finish and then immediately start another request
- // We run this on the main thread because we have no guarantee this thread will have a runloop in 0.5 seconds time
- // We don't bother the cancel this call if we start a new request, because we'll check if requests are running before we hide it
- [[self class] performSelectorOnMainThread:@selector(hideNetworkActivityIndicatorAfterDelay) withObject:nil waitUntilDone:[NSThread isMainThread]];
- }
- [connectionsLock unlock];
-
- CFReadStreamSetClient((CFReadStreamRef)[self readStream], kCFStreamEventNone, NULL, NULL);
- [[self readStream] removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:[self runLoopMode]];
- [self setReadStreamIsScheduled:NO];
- }
-}
-
-#pragma mark cleanup
-
-- (BOOL)removeTemporaryDownloadFile
-{
- NSError *err = nil;
- if ([self temporaryFileDownloadPath]) {
- if (![[self class] removeFileAtPath:[self temporaryFileDownloadPath] error:&err]) {
- [self failWithError:err];
- }
- [self setTemporaryFileDownloadPath:nil];
- }
- return (!err);
-}
-
-- (BOOL)removeTemporaryUncompressedDownloadFile
-{
- NSError *err = nil;
- if ([self temporaryUncompressedDataDownloadPath]) {
- if (![[self class] removeFileAtPath:[self temporaryUncompressedDataDownloadPath] error:&err]) {
- [self failWithError:err];
- }
- [self setTemporaryUncompressedDataDownloadPath:nil];
- }
- return (!err);
-}
-
-- (BOOL)removeTemporaryUploadFile
-{
- NSError *err = nil;
- if ([self postBodyFilePath]) {
- if (![[self class] removeFileAtPath:[self postBodyFilePath] error:&err]) {
- [self failWithError:err];
- }
- [self setPostBodyFilePath:nil];
- }
- return (!err);
-}
-
-- (BOOL)removeTemporaryCompressedUploadFile
-{
- NSError *err = nil;
- if ([self compressedPostBodyFilePath]) {
- if (![[self class] removeFileAtPath:[self compressedPostBodyFilePath] error:&err]) {
- [self failWithError:err];
- }
- [self setCompressedPostBodyFilePath:nil];
- }
- return (!err);
-}
-
-+ (BOOL)removeFileAtPath:(NSString *)path error:(NSError **)err
-{
- NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
-
- if ([fileManager fileExistsAtPath:path]) {
- NSError *removeError = nil;
- [fileManager removeItemAtPath:path error:&removeError];
- if (removeError) {
- if (err) {
- *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASIFileManagementError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Failed to delete file at path '%@'",path],NSLocalizedDescriptionKey,removeError,NSUnderlyingErrorKey,nil]];
- }
- return NO;
- }
- }
- return YES;
-}
-
-#pragma mark Proxies
-
-- (BOOL)configureProxies
-{
- // Have details of the proxy been set on this request
- if (![self isPACFileRequest] && (![self proxyHost] && ![self proxyPort])) {
-
- // If not, we need to figure out what they'll be
- NSArray *proxies = nil;
-
- // Have we been given a proxy auto config file?
- if ([self PACurl]) {
-
- // If yes, we'll need to fetch the PAC file asynchronously, so we stop this request to wait until we have the proxy details.
- [self fetchPACFile];
- return NO;
-
- // Detect proxy settings and apply them
- } else {
-
-#if TARGET_OS_IPHONE
- NSDictionary *proxySettings = [NSMakeCollectable(CFNetworkCopySystemProxySettings()) autorelease];
-#else
- NSDictionary *proxySettings = [NSMakeCollectable(SCDynamicStoreCopyProxies(NULL)) autorelease];
-#endif
-
- proxies = [NSMakeCollectable(CFNetworkCopyProxiesForURL((CFURLRef)[self url], (CFDictionaryRef)proxySettings)) autorelease];
-
- // Now check to see if the proxy settings contained a PAC url, we need to run the script to get the real list of proxies if so
- NSDictionary *settings = [proxies objectAtIndex:0];
- if ([settings objectForKey:(NSString *)kCFProxyAutoConfigurationURLKey]) {
- [self setPACurl:[settings objectForKey:(NSString *)kCFProxyAutoConfigurationURLKey]];
- [self fetchPACFile];
- return NO;
- }
- }
-
- if (!proxies) {
- [self setReadStream:nil];
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileBuildingRequestType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to obtain information on proxy servers needed for request",NSLocalizedDescriptionKey,nil]]];
- return NO;
- }
- // I don't really understand why the dictionary returned by CFNetworkCopyProxiesForURL uses different key names from CFNetworkCopySystemProxySettings/SCDynamicStoreCopyProxies
- // and why its key names are documented while those we actually need to use don't seem to be (passing the kCF* keys doesn't seem to work)
- if ([proxies count] > 0) {
- NSDictionary *settings = [proxies objectAtIndex:0];
- [self setProxyHost:[settings objectForKey:(NSString *)kCFProxyHostNameKey]];
- [self setProxyPort:[[settings objectForKey:(NSString *)kCFProxyPortNumberKey] intValue]];
- [self setProxyType:[settings objectForKey:(NSString *)kCFProxyTypeKey]];
- }
- }
- return YES;
-}
-
-
-
-// Attempts to download a PAC (Proxy Auto-Configuration) file
-// PAC files at file://, http:// and https:// addresses are supported
-- (void)fetchPACFile
-{
- // For file:// urls, we'll use an async NSInputStream (ASIHTTPRequest does not support file:// urls)
- if ([[self PACurl] isFileURL]) {
- NSInputStream *stream = [[[NSInputStream alloc] initWithFileAtPath:[[self PACurl] path]] autorelease];
- [self setPACFileReadStream:stream];
- [stream setDelegate:(id)self];
- [stream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:[self runLoopMode]];
- [stream open];
- // If it takes more than timeOutSeconds to read the PAC, we'll just give up and assume no proxies
- // We won't bother to handle cases where the first part of the PAC is read within timeOutSeconds, but the whole thing takes longer
- // Either our PAC file is in easy reach, or it's going to slow things down to the point that it's probably better requests fail
- [self performSelector:@selector(timeOutPACRead) withObject:nil afterDelay:[self timeOutSeconds]];
- return;
- }
-
- NSString *scheme = [[[self PACurl] scheme] lowercaseString];
- if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"]) {
- // Don't know how to read data from this URL, we'll have to give up
- // We'll simply assume no proxies, and start the request as normal
- [self startRequest];
- return;
- }
-
- // Create an ASIHTTPRequest to fetch the PAC file
- ASIHTTPRequest *PACRequest = [ASIHTTPRequest requestWithURL:[self PACurl]];
-
- // Will prevent this request attempting to configure proxy settings for itself
- [PACRequest setIsPACFileRequest:YES];
-
- [PACRequest setTimeOutSeconds:[self timeOutSeconds]];
-
- // If we're a synchronous request, we'll download the PAC file synchronously
- if ([self isSynchronous]) {
- [PACRequest startSynchronous];
- if (![PACRequest error] && [PACRequest responseString]) {
- [self runPACScript:[PACRequest responseString]];
- }
- [self startRequest];
- return;
- }
-
- [self setPACFileRequest:PACRequest];
-
- // Force this request to run before others in the shared queue
- [PACRequest setQueuePriority:NSOperationQueuePriorityHigh];
-
- // We'll treat failure to download the PAC file the same as success - if we were unable to fetch a PAC file, we proceed as if we have no proxy server and let this request fail itself if necessary
- [PACRequest setDelegate:self];
- [PACRequest setDidFinishSelector:@selector(finishedDownloadingPACFile:)];
- [PACRequest setDidFailSelector:@selector(finishedDownloadingPACFile:)];
- [PACRequest startAsynchronous];
-
- // Temporarily increase the number of operations in the shared queue to give our request a chance to run
- [connectionsLock lock];
- [sharedQueue setMaxConcurrentOperationCount:[sharedQueue maxConcurrentOperationCount]+1];
- [connectionsLock unlock];
-}
-
-// Called as we read the PAC file from a file:// url
-- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode
-{
- if (![self PACFileReadStream]) {
- return;
- }
- if (eventCode == NSStreamEventHasBytesAvailable) {
-
- if (![self PACFileData]) {
- [self setPACFileData:[NSMutableData data]];
- }
- // If your PAC file is larger than 16KB, you're just being cruel.
- uint8_t buf[16384];
- NSInteger len = [(NSInputStream *)stream read:buf maxLength:16384];
- if (len) {
- [[self PACFileData] appendBytes:(const void *)buf length:len];
- }
-
- } else if (eventCode == NSStreamEventErrorOccurred || eventCode == NSStreamEventEndEncountered) {
-
- [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(timeOutPACRead) object:nil];
-
- [stream close];
- [stream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:[self runLoopMode]];
- [self setPACFileReadStream:nil];
-
- if (eventCode == NSStreamEventEndEncountered) {
- // It sounds as though we have no idea what encoding a PAC file will use
- static NSStringEncoding encodingsToTry[2] = {NSUTF8StringEncoding,NSISOLatin1StringEncoding};
- NSUInteger i;
- for (i=0; i<2; i++) {
- NSString *pacScript = [[[NSString alloc] initWithBytes:[[self PACFileData] bytes] length:[[self PACFileData] length] encoding:encodingsToTry[i]] autorelease];
- if (pacScript) {
- [self runPACScript:pacScript];
- break;
- }
- }
- }
- [self setPACFileData:nil];
- [self startRequest];
- }
-}
-
-// Called if it takes longer than timeOutSeconds to read the whole PAC file (when reading from a file:// url)
-- (void)timeOutPACRead
-{
- [self stream:[self PACFileReadStream] handleEvent:NSStreamEventErrorOccurred];
-}
-
-// Runs the downloaded PAC script
-- (void)runPACScript:(NSString *)script
-{
- if (script) {
- // From: http://developer.apple.com/samplecode/CFProxySupportTool/listing1.html
- // Work around . This dummy call to
- // CFNetworkCopyProxiesForURL initialise some state within CFNetwork
- // that is required by CFNetworkCopyProxiesForAutoConfigurationScript.
- CFRelease(CFNetworkCopyProxiesForURL((CFURLRef)[self url], NULL));
-
- // Obtain the list of proxies by running the autoconfiguration script
- CFErrorRef err = NULL;
- NSArray *proxies = [NSMakeCollectable(CFNetworkCopyProxiesForAutoConfigurationScript((CFStringRef)script,(CFURLRef)[self url], &err)) autorelease];
- if (!err && [proxies count] > 0) {
- NSDictionary *settings = [proxies objectAtIndex:0];
- [self setProxyHost:[settings objectForKey:(NSString *)kCFProxyHostNameKey]];
- [self setProxyPort:[[settings objectForKey:(NSString *)kCFProxyPortNumberKey] intValue]];
- [self setProxyType:[settings objectForKey:(NSString *)kCFProxyTypeKey]];
- }
- }
-}
-
-// Called if we successfully downloaded a PAC file from a webserver
-- (void)finishedDownloadingPACFile:(ASIHTTPRequest *)theRequest
-{
- if (![theRequest error] && [theRequest responseString]) {
- [self runPACScript:[theRequest responseString]];
- }
-
- // Set the shared queue's maxConcurrentOperationCount back to normal
- [connectionsLock lock];
- [sharedQueue setMaxConcurrentOperationCount:[sharedQueue maxConcurrentOperationCount]-1];
- [connectionsLock unlock];
-
- // We no longer need our PAC file request
- [self setPACFileRequest:nil];
-
- // Start the request
- [self startRequest];
-}
-
-
-#pragma mark persistent connections
-
-- (NSNumber *)connectionID
-{
- return [[self connectionInfo] objectForKey:@"id"];
-}
-
-+ (void)expirePersistentConnections
-{
- [connectionsLock lock];
- NSUInteger i;
- for (i=0; i<[persistentConnectionsPool count]; i++) {
- NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i];
- if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"expires"] timeIntervalSinceNow] <= 0) {
-#if DEBUG_PERSISTENT_CONNECTIONS
- ASI_DEBUG_LOG(@"[CONNECTION] Closing connection #%i because it has expired",[[existingConnection objectForKey:@"id"] intValue]);
-#endif
- NSInputStream *stream = [existingConnection objectForKey:@"stream"];
- if (stream) {
- [stream close];
- }
- [persistentConnectionsPool removeObject:existingConnection];
- i--;
- }
- }
- [connectionsLock unlock];
-}
-
-#pragma mark NSCopying
-- (id)copyWithZone:(NSZone *)zone
-{
- // Don't forget - this will return a retained copy!
- ASIHTTPRequest *newRequest = [[[self class] alloc] initWithURL:[self url]];
- [newRequest setDelegate:[self delegate]];
- [newRequest setRequestMethod:[self requestMethod]];
- [newRequest setPostBody:[self postBody]];
- [newRequest setShouldStreamPostDataFromDisk:[self shouldStreamPostDataFromDisk]];
- [newRequest setPostBodyFilePath:[self postBodyFilePath]];
- [newRequest setRequestHeaders:[[[self requestHeaders] mutableCopyWithZone:zone] autorelease]];
- [newRequest setRequestCookies:[[[self requestCookies] mutableCopyWithZone:zone] autorelease]];
- [newRequest setUseCookiePersistence:[self useCookiePersistence]];
- [newRequest setUseKeychainPersistence:[self useKeychainPersistence]];
- [newRequest setUseSessionPersistence:[self useSessionPersistence]];
- [newRequest setAllowCompressedResponse:[self allowCompressedResponse]];
- [newRequest setDownloadDestinationPath:[self downloadDestinationPath]];
- [newRequest setTemporaryFileDownloadPath:[self temporaryFileDownloadPath]];
- [newRequest setUsername:[self username]];
- [newRequest setPassword:[self password]];
- [newRequest setDomain:[self domain]];
- [newRequest setProxyUsername:[self proxyUsername]];
- [newRequest setProxyPassword:[self proxyPassword]];
- [newRequest setProxyDomain:[self proxyDomain]];
- [newRequest setProxyHost:[self proxyHost]];
- [newRequest setProxyPort:[self proxyPort]];
- [newRequest setProxyType:[self proxyType]];
- [newRequest setUploadProgressDelegate:[self uploadProgressDelegate]];
- [newRequest setDownloadProgressDelegate:[self downloadProgressDelegate]];
- [newRequest setShouldPresentAuthenticationDialog:[self shouldPresentAuthenticationDialog]];
- [newRequest setShouldPresentProxyAuthenticationDialog:[self shouldPresentProxyAuthenticationDialog]];
- [newRequest setPostLength:[self postLength]];
- [newRequest setHaveBuiltPostBody:[self haveBuiltPostBody]];
- [newRequest setDidStartSelector:[self didStartSelector]];
- [newRequest setDidFinishSelector:[self didFinishSelector]];
- [newRequest setDidFailSelector:[self didFailSelector]];
- [newRequest setTimeOutSeconds:[self timeOutSeconds]];
- [newRequest setShouldResetDownloadProgress:[self shouldResetDownloadProgress]];
- [newRequest setShouldResetUploadProgress:[self shouldResetUploadProgress]];
- [newRequest setShowAccurateProgress:[self showAccurateProgress]];
- [newRequest setDefaultResponseEncoding:[self defaultResponseEncoding]];
- [newRequest setAllowResumeForFileDownloads:[self allowResumeForFileDownloads]];
- [newRequest setUserInfo:[[[self userInfo] copyWithZone:zone] autorelease]];
- [newRequest setTag:[self tag]];
- [newRequest setUseHTTPVersionOne:[self useHTTPVersionOne]];
- [newRequest setShouldRedirect:[self shouldRedirect]];
- [newRequest setValidatesSecureCertificate:[self validatesSecureCertificate]];
- [newRequest setClientCertificateIdentity:clientCertificateIdentity];
- [newRequest setClientCertificates:[[clientCertificates copy] autorelease]];
- [newRequest setPACurl:[self PACurl]];
- [newRequest setShouldPresentCredentialsBeforeChallenge:[self shouldPresentCredentialsBeforeChallenge]];
- [newRequest setNumberOfTimesToRetryOnTimeout:[self numberOfTimesToRetryOnTimeout]];
- [newRequest setShouldUseRFC2616RedirectBehaviour:[self shouldUseRFC2616RedirectBehaviour]];
- [newRequest setShouldAttemptPersistentConnection:[self shouldAttemptPersistentConnection]];
- [newRequest setPersistentConnectionTimeoutSeconds:[self persistentConnectionTimeoutSeconds]];
- [newRequest setAuthenticationScheme:[self authenticationScheme]];
- return newRequest;
-}
-
-#pragma mark default time out
-
-+ (NSTimeInterval)defaultTimeOutSeconds
-{
- return defaultTimeOutSeconds;
-}
-
-+ (void)setDefaultTimeOutSeconds:(NSTimeInterval)newTimeOutSeconds
-{
- defaultTimeOutSeconds = newTimeOutSeconds;
-}
-
-
-#pragma mark client certificate
-
-- (void)setClientCertificateIdentity:(SecIdentityRef)anIdentity {
- if(clientCertificateIdentity) {
- CFRelease(clientCertificateIdentity);
- }
-
- clientCertificateIdentity = anIdentity;
-
- if (clientCertificateIdentity) {
- CFRetain(clientCertificateIdentity);
- }
-}
-
-
-#pragma mark session credentials
-
-+ (NSMutableArray *)sessionProxyCredentialsStore
-{
- [sessionCredentialsLock lock];
- if (!sessionProxyCredentialsStore) {
- sessionProxyCredentialsStore = [[NSMutableArray alloc] init];
- }
- [sessionCredentialsLock unlock];
- return sessionProxyCredentialsStore;
-}
-
-+ (NSMutableArray *)sessionCredentialsStore
-{
- [sessionCredentialsLock lock];
- if (!sessionCredentialsStore) {
- sessionCredentialsStore = [[NSMutableArray alloc] init];
- }
- [sessionCredentialsLock unlock];
- return sessionCredentialsStore;
-}
-
-+ (void)storeProxyAuthenticationCredentialsInSessionStore:(NSDictionary *)credentials
-{
- [sessionCredentialsLock lock];
- [self removeProxyAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
- [[[self class] sessionProxyCredentialsStore] addObject:credentials];
- [sessionCredentialsLock unlock];
-}
-
-+ (void)storeAuthenticationCredentialsInSessionStore:(NSDictionary *)credentials
-{
- [sessionCredentialsLock lock];
- [self removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]];
- [[[self class] sessionCredentialsStore] addObject:credentials];
- [sessionCredentialsLock unlock];
-}
-
-+ (void)removeProxyAuthenticationCredentialsFromSessionStore:(NSDictionary *)credentials
-{
- [sessionCredentialsLock lock];
- NSMutableArray *sessionCredentialsList = [[self class] sessionProxyCredentialsStore];
- NSUInteger i;
- for (i=0; i<[sessionCredentialsList count]; i++) {
- NSDictionary *theCredentials = [sessionCredentialsList objectAtIndex:i];
- if ([theCredentials objectForKey:@"Credentials"] == credentials) {
- [sessionCredentialsList removeObjectAtIndex:i];
- [sessionCredentialsLock unlock];
- return;
- }
- }
- [sessionCredentialsLock unlock];
-}
-
-+ (void)removeAuthenticationCredentialsFromSessionStore:(NSDictionary *)credentials
-{
- [sessionCredentialsLock lock];
- NSMutableArray *sessionCredentialsList = [[self class] sessionCredentialsStore];
- NSUInteger i;
- for (i=0; i<[sessionCredentialsList count]; i++) {
- NSDictionary *theCredentials = [sessionCredentialsList objectAtIndex:i];
- if ([theCredentials objectForKey:@"Credentials"] == credentials) {
- [sessionCredentialsList removeObjectAtIndex:i];
- [sessionCredentialsLock unlock];
- return;
- }
- }
- [sessionCredentialsLock unlock];
-}
-
-- (NSDictionary *)findSessionProxyAuthenticationCredentials
-{
- [sessionCredentialsLock lock];
- NSMutableArray *sessionCredentialsList = [[self class] sessionProxyCredentialsStore];
- for (NSDictionary *theCredentials in sessionCredentialsList) {
- if ([[theCredentials objectForKey:@"Host"] isEqualToString:[self proxyHost]] && [[theCredentials objectForKey:@"Port"] intValue] == [self proxyPort]) {
- [sessionCredentialsLock unlock];
- return theCredentials;
- }
- }
- [sessionCredentialsLock unlock];
- return nil;
-}
-
-
-- (NSDictionary *)findSessionAuthenticationCredentials
-{
- [sessionCredentialsLock lock];
- NSMutableArray *sessionCredentialsList = [[self class] sessionCredentialsStore];
- NSURL *requestURL = [self url];
-
- BOOL haveFoundExactMatch;
- NSDictionary *closeMatch = nil;
-
- // Loop through all the cached credentials we have, looking for the best match for this request
- for (NSDictionary *theCredentials in sessionCredentialsList) {
-
- haveFoundExactMatch = NO;
- NSURL *cachedCredentialsURL = [theCredentials objectForKey:@"URL"];
-
- // Find an exact match (same url)
- if ([cachedCredentialsURL isEqual:[self url]]) {
- haveFoundExactMatch = YES;
-
- // This is not an exact match for the url, and we already have a close match we can use
- } else if (closeMatch) {
- continue;
-
- // Find a close match (same host, scheme and port)
- } else if ([[cachedCredentialsURL host] isEqualToString:[requestURL host]] && ([cachedCredentialsURL port] == [requestURL port] || ([requestURL port] && [[cachedCredentialsURL port] isEqualToNumber:[requestURL port]])) && [[cachedCredentialsURL scheme] isEqualToString:[requestURL scheme]]) {
- } else {
- continue;
- }
-
- // Just a sanity check to ensure we never choose credentials from a different realm. Can't really do more than that, as either this request or the stored credentials may not have a realm when the other does
- if ([self authenticationRealm] && ([theCredentials objectForKey:@"AuthenticationRealm"] && ![[theCredentials objectForKey:@"AuthenticationRealm"] isEqualToString:[self authenticationRealm]])) {
- continue;
- }
-
- // If we have a username and password set on the request, check that they are the same as the cached ones
- if ([self username] && [self password]) {
- NSDictionary *usernameAndPassword = [theCredentials objectForKey:@"Credentials"];
- NSString *storedUsername = [usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername];
- NSString *storedPassword = [usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword];
- if (![storedUsername isEqualToString:[self username]] || ![storedPassword isEqualToString:[self password]]) {
- continue;
- }
- }
-
- // If we have an exact match for the url, use those credentials
- if (haveFoundExactMatch) {
- [sessionCredentialsLock unlock];
- return theCredentials;
- }
-
- // We have no exact match, let's remember that we have a good match for this server, and we'll use it at the end if we don't find an exact match
- closeMatch = theCredentials;
- }
- [sessionCredentialsLock unlock];
-
- // Return credentials that matched on host, port and scheme, or nil if we didn't find any
- return closeMatch;
-}
-
-#pragma mark keychain storage
-
-+ (void)saveCredentials:(NSURLCredential *)credentials forHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm
-{
- NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:NSURLAuthenticationMethodDefault] autorelease];
- [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credentials forProtectionSpace:protectionSpace];
-}
-
-+ (void)saveCredentials:(NSURLCredential *)credentials forProxy:(NSString *)host port:(int)port realm:(NSString *)realm
-{
- NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithProxyHost:host port:port type:NSURLProtectionSpaceHTTPProxy realm:realm authenticationMethod:NSURLAuthenticationMethodDefault] autorelease];
- [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credentials forProtectionSpace:protectionSpace];
-}
-
-+ (NSURLCredential *)savedCredentialsForHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm
-{
- NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:NSURLAuthenticationMethodDefault] autorelease];
- return [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace];
-}
-
-+ (NSURLCredential *)savedCredentialsForProxy:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm
-{
- NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithProxyHost:host port:port type:NSURLProtectionSpaceHTTPProxy realm:realm authenticationMethod:NSURLAuthenticationMethodDefault] autorelease];
- return [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace];
-}
-
-+ (void)removeCredentialsForHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm
-{
- NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:NSURLAuthenticationMethodDefault] autorelease];
- NSURLCredential *credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace];
- if (credential) {
- [[NSURLCredentialStorage sharedCredentialStorage] removeCredential:credential forProtectionSpace:protectionSpace];
- }
-}
-
-+ (void)removeCredentialsForProxy:(NSString *)host port:(int)port realm:(NSString *)realm
-{
- NSURLProtectionSpace *protectionSpace = [[[NSURLProtectionSpace alloc] initWithProxyHost:host port:port type:NSURLProtectionSpaceHTTPProxy realm:realm authenticationMethod:NSURLAuthenticationMethodDefault] autorelease];
- NSURLCredential *credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace];
- if (credential) {
- [[NSURLCredentialStorage sharedCredentialStorage] removeCredential:credential forProtectionSpace:protectionSpace];
- }
-}
-
-+ (NSMutableArray *)sessionCookies
-{
- [sessionCookiesLock lock];
- if (!sessionCookies) {
- [ASIHTTPRequest setSessionCookies:[NSMutableArray array]];
- }
- NSMutableArray *cookies = [[sessionCookies retain] autorelease];
- [sessionCookiesLock unlock];
- return cookies;
-}
-
-+ (void)setSessionCookies:(NSMutableArray *)newSessionCookies
-{
- [sessionCookiesLock lock];
- // Remove existing cookies from the persistent store
- for (NSHTTPCookie *cookie in sessionCookies) {
- [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
- }
- [sessionCookies release];
- sessionCookies = [newSessionCookies retain];
- [sessionCookiesLock unlock];
-}
-
-+ (void)addSessionCookie:(NSHTTPCookie *)newCookie
-{
- [sessionCookiesLock lock];
- NSHTTPCookie *cookie;
- NSUInteger i;
- NSUInteger max = [[ASIHTTPRequest sessionCookies] count];
- for (i=0; i 0) {
- if ([self readStreamIsScheduled]) {
- [self unscheduleReadStream];
- #if DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[THROTTLING] Sleeping request %@ until after %@",self,throttleWakeUpTime);
- #endif
- }
- } else {
- if (![self readStreamIsScheduled]) {
- [self scheduleReadStream];
- #if DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[THROTTLING] Waking up request %@",self);
- #endif
- }
- }
- }
- [bandwidthThrottlingLock unlock];
-
- // Bandwidth throttling must have been turned off since we last looked, let's re-schedule the stream
- } else if (![self readStreamIsScheduled]) {
- [self scheduleReadStream];
- }
-}
-
-+ (BOOL)isBandwidthThrottled
-{
-#if TARGET_OS_IPHONE
- [bandwidthThrottlingLock lock];
-
- BOOL throttle = isBandwidthThrottled || (!shouldThrottleBandwidthForWWANOnly && (maxBandwidthPerSecond > 0));
- [bandwidthThrottlingLock unlock];
- return throttle;
-#else
- [bandwidthThrottlingLock lock];
- BOOL throttle = (maxBandwidthPerSecond > 0);
- [bandwidthThrottlingLock unlock];
- return throttle;
-#endif
-}
-
-+ (unsigned long)maxBandwidthPerSecond
-{
- [bandwidthThrottlingLock lock];
- unsigned long amount = maxBandwidthPerSecond;
- [bandwidthThrottlingLock unlock];
- return amount;
-}
-
-+ (void)setMaxBandwidthPerSecond:(unsigned long)bytes
-{
- [bandwidthThrottlingLock lock];
- maxBandwidthPerSecond = bytes;
- [bandwidthThrottlingLock unlock];
-}
-
-+ (void)incrementBandwidthUsedInLastSecond:(unsigned long)bytes
-{
- [bandwidthThrottlingLock lock];
- bandwidthUsedInLastSecond += bytes;
- [bandwidthThrottlingLock unlock];
-}
-
-+ (void)recordBandwidthUsage
-{
- if (bandwidthUsedInLastSecond == 0) {
- [bandwidthUsageTracker removeAllObjects];
- } else {
- NSTimeInterval interval = [bandwidthMeasurementDate timeIntervalSinceNow];
- while ((interval < 0 || [bandwidthUsageTracker count] > 5) && [bandwidthUsageTracker count] > 0) {
- [bandwidthUsageTracker removeObjectAtIndex:0];
- interval++;
- }
- }
- #if DEBUG_THROTTLING
- ASI_DEBUG_LOG(@"[THROTTLING] ===Used: %u bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond);
- #endif
- [bandwidthUsageTracker addObject:[NSNumber numberWithUnsignedLong:bandwidthUsedInLastSecond]];
- [bandwidthMeasurementDate release];
- bandwidthMeasurementDate = [[NSDate dateWithTimeIntervalSinceNow:1] retain];
- bandwidthUsedInLastSecond = 0;
-
- NSUInteger measurements = [bandwidthUsageTracker count];
- unsigned long totalBytes = 0;
- for (NSNumber *bytes in bandwidthUsageTracker) {
- totalBytes += [bytes unsignedLongValue];
- }
- if (measurements > 0)
- averageBandwidthUsedPerSecond = totalBytes/measurements;
-}
-
-+ (unsigned long)averageBandwidthUsedPerSecond
-{
- [bandwidthThrottlingLock lock];
- unsigned long amount = averageBandwidthUsedPerSecond;
- [bandwidthThrottlingLock unlock];
- return amount;
-}
-
-+ (void)measureBandwidthUsage
-{
- // Other requests may have to wait for this lock if we're sleeping, but this is fine, since in that case we already know they shouldn't be sending or receiving data
- [bandwidthThrottlingLock lock];
-
- if (!bandwidthMeasurementDate || [bandwidthMeasurementDate timeIntervalSinceNow] < -0) {
- [ASIHTTPRequest recordBandwidthUsage];
- }
-
- // Are we performing bandwidth throttling?
- if (
- #if TARGET_OS_IPHONE
- isBandwidthThrottled || (!shouldThrottleBandwidthForWWANOnly && (maxBandwidthPerSecond))
- #else
- maxBandwidthPerSecond
- #endif
- ) {
- // How much data can we still send or receive this second?
- long long bytesRemaining = (long long)maxBandwidthPerSecond - (long long)bandwidthUsedInLastSecond;
-
- // Have we used up our allowance?
- if (bytesRemaining < 0) {
-
- // Yes, put this request to sleep until a second is up, with extra added punishment sleeping time for being very naughty (we have used more bandwidth than we were allowed)
- double extraSleepyTime = (-bytesRemaining/(maxBandwidthPerSecond*1.0));
- [throttleWakeUpTime release];
- throttleWakeUpTime = [[NSDate alloc] initWithTimeInterval:extraSleepyTime sinceDate:bandwidthMeasurementDate];
- }
- }
- [bandwidthThrottlingLock unlock];
-}
-
-+ (unsigned long)maxUploadReadLength
-{
- [bandwidthThrottlingLock lock];
-
- // We'll split our bandwidth allowance into 4 (which is the default for an ASINetworkQueue's max concurrent operations count) to give all running requests a fighting chance of reading data this cycle
- long long toRead = maxBandwidthPerSecond/4;
- if (maxBandwidthPerSecond > 0 && (bandwidthUsedInLastSecond + toRead > maxBandwidthPerSecond)) {
- toRead = (long long)maxBandwidthPerSecond-(long long)bandwidthUsedInLastSecond;
- if (toRead < 0) {
- toRead = 0;
- }
- }
-
- if (toRead == 0 || !bandwidthMeasurementDate || [bandwidthMeasurementDate timeIntervalSinceNow] < -0) {
- [throttleWakeUpTime release];
- throttleWakeUpTime = [bandwidthMeasurementDate retain];
- }
- [bandwidthThrottlingLock unlock];
- return (unsigned long)toRead;
-}
-
-
-#if TARGET_OS_IPHONE
-+ (void)setShouldThrottleBandwidthForWWAN:(BOOL)throttle
-{
- if (throttle) {
- [ASIHTTPRequest throttleBandwidthForWWANUsingLimit:ASIWWANBandwidthThrottleAmount];
- } else {
- [ASIHTTPRequest unsubscribeFromNetworkReachabilityNotifications];
- [ASIHTTPRequest setMaxBandwidthPerSecond:0];
- [bandwidthThrottlingLock lock];
- isBandwidthThrottled = NO;
- shouldThrottleBandwidthForWWANOnly = NO;
- [bandwidthThrottlingLock unlock];
- }
-}
-
-+ (void)throttleBandwidthForWWANUsingLimit:(unsigned long)limit
-{
- [bandwidthThrottlingLock lock];
- shouldThrottleBandwidthForWWANOnly = YES;
- maxBandwidthPerSecond = limit;
- [ASIHTTPRequest registerForNetworkReachabilityNotifications];
- [bandwidthThrottlingLock unlock];
- [ASIHTTPRequest reachabilityChanged:nil];
-}
-
-#pragma mark reachability
-
-+ (void)registerForNetworkReachabilityNotifications
-{
- [[Reachability reachabilityForInternetConnection] startNotifier];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
-}
-
-
-+ (void)unsubscribeFromNetworkReachabilityNotifications
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
-}
-
-+ (BOOL)isNetworkReachableViaWWAN
-{
- return ([[Reachability reachabilityForInternetConnection] currentReachabilityStatus] == ReachableViaWWAN);
-}
-
-+ (void)reachabilityChanged:(NSNotification *)note
-{
- [bandwidthThrottlingLock lock];
- isBandwidthThrottled = [ASIHTTPRequest isNetworkReachableViaWWAN];
- [bandwidthThrottlingLock unlock];
-}
-#endif
-
-#pragma mark queue
-
-// Returns the shared queue
-+ (NSOperationQueue *)sharedQueue
-{
- return [[sharedQueue retain] autorelease];
-}
-
-#pragma mark cache
-
-+ (void)setDefaultCache:(id )cache
-{
- @synchronized (self) {
- [cache retain];
- [defaultCache release];
- defaultCache = cache;
- }
-}
-
-+ (id )defaultCache
-{
- @synchronized(self) {
- return [[defaultCache retain] autorelease];
- }
- return nil;
-}
-
-
-#pragma mark network activity
-
-+ (BOOL)isNetworkInUse
-{
- [connectionsLock lock];
- BOOL inUse = (runningRequestCount > 0);
- [connectionsLock unlock];
- return inUse;
-}
-
-+ (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate
-{
- [connectionsLock lock];
- shouldUpdateNetworkActivityIndicator = shouldUpdate;
- [connectionsLock unlock];
-}
-
-+ (void)showNetworkActivityIndicator
-{
-#if TARGET_OS_IPHONE
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
-#endif
-}
-
-+ (void)hideNetworkActivityIndicator
-{
-#if TARGET_OS_IPHONE
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
-#endif
-}
-
-
-/* Always called on main thread */
-+ (void)hideNetworkActivityIndicatorAfterDelay
-{
- [self performSelector:@selector(hideNetworkActivityIndicatorIfNeeeded) withObject:nil afterDelay:0.5];
-}
-
-+ (void)hideNetworkActivityIndicatorIfNeeeded
-{
- [connectionsLock lock];
- if (runningRequestCount == 0) {
- [self hideNetworkActivityIndicator];
- }
- [connectionsLock unlock];
-}
-
-
-#pragma mark threading behaviour
-
-// In the default implementation, all requests run in a single background thread
-// Advanced users only: Override this method in a subclass for a different threading behaviour
-// Eg: return [NSThread mainThread] to run all requests in the main thread
-// Alternatively, you can create a thread on demand, or manage a pool of threads
-// Threads returned by this method will need to run the runloop in default mode (eg CFRunLoopRun())
-// Requests will stop the runloop when they complete
-// If you have multiple requests sharing the thread or you want to re-use the thread, you'll need to restart the runloop
-+ (NSThread *)threadForRequest:(ASIHTTPRequest *)request
-{
- if (networkThread == nil) {
- @synchronized(self) {
- if (networkThread == nil) {
- networkThread = [[NSThread alloc] initWithTarget:self selector:@selector(runRequests) object:nil];
- [networkThread start];
- }
- }
- }
- return networkThread;
-}
-
-+ (void)runRequests
-{
- // Should keep the runloop from exiting
- CFRunLoopSourceContext context = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
- CFRunLoopSourceRef source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
- CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
-
- BOOL runAlways = YES; // Introduced to cheat Static Analyzer
- while (runAlways) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e10, true);
- [pool drain];
- }
-
- // Should never be called, but anyway
- CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
- CFRelease(source);
-}
-
-#pragma mark miscellany
-
-#if TARGET_OS_IPHONE
-+ (BOOL)isMultitaskingSupported
-{
- BOOL multiTaskingSupported = NO;
- if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) {
- multiTaskingSupported = [(id)[UIDevice currentDevice] isMultitaskingSupported];
- }
- return multiTaskingSupported;
-}
-#endif
-
-// From: http://www.cocoadev.com/index.pl?BaseSixtyFour
-
-+ (NSString*)base64forData:(NSData*)theData {
-
- const uint8_t* input = (const uint8_t*)[theData bytes];
- NSInteger length = [theData length];
-
- static char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
-
- NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
- uint8_t* output = (uint8_t*)data.mutableBytes;
-
- NSInteger i,i2;
- for (i=0; i < length; i += 3) {
- NSInteger value = 0;
- for (i2=0; i2<3; i2++) {
- value <<= 8;
- if (i+i2 < length) {
- value |= (0xFF & input[i+i2]);
- }
- }
-
- NSInteger theIndex = (i / 3) * 4;
- output[theIndex + 0] = table[(value >> 18) & 0x3F];
- output[theIndex + 1] = table[(value >> 12) & 0x3F];
- output[theIndex + 2] = (i + 1) < length ? table[(value >> 6) & 0x3F] : '=';
- output[theIndex + 3] = (i + 2) < length ? table[(value >> 0) & 0x3F] : '=';
- }
-
- return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
-}
-
-+ (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge
-{
- NSDictionary *responseHeaders = [request responseHeaders];
-
- // If we weren't given a custom max-age, lets look for one in the response headers
- if (!maxAge) {
- NSString *cacheControl = [[responseHeaders objectForKey:@"Cache-Control"] lowercaseString];
- if (cacheControl) {
- NSScanner *scanner = [NSScanner scannerWithString:cacheControl];
- [scanner scanUpToString:@"max-age" intoString:NULL];
- if ([scanner scanString:@"max-age" intoString:NULL]) {
- [scanner scanString:@"=" intoString:NULL];
- [scanner scanDouble:&maxAge];
- }
- }
- }
-
- // RFC 2612 says max-age must override any Expires header
- if (maxAge) {
- NSDate *date = [NSDate date];
- if ([date respondsToSelector:@selector(dateByAddingTimeInterval:)]) {
- return [date dateByAddingTimeInterval:maxAge];
- } else {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- return [date addTimeInterval:maxAge];
-#pragma clang diagnostic pop
- }
- } else {
- NSString *expires = [responseHeaders objectForKey:@"Expires"];
- if (expires) {
- return [ASIHTTPRequest dateFromRFC1123String:expires];
- }
- }
- return nil;
-}
-
-// Based on hints from http://stackoverflow.com/questions/1850824/parsing-a-rfc-822-date-with-nsdateformatter
-+ (NSDate *)dateFromRFC1123String:(NSString *)string
-{
- NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
- [formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]];
- // Does the string include a week day?
- NSString *day = @"";
- if ([string rangeOfString:@","].location != NSNotFound) {
- day = @"EEE, ";
- }
- // Does the string include seconds?
- NSString *seconds = @"";
- if ([[string componentsSeparatedByString:@":"] count] == 3) {
- seconds = @":ss";
- }
- [formatter setDateFormat:[NSString stringWithFormat:@"%@dd MMM yyyy HH:mm%@ z",day,seconds]];
- return [formatter dateFromString:string];
-}
-
-+ (void)parseMimeType:(NSString **)mimeType andResponseEncoding:(NSStringEncoding *)stringEncoding fromContentType:(NSString *)contentType
-{
- if (!contentType) {
- return;
- }
- NSScanner *charsetScanner = [NSScanner scannerWithString: contentType];
- if (![charsetScanner scanUpToString:@";" intoString:mimeType] || [charsetScanner scanLocation] == [contentType length]) {
- *mimeType = [contentType stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- return;
- }
- *mimeType = [*mimeType stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- NSString *charsetSeparator = @"charset=";
- NSString *IANAEncoding = nil;
-
- if ([charsetScanner scanUpToString: charsetSeparator intoString: NULL] && [charsetScanner scanLocation] < [contentType length]) {
- [charsetScanner setScanLocation: [charsetScanner scanLocation] + [charsetSeparator length]];
- [charsetScanner scanUpToString: @";" intoString: &IANAEncoding];
- }
-
- if (IANAEncoding) {
- CFStringEncoding cfEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)IANAEncoding);
- if (cfEncoding != kCFStringEncodingInvalidId) {
- *stringEncoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding);
- }
- }
-}
-
-#pragma mark -
-#pragma mark blocks
-#if NS_BLOCKS_AVAILABLE
-- (void)setStartedBlock:(ASIBasicBlock)aStartedBlock
-{
- [startedBlock release];
- startedBlock = [aStartedBlock copy];
-}
-
-- (void)setHeadersReceivedBlock:(ASIHeadersBlock)aReceivedBlock
-{
- [headersReceivedBlock release];
- headersReceivedBlock = [aReceivedBlock copy];
-}
-
-- (void)setCompletionBlock:(ASIBasicBlock)aCompletionBlock
-{
- [completionBlock release];
- completionBlock = [aCompletionBlock copy];
-}
-
-- (void)setFailedBlock:(ASIBasicBlock)aFailedBlock
-{
- [failureBlock release];
- failureBlock = [aFailedBlock copy];
-}
-
-- (void)setBytesReceivedBlock:(ASIProgressBlock)aBytesReceivedBlock
-{
- [bytesReceivedBlock release];
- bytesReceivedBlock = [aBytesReceivedBlock copy];
-}
-
-- (void)setBytesSentBlock:(ASIProgressBlock)aBytesSentBlock
-{
- [bytesSentBlock release];
- bytesSentBlock = [aBytesSentBlock copy];
-}
-
-- (void)setDownloadSizeIncrementedBlock:(ASISizeBlock)aDownloadSizeIncrementedBlock{
- [downloadSizeIncrementedBlock release];
- downloadSizeIncrementedBlock = [aDownloadSizeIncrementedBlock copy];
-}
-
-- (void)setUploadSizeIncrementedBlock:(ASISizeBlock)anUploadSizeIncrementedBlock
-{
- [uploadSizeIncrementedBlock release];
- uploadSizeIncrementedBlock = [anUploadSizeIncrementedBlock copy];
-}
-
-- (void)setDataReceivedBlock:(ASIDataBlock)aReceivedBlock
-{
- [dataReceivedBlock release];
- dataReceivedBlock = [aReceivedBlock copy];
-}
-
-- (void)setAuthenticationNeededBlock:(ASIBasicBlock)anAuthenticationBlock
-{
- [authenticationNeededBlock release];
- authenticationNeededBlock = [anAuthenticationBlock copy];
-}
-- (void)setProxyAuthenticationNeededBlock:(ASIBasicBlock)aProxyAuthenticationBlock
-{
- [proxyAuthenticationNeededBlock release];
- proxyAuthenticationNeededBlock = [aProxyAuthenticationBlock copy];
-}
-- (void)setRequestRedirectedBlock:(ASIBasicBlock)aRedirectBlock
-{
- [requestRedirectedBlock release];
- requestRedirectedBlock = [aRedirectBlock copy];
-}
-#endif
-
-#pragma mark ===
-
-@synthesize username;
-@synthesize password;
-@synthesize userAgentString;
-@synthesize domain;
-@synthesize proxyUsername;
-@synthesize proxyPassword;
-@synthesize proxyDomain;
-@synthesize url;
-@synthesize originalURL;
-@synthesize delegate;
-@synthesize queue;
-@synthesize uploadProgressDelegate;
-@synthesize downloadProgressDelegate;
-@synthesize useKeychainPersistence;
-@synthesize useSessionPersistence;
-@synthesize useCookiePersistence;
-@synthesize downloadDestinationPath;
-@synthesize temporaryFileDownloadPath;
-@synthesize temporaryUncompressedDataDownloadPath;
-@synthesize didStartSelector;
-@synthesize didReceiveResponseHeadersSelector;
-@synthesize willRedirectSelector;
-@synthesize didFinishSelector;
-@synthesize didFailSelector;
-@synthesize didReceiveDataSelector;
-@synthesize authenticationRealm;
-@synthesize proxyAuthenticationRealm;
-@synthesize error;
-@synthesize complete;
-@synthesize requestHeaders;
-@synthesize responseHeaders;
-@synthesize responseCookies;
-@synthesize requestCookies;
-@synthesize requestCredentials;
-@synthesize responseStatusCode;
-@synthesize rawResponseData;
-@synthesize lastActivityTime;
-@synthesize timeOutSeconds;
-@synthesize requestMethod;
-@synthesize postBody;
-@synthesize compressedPostBody;
-@synthesize contentLength;
-@synthesize partialDownloadSize;
-@synthesize postLength;
-@synthesize shouldResetDownloadProgress;
-@synthesize shouldResetUploadProgress;
-@synthesize mainRequest;
-@synthesize totalBytesRead;
-@synthesize totalBytesSent;
-@synthesize showAccurateProgress;
-@synthesize uploadBufferSize;
-@synthesize defaultResponseEncoding;
-@synthesize responseEncoding;
-@synthesize allowCompressedResponse;
-@synthesize allowResumeForFileDownloads;
-@synthesize userInfo;
-@synthesize tag;
-@synthesize postBodyFilePath;
-@synthesize compressedPostBodyFilePath;
-@synthesize postBodyWriteStream;
-@synthesize postBodyReadStream;
-@synthesize shouldStreamPostDataFromDisk;
-@synthesize didCreateTemporaryPostDataFile;
-@synthesize useHTTPVersionOne;
-@synthesize lastBytesRead;
-@synthesize lastBytesSent;
-@synthesize cancelledLock;
-@synthesize haveBuiltPostBody;
-@synthesize fileDownloadOutputStream;
-@synthesize inflatedFileDownloadOutputStream;
-@synthesize authenticationRetryCount;
-@synthesize proxyAuthenticationRetryCount;
-@synthesize updatedProgress;
-@synthesize shouldRedirect;
-@synthesize validatesSecureCertificate;
-@synthesize needsRedirect;
-@synthesize redirectCount;
-@synthesize shouldCompressRequestBody;
-@synthesize proxyCredentials;
-@synthesize proxyHost;
-@synthesize proxyPort;
-@synthesize proxyType;
-@synthesize PACurl;
-@synthesize authenticationScheme;
-@synthesize proxyAuthenticationScheme;
-@synthesize shouldPresentAuthenticationDialog;
-@synthesize shouldPresentProxyAuthenticationDialog;
-@synthesize authenticationNeeded;
-@synthesize responseStatusMessage;
-@synthesize shouldPresentCredentialsBeforeChallenge;
-@synthesize haveBuiltRequestHeaders;
-@synthesize inProgress;
-@synthesize numberOfTimesToRetryOnTimeout;
-@synthesize retryCount;
-@synthesize willRetryRequest;
-@synthesize shouldAttemptPersistentConnection;
-@synthesize persistentConnectionTimeoutSeconds;
-@synthesize connectionCanBeReused;
-@synthesize connectionInfo;
-@synthesize readStream;
-@synthesize readStreamIsScheduled;
-@synthesize shouldUseRFC2616RedirectBehaviour;
-@synthesize downloadComplete;
-@synthesize requestID;
-@synthesize runLoopMode;
-@synthesize statusTimer;
-@synthesize downloadCache;
-@synthesize cachePolicy;
-@synthesize cacheStoragePolicy;
-@synthesize didUseCachedResponse;
-@synthesize secondsToCache;
-@synthesize clientCertificates;
-@synthesize redirectURL;
-#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
-@synthesize shouldContinueWhenAppEntersBackground;
-#endif
-@synthesize dataDecompressor;
-@synthesize shouldWaitToInflateCompressedResponses;
-
-@synthesize isPACFileRequest;
-@synthesize PACFileRequest;
-@synthesize PACFileReadStream;
-@synthesize PACFileData;
-
-@synthesize isSynchronous;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequestConfig.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequestConfig.h
deleted file mode 100644
index 3f6c5870..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequestConfig.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// ASIHTTPRequestConfig.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 14/12/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-
-// ======
-// Debug output configuration options
-// ======
-
-// If defined will use the specified function for debug logging
-// Otherwise use NSLog
-#ifndef ASI_DEBUG_LOG
- #define ASI_DEBUG_LOG NSLog
-#endif
-
-// When set to 1 ASIHTTPRequests will print information about what a request is doing
-#ifndef DEBUG_REQUEST_STATUS
- #define DEBUG_REQUEST_STATUS 0
-#endif
-
-// When set to 1, ASIFormDataRequests will print information about the request body to the console
-#ifndef DEBUG_FORM_DATA_REQUEST
- #define DEBUG_FORM_DATA_REQUEST 0
-#endif
-
-// When set to 1, ASIHTTPRequests will print information about bandwidth throttling to the console
-#ifndef DEBUG_THROTTLING
- #define DEBUG_THROTTLING 0
-#endif
-
-// When set to 1, ASIHTTPRequests will print information about persistent connections to the console
-#ifndef DEBUG_PERSISTENT_CONNECTIONS
- #define DEBUG_PERSISTENT_CONNECTIONS 0
-#endif
-
-// When set to 1, ASIHTTPRequests will print information about HTTP authentication (Basic, Digest or NTLM) to the console
-#ifndef DEBUG_HTTP_AUTHENTICATION
- #define DEBUG_HTTP_AUTHENTICATION 0
-#endif
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequestDelegate.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequestDelegate.h
deleted file mode 100644
index c495a275..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIHTTPRequestDelegate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// ASIHTTPRequestDelegate.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 13/04/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-@class ASIHTTPRequest;
-
-@protocol ASIHTTPRequestDelegate
-
-@optional
-
-// These are the default delegate methods for request status
-// You can use different ones by setting didStartSelector / didFinishSelector / didFailSelector
-- (void)requestStarted:(ASIHTTPRequest *)request;
-- (void)request:(ASIHTTPRequest *)request didReceiveResponseHeaders:(NSDictionary *)responseHeaders;
-- (void)request:(ASIHTTPRequest *)request willRedirectToURL:(NSURL *)newURL;
-- (void)requestFinished:(ASIHTTPRequest *)request;
-- (void)requestFailed:(ASIHTTPRequest *)request;
-- (void)requestRedirected:(ASIHTTPRequest *)request;
-
-// When a delegate implements this method, it is expected to process all incoming data itself
-// This means that responseData / responseString / downloadDestinationPath etc are ignored
-// You can have the request call a different method by setting didReceiveDataSelector
-- (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data;
-
-// If a delegate implements one of these, it will be asked to supply credentials when none are available
-// The delegate can then either restart the request ([request retryUsingSuppliedCredentials]) once credentials have been set
-// or cancel it ([request cancelAuthentication])
-- (void)authenticationNeededForRequest:(ASIHTTPRequest *)request;
-- (void)proxyAuthenticationNeededForRequest:(ASIHTTPRequest *)request;
-
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIInputStream.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIInputStream.h
deleted file mode 100644
index 7b9f93ed..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIInputStream.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// ASIInputStream.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 10/08/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import
-
-@class ASIHTTPRequest;
-
-// This is a wrapper for NSInputStream that pretends to be an NSInputStream itself
-// Subclassing NSInputStream seems to be tricky, and may involve overriding undocumented methods, so we'll cheat instead.
-// It is used by ASIHTTPRequest whenever we have a request body, and handles measuring and throttling the bandwidth used for uploading
-
-@interface ASIInputStream : NSObject {
- NSInputStream *stream;
- ASIHTTPRequest *request;
-}
-+ (id)inputStreamWithFileAtPath:(NSString *)path request:(ASIHTTPRequest *)request;
-+ (id)inputStreamWithData:(NSData *)data request:(ASIHTTPRequest *)request;
-
-@property (retain, nonatomic) NSInputStream *stream;
-@property (assign, nonatomic) ASIHTTPRequest *request;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIInputStream.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIInputStream.m
deleted file mode 100644
index d2b84288..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIInputStream.m
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// ASIInputStream.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 10/08/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIInputStream.h"
-#import "ASIHTTPRequest.h"
-
-// Used to ensure only one request can read data at once
-static NSLock *readLock = nil;
-
-@implementation ASIInputStream
-
-+ (void)initialize
-{
- if (self == [ASIInputStream class]) {
- readLock = [[NSLock alloc] init];
- }
-}
-
-+ (id)inputStreamWithFileAtPath:(NSString *)path request:(ASIHTTPRequest *)theRequest
-{
- ASIInputStream *theStream = [[[self alloc] init] autorelease];
- [theStream setRequest:theRequest];
- [theStream setStream:[NSInputStream inputStreamWithFileAtPath:path]];
- return theStream;
-}
-
-+ (id)inputStreamWithData:(NSData *)data request:(ASIHTTPRequest *)theRequest
-{
- ASIInputStream *theStream = [[[self alloc] init] autorelease];
- [theStream setRequest:theRequest];
- [theStream setStream:[NSInputStream inputStreamWithData:data]];
- return theStream;
-}
-
-- (void)dealloc
-{
- [stream release];
- [super dealloc];
-}
-
-// Called when CFNetwork wants to read more of our request body
-// When throttling is on, we ask ASIHTTPRequest for the maximum amount of data we can read
-- (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len
-{
- [readLock lock];
- unsigned long toRead = len;
- if ([ASIHTTPRequest isBandwidthThrottled]) {
- toRead = [ASIHTTPRequest maxUploadReadLength];
- if (toRead > len) {
- toRead = len;
- } else if (toRead == 0) {
- toRead = 1;
- }
- [request performThrottling];
- }
- [readLock unlock];
- NSInteger rv = [stream read:buffer maxLength:toRead];
- if (rv > 0)
- [ASIHTTPRequest incrementBandwidthUsedInLastSecond:rv];
- return rv;
-}
-
-/*
- * Implement NSInputStream mandatory methods to make sure they are implemented
- * (necessary for MacRuby for example) and avoid the overhead of method
- * forwarding for these common methods.
- */
-- (void)open
-{
- [stream open];
-}
-
-- (void)close
-{
- [stream close];
-}
-
-- (id)delegate
-{
- return [stream delegate];
-}
-
-- (void)setDelegate:(id)delegate
-{
- [stream setDelegate:delegate];
-}
-
-- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode
-{
- [stream scheduleInRunLoop:aRunLoop forMode:mode];
-}
-
-- (void)removeFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode
-{
- [stream removeFromRunLoop:aRunLoop forMode:mode];
-}
-
-- (id)propertyForKey:(NSString *)key
-{
- return [stream propertyForKey:key];
-}
-
-- (BOOL)setProperty:(id)property forKey:(NSString *)key
-{
- return [stream setProperty:property forKey:key];
-}
-
-- (NSStreamStatus)streamStatus
-{
- return [stream streamStatus];
-}
-
-- (NSError *)streamError
-{
- return [stream streamError];
-}
-
-// If we get asked to perform a method we don't have (probably internal ones),
-// we'll just forward the message to our stream
-
-- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
-{
- return [stream methodSignatureForSelector:aSelector];
-}
-
-- (void)forwardInvocation:(NSInvocation *)anInvocation
-{
- [anInvocation invokeWithTarget:stream];
-}
-
-@synthesize stream;
-@synthesize request;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASINetworkQueue.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASINetworkQueue.h
deleted file mode 100644
index 787f391e..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASINetworkQueue.h
+++ /dev/null
@@ -1,108 +0,0 @@
-//
-// ASINetworkQueue.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 07/11/2008.
-// Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import
-#import "ASIHTTPRequestDelegate.h"
-#import "ASIProgressDelegate.h"
-
-@interface ASINetworkQueue : NSOperationQueue {
-
- // Delegate will get didFail + didFinish messages (if set)
- id delegate;
-
- // Will be called when a request starts with the request as the argument
- SEL requestDidStartSelector;
-
- // Will be called when a request receives response headers
- // Should take the form request:didRecieveResponseHeaders:, where the first argument is the request, and the second the headers dictionary
- SEL requestDidReceiveResponseHeadersSelector;
-
- // Will be called when a request is about to redirect
- // Should take the form request:willRedirectToURL:, where the first argument is the request, and the second the new url
- SEL requestWillRedirectSelector;
-
- // Will be called when a request completes with the request as the argument
- SEL requestDidFinishSelector;
-
- // Will be called when a request fails with the request as the argument
- SEL requestDidFailSelector;
-
- // Will be called when the queue finishes with the queue as the argument
- SEL queueDidFinishSelector;
-
- // Upload progress indicator, probably an NSProgressIndicator or UIProgressView
- id uploadProgressDelegate;
-
- // Total amount uploaded so far for all requests in this queue
- unsigned long long bytesUploadedSoFar;
-
- // Total amount to be uploaded for all requests in this queue - requests add to this figure as they work out how much data they have to transmit
- unsigned long long totalBytesToUpload;
-
- // Download progress indicator, probably an NSProgressIndicator or UIProgressView
- id downloadProgressDelegate;
-
- // Total amount downloaded so far for all requests in this queue
- unsigned long long bytesDownloadedSoFar;
-
- // Total amount to be downloaded for all requests in this queue - requests add to this figure as they receive Content-Length headers
- unsigned long long totalBytesToDownload;
-
- // When YES, the queue will cancel all requests when a request fails. Default is YES
- BOOL shouldCancelAllRequestsOnFailure;
-
- //Number of real requests (excludes HEAD requests created to manage showAccurateProgress)
- int requestsCount;
-
- // When NO, this request will only update the progress indicator when it completes
- // When YES, this request will update the progress indicator according to how much data it has received so far
- // When YES, the queue will first perform HEAD requests for all GET requests in the queue, so it can calculate the total download size before it starts
- // NO means better performance, because it skips this step for GET requests, and it won't waste time updating the progress indicator until a request completes
- // Set to YES if the size of a requests in the queue varies greatly for much more accurate results
- // Default for requests in the queue is NO
- BOOL showAccurateProgress;
-
- // Storage container for additional queue information.
- NSDictionary *userInfo;
-
-}
-
-// Convenience constructor
-+ (id)queue;
-
-// Call this to reset a queue - it will cancel all operations, clear delegates, and suspend operation
-- (void)reset;
-
-// Used internally to manage HEAD requests when showAccurateProgress is YES, do not use!
-- (void)addHEADOperation:(NSOperation *)operation;
-
-// All ASINetworkQueues are paused when created so that total size can be calculated before the queue starts
-// This method will start the queue
-- (void)go;
-
-@property (assign, nonatomic, setter=setUploadProgressDelegate:) id uploadProgressDelegate;
-@property (assign, nonatomic, setter=setDownloadProgressDelegate:) id downloadProgressDelegate;
-
-@property (assign) SEL requestDidStartSelector;
-@property (assign) SEL requestDidReceiveResponseHeadersSelector;
-@property (assign) SEL requestWillRedirectSelector;
-@property (assign) SEL requestDidFinishSelector;
-@property (assign) SEL requestDidFailSelector;
-@property (assign) SEL queueDidFinishSelector;
-@property (assign) BOOL shouldCancelAllRequestsOnFailure;
-@property (assign) id delegate;
-@property (assign) BOOL showAccurateProgress;
-@property (assign, readonly) int requestsCount;
-@property (retain) NSDictionary *userInfo;
-
-@property (assign) unsigned long long bytesUploadedSoFar;
-@property (assign) unsigned long long totalBytesToUpload;
-@property (assign) unsigned long long bytesDownloadedSoFar;
-@property (assign) unsigned long long totalBytesToDownload;
-
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASINetworkQueue.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASINetworkQueue.m
deleted file mode 100644
index b24076db..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASINetworkQueue.m
+++ /dev/null
@@ -1,343 +0,0 @@
-//
-// ASINetworkQueue.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 07/11/2008.
-// Copyright 2008-2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASINetworkQueue.h"
-#import "ASIHTTPRequest.h"
-
-// Private stuff
-@interface ASINetworkQueue ()
- - (void)resetProgressDelegate:(id *)progressDelegate;
- @property (assign) int requestsCount;
-@end
-
-@implementation ASINetworkQueue
-
-- (id)init
-{
- self = [super init];
- [self setShouldCancelAllRequestsOnFailure:YES];
- [self setMaxConcurrentOperationCount:4];
- [self setSuspended:YES];
-
- return self;
-}
-
-+ (id)queue
-{
- return [[[self alloc] init] autorelease];
-}
-
-- (void)dealloc
-{
- //We need to clear the queue on any requests that haven't got around to cleaning up yet, as otherwise they'll try to let us know if something goes wrong, and we'll be long gone by then
- for (ASIHTTPRequest *request in [self operations]) {
- [request setQueue:nil];
- }
- [userInfo release];
- [super dealloc];
-}
-
-- (void)setSuspended:(BOOL)suspend
-{
- [super setSuspended:suspend];
-}
-
-- (void)reset
-{
- [self cancelAllOperations];
- [self setDelegate:nil];
- [self setDownloadProgressDelegate:nil];
- [self setUploadProgressDelegate:nil];
- [self setRequestDidStartSelector:NULL];
- [self setRequestDidReceiveResponseHeadersSelector:NULL];
- [self setRequestDidFailSelector:NULL];
- [self setRequestDidFinishSelector:NULL];
- [self setQueueDidFinishSelector:NULL];
- [self setSuspended:YES];
-}
-
-
-- (void)go
-{
- [self setSuspended:NO];
-}
-
-- (void)cancelAllOperations
-{
- [self setBytesUploadedSoFar:0];
- [self setTotalBytesToUpload:0];
- [self setBytesDownloadedSoFar:0];
- [self setTotalBytesToDownload:0];
- [super cancelAllOperations];
-}
-
-- (void)setUploadProgressDelegate:(id)newDelegate
-{
- uploadProgressDelegate = newDelegate;
- [self resetProgressDelegate:&uploadProgressDelegate];
-
-}
-
-- (void)setDownloadProgressDelegate:(id)newDelegate
-{
- downloadProgressDelegate = newDelegate;
- [self resetProgressDelegate:&downloadProgressDelegate];
-}
-
-- (void)resetProgressDelegate:(id *)progressDelegate
-{
-#if !TARGET_OS_IPHONE
- // If the uploadProgressDelegate is an NSProgressIndicator, we set its MaxValue to 1.0 so we can treat it similarly to UIProgressViews
- SEL selector = @selector(setMaxValue:);
- if ([*progressDelegate respondsToSelector:selector]) {
- double max = 1.0;
- [ASIHTTPRequest performSelector:selector onTarget:progressDelegate withObject:nil amount:&max callerToRetain:nil];
- }
- selector = @selector(setDoubleValue:);
- if ([*progressDelegate respondsToSelector:selector]) {
- double value = 0.0;
- [ASIHTTPRequest performSelector:selector onTarget:progressDelegate withObject:nil amount:&value callerToRetain:nil];
- }
-#else
- SEL selector = @selector(setProgress:);
- if ([*progressDelegate respondsToSelector:selector]) {
- float value = 0.0f;
- [ASIHTTPRequest performSelector:selector onTarget:progressDelegate withObject:nil amount:&value callerToRetain:nil];
- }
-#endif
-}
-
-- (void)addHEADOperation:(NSOperation *)operation
-{
- if ([operation isKindOfClass:[ASIHTTPRequest class]]) {
-
- ASIHTTPRequest *request = (ASIHTTPRequest *)operation;
- [request setRequestMethod:@"HEAD"];
- [request setQueuePriority:10];
- [request setShowAccurateProgress:YES];
- [request setQueue:self];
-
- // Important - we are calling NSOperation's add method - we don't want to add this as a normal request!
- [super addOperation:request];
- }
-}
-
-// Only add ASIHTTPRequests to this queue!!
-- (void)addOperation:(NSOperation *)operation
-{
- if (![operation isKindOfClass:[ASIHTTPRequest class]]) {
- [NSException raise:@"AttemptToAddInvalidRequest" format:@"Attempted to add an object that was not an ASIHTTPRequest to an ASINetworkQueue"];
- }
-
- [self setRequestsCount:[self requestsCount]+1];
-
- ASIHTTPRequest *request = (ASIHTTPRequest *)operation;
-
- if ([self showAccurateProgress]) {
-
- // Force the request to build its body (this may change requestMethod)
- [request buildPostBody];
-
- // If this is a GET request and we want accurate progress, perform a HEAD request first to get the content-length
- // We'll only do this before the queue is started
- // If requests are added after the queue is started they will probably move the overall progress backwards anyway, so there's no value performing the HEAD requests first
- // Instead, they'll update the total progress if and when they receive a content-length header
- if ([[request requestMethod] isEqualToString:@"GET"]) {
- if ([self isSuspended]) {
- ASIHTTPRequest *HEADRequest = [request HEADRequest];
- [self addHEADOperation:HEADRequest];
- [request addDependency:HEADRequest];
- if ([request shouldResetDownloadProgress]) {
- [self resetProgressDelegate:&downloadProgressDelegate];
- [request setShouldResetDownloadProgress:NO];
- }
- }
- }
- [request buildPostBody];
- [self request:nil incrementUploadSizeBy:[request postLength]];
-
-
- } else {
- [self request:nil incrementDownloadSizeBy:1];
- [self request:nil incrementUploadSizeBy:1];
- }
- // Tell the request not to increment the upload size when it starts, as we've already added its length
- if ([request shouldResetUploadProgress]) {
- [self resetProgressDelegate:&uploadProgressDelegate];
- [request setShouldResetUploadProgress:NO];
- }
-
- [request setShowAccurateProgress:[self showAccurateProgress]];
-
- [request setQueue:self];
- [super addOperation:request];
-
-}
-
-- (void)requestStarted:(ASIHTTPRequest *)request
-{
- if ([self requestDidStartSelector]) {
- [[self delegate] performSelector:[self requestDidStartSelector] withObject:request];
- }
-}
-
-- (void)request:(ASIHTTPRequest *)request didReceiveResponseHeaders:(NSDictionary *)responseHeaders
-{
- if ([self requestDidReceiveResponseHeadersSelector]) {
- [[self delegate] performSelector:[self requestDidReceiveResponseHeadersSelector] withObject:request withObject:responseHeaders];
- }
-}
-
-- (void)request:(ASIHTTPRequest *)request willRedirectToURL:(NSURL *)newURL
-{
- if ([self requestWillRedirectSelector]) {
- [[self delegate] performSelector:[self requestWillRedirectSelector] withObject:request withObject:newURL];
- }
-}
-
-- (void)requestFinished:(ASIHTTPRequest *)request
-{
- [self setRequestsCount:[self requestsCount]-1];
- if ([self requestDidFinishSelector]) {
- [[self delegate] performSelector:[self requestDidFinishSelector] withObject:request];
- }
- if ([self requestsCount] == 0) {
- if ([self queueDidFinishSelector]) {
- [[self delegate] performSelector:[self queueDidFinishSelector] withObject:self];
- }
- }
-}
-
-- (void)requestFailed:(ASIHTTPRequest *)request
-{
- [self setRequestsCount:[self requestsCount]-1];
- if ([self requestDidFailSelector]) {
- [[self delegate] performSelector:[self requestDidFailSelector] withObject:request];
- }
- if ([self requestsCount] == 0) {
- if ([self queueDidFinishSelector]) {
- [[self delegate] performSelector:[self queueDidFinishSelector] withObject:self];
- }
- }
- if ([self shouldCancelAllRequestsOnFailure] && [self requestsCount] > 0) {
- [self cancelAllOperations];
- }
-
-}
-
-
-- (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes
-{
- [self setBytesDownloadedSoFar:[self bytesDownloadedSoFar]+bytes];
- if ([self downloadProgressDelegate]) {
- [ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:[self bytesDownloadedSoFar] ofTotal:[self totalBytesToDownload]];
- }
-}
-
-- (void)request:(ASIHTTPRequest *)request didSendBytes:(long long)bytes
-{
- [self setBytesUploadedSoFar:[self bytesUploadedSoFar]+bytes];
- if ([self uploadProgressDelegate]) {
- [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:[self bytesUploadedSoFar] ofTotal:[self totalBytesToUpload]];
- }
-}
-
-- (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength
-{
- [self setTotalBytesToDownload:[self totalBytesToDownload]+newLength];
-}
-
-- (void)request:(ASIHTTPRequest *)request incrementUploadSizeBy:(long long)newLength
-{
- [self setTotalBytesToUpload:[self totalBytesToUpload]+newLength];
-}
-
-
-// Since this queue takes over as the delegate for all requests it contains, it should forward authorisation requests to its own delegate
-- (void)authenticationNeededForRequest:(ASIHTTPRequest *)request
-{
- if ([[self delegate] respondsToSelector:@selector(authenticationNeededForRequest:)]) {
- [[self delegate] performSelector:@selector(authenticationNeededForRequest:) withObject:request];
- }
-}
-
-- (void)proxyAuthenticationNeededForRequest:(ASIHTTPRequest *)request
-{
- if ([[self delegate] respondsToSelector:@selector(proxyAuthenticationNeededForRequest:)]) {
- [[self delegate] performSelector:@selector(proxyAuthenticationNeededForRequest:) withObject:request];
- }
-}
-
-
-- (BOOL)respondsToSelector:(SEL)selector
-{
- // We handle certain methods differently because whether our delegate implements them or not can affect how the request should behave
-
- // If the delegate implements this, the request will stop to wait for credentials
- if (selector == @selector(authenticationNeededForRequest:)) {
- if ([[self delegate] respondsToSelector:@selector(authenticationNeededForRequest:)]) {
- return YES;
- }
- return NO;
-
- // If the delegate implements this, the request will to wait for credentials
- } else if (selector == @selector(proxyAuthenticationNeededForRequest:)) {
- if ([[self delegate] respondsToSelector:@selector(proxyAuthenticationNeededForRequest:)]) {
- return YES;
- }
- return NO;
-
- // If the delegate implements requestWillRedirectSelector, the request will stop to allow the delegate to change the url
- } else if (selector == @selector(request:willRedirectToURL:)) {
- if ([self requestWillRedirectSelector] && [[self delegate] respondsToSelector:[self requestWillRedirectSelector]]) {
- return YES;
- }
- return NO;
- }
- return [super respondsToSelector:selector];
-}
-
-#pragma mark NSCopying
-
-- (id)copyWithZone:(NSZone *)zone
-{
- ASINetworkQueue *newQueue = [[[self class] alloc] init];
- [newQueue setDelegate:[self delegate]];
- [newQueue setRequestDidStartSelector:[self requestDidStartSelector]];
- [newQueue setRequestWillRedirectSelector:[self requestWillRedirectSelector]];
- [newQueue setRequestDidReceiveResponseHeadersSelector:[self requestDidReceiveResponseHeadersSelector]];
- [newQueue setRequestDidFinishSelector:[self requestDidFinishSelector]];
- [newQueue setRequestDidFailSelector:[self requestDidFailSelector]];
- [newQueue setQueueDidFinishSelector:[self queueDidFinishSelector]];
- [newQueue setUploadProgressDelegate:[self uploadProgressDelegate]];
- [newQueue setDownloadProgressDelegate:[self downloadProgressDelegate]];
- [newQueue setShouldCancelAllRequestsOnFailure:[self shouldCancelAllRequestsOnFailure]];
- [newQueue setShowAccurateProgress:[self showAccurateProgress]];
- [newQueue setUserInfo:[[[self userInfo] copyWithZone:zone] autorelease]];
- return newQueue;
-}
-
-
-@synthesize requestsCount;
-@synthesize bytesUploadedSoFar;
-@synthesize totalBytesToUpload;
-@synthesize bytesDownloadedSoFar;
-@synthesize totalBytesToDownload;
-@synthesize shouldCancelAllRequestsOnFailure;
-@synthesize uploadProgressDelegate;
-@synthesize downloadProgressDelegate;
-@synthesize requestDidStartSelector;
-@synthesize requestDidReceiveResponseHeadersSelector;
-@synthesize requestWillRedirectSelector;
-@synthesize requestDidFinishSelector;
-@synthesize requestDidFailSelector;
-@synthesize queueDidFinishSelector;
-@synthesize delegate;
-@synthesize showAccurateProgress;
-@synthesize userInfo;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIProgressDelegate.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIProgressDelegate.h
deleted file mode 100644
index e2bb0cf4..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIProgressDelegate.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// ASIProgressDelegate.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 13/04/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-@class ASIHTTPRequest;
-
-@protocol ASIProgressDelegate
-
-@optional
-
-// These methods are used to update UIProgressViews (iPhone OS) or NSProgressIndicators (Mac OS X)
-// If you are using a custom progress delegate, you may find it easier to implement didReceiveBytes / didSendBytes instead
-#if TARGET_OS_IPHONE
-- (void)setProgress:(float)newProgress;
-#else
-- (void)setDoubleValue:(double)newProgress;
-- (void)setMaxValue:(double)newMax;
-#endif
-
-// Called when the request receives some data - bytes is the length of that data
-- (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes;
-
-// Called when the request sends some data
-// The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
-// bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
-- (void)request:(ASIHTTPRequest *)request didSendBytes:(long long)bytes;
-
-// Called when a request needs to change the length of the content to download
-- (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength;
-
-// Called when a request needs to change the length of the content to upload
-// newLength may be less than zero when a request needs to remove the size of the internal buffer from progress tracking
-- (void)request:(ASIHTTPRequest *)request incrementUploadSizeBy:(long long)newLength;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIWebPageRequest/ASIWebPageRequest.h b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIWebPageRequest/ASIWebPageRequest.h
deleted file mode 100644
index b82f4408..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIWebPageRequest/ASIWebPageRequest.h
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// ASIWebPageRequest.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 29/06/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-// This is an EXPERIMENTAL class - use at your own risk!
-// It is strongly recommend to set a downloadDestinationPath when using ASIWebPageRequest
-// Also, performance will be better if your ASIWebPageRequest has a downloadCache setup
-// Known issue: You cannot use startSychronous with an ASIWebPageRequest
-
-#import "ASIHTTPRequest.h"
-
-@class ASINetworkQueue;
-
-// Used internally for storing what type of data we got from the server
-typedef enum _ASIWebContentType {
- ASINotParsedWebContentType = 0,
- ASIHTMLWebContentType = 1,
- ASICSSWebContentType = 2
-} ASIWebContentType;
-
-// These correspond with the urlReplacementMode property of ASIWebPageRequest
-typedef enum _ASIURLReplacementMode {
-
- // Don't modify html or css content at all
- ASIDontModifyURLs = 0,
-
- // Replace external resources urls (images, stylesheets etc) with data uris, so their content is embdedded directly in the html/css
- ASIReplaceExternalResourcesWithData = 1,
-
- // Replace external resource urls with the url of locally cached content
- // You must set the baseURL of a WebView / UIWebView to a file url pointing at the downloadDestinationPath of the main ASIWebPageRequest if you want to display your content
- // See the Mac or iPhone example projects for a demonstration of how to do this
- // The hrefs of all hyperlinks are changed to use absolute urls when using this mode
- ASIReplaceExternalResourcesWithLocalURLs = 2
-} ASIURLReplacementMode;
-
-
-
-@interface ASIWebPageRequest : ASIHTTPRequest {
-
- // Each ASIWebPageRequest for an HTML or CSS file creates its own internal queue to download external resources
- ASINetworkQueue *externalResourceQueue;
-
- // This dictionary stores a list of external resources to download, along with their content-type data or a path to the data
- NSMutableDictionary *resourceList;
-
- // Used internally for parsing HTML (with libxml)
- struct _xmlDoc *doc;
-
- // If the response is an HTML or CSS file, this will be set so the content can be correctly parsed when it has finished fetching external resources
- ASIWebContentType webContentType;
-
- // Stores a reference to the ASIWebPageRequest that created this request
- // Note that a parentRequest can also have a parent request because ASIWebPageRequests parse their contents to look for external resources recursively
- // For example, a request for an image can be created by a request for a stylesheet which was created by a request for a web page
- ASIWebPageRequest *parentRequest;
-
- // Controls what ASIWebPageRequest does with external resources. See the notes above for more.
- ASIURLReplacementMode urlReplacementMode;
-
- // When set to NO, loading will stop when an external resource fails to load. Defaults to YES
- BOOL shouldIgnoreExternalResourceErrors;
-}
-
-// Will return a data URI that contains a base64 version of the content at this url
-// This is used when replacing urls in the html and css with actual data
-// If you subclass ASIWebPageRequest, you can override this function to return different content or a url pointing at another location
-- (NSString *)contentForExternalURL:(NSString *)theURL;
-
-// Returns the location that a downloaded external resource's content will be stored in
-- (NSString *)cachePathForRequest:(ASIWebPageRequest *)theRequest;
-
-
-@property (retain, nonatomic) ASIWebPageRequest *parentRequest;
-@property (assign, nonatomic) ASIURLReplacementMode urlReplacementMode;
-@property (assign, nonatomic) BOOL shouldIgnoreExternalResourceErrors;
-@end
diff --git a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIWebPageRequest/ASIWebPageRequest.m b/iOSProject/Pods/ASIHTTPRequest/Classes/ASIWebPageRequest/ASIWebPageRequest.m
deleted file mode 100644
index eccac6a8..00000000
--- a/iOSProject/Pods/ASIHTTPRequest/Classes/ASIWebPageRequest/ASIWebPageRequest.m
+++ /dev/null
@@ -1,722 +0,0 @@
-//
-// ASIWebPageRequest.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 29/06/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-// This is an EXPERIMENTAL class - use at your own risk!
-
-#import "ASIWebPageRequest.h"
-#import "ASINetworkQueue.h"
-#import
-#import
-#import
-#import
-#import
-
-// An xPath query that controls the external resources ASIWebPageRequest will fetch
-// By default, it will fetch stylesheets, javascript files, images, frames, iframes, and html 5 video / audio
-static xmlChar *xpathExpr = (xmlChar *)"//link/@href|//a/@href|//script/@src|//img/@src|//frame/@src|//iframe/@src|//style|//*/@style|//source/@src|//video/@poster|//audio/@src";
-
-static NSLock *xmlParsingLock = nil;
-static NSMutableArray *requestsUsingXMLParser = nil;
-
-@interface ASIWebPageRequest ()
-- (void)readResourceURLs;
-- (void)updateResourceURLs;
-- (void)parseAsHTML;
-- (void)parseAsCSS;
-- (void)addURLToFetch:(NSString *)newURL;
-+ (NSArray *)CSSURLsFromString:(NSString *)string;
-- (NSString *)relativePathTo:(NSString *)destinationPath fromPath:(NSString *)sourcePath;
-
-- (void)finishedFetchingExternalResources:(ASINetworkQueue *)queue;
-- (void)externalResourceFetchSucceeded:(ASIHTTPRequest *)externalResourceRequest;
-- (void)externalResourceFetchFailed:(ASIHTTPRequest *)externalResourceRequest;
-
-@property (retain, nonatomic) ASINetworkQueue *externalResourceQueue;
-@property (retain, nonatomic) NSMutableDictionary *resourceList;
-@end
-
-@implementation ASIWebPageRequest
-
-+ (void)initialize
-{
- if (self == [ASIWebPageRequest class]) {
- xmlParsingLock = [[NSLock alloc] init];
- requestsUsingXMLParser = [[NSMutableArray alloc] init];
- }
-}
-
-- (id)initWithURL:(NSURL *)newURL
-{
- self = [super initWithURL:newURL];
- [self setShouldIgnoreExternalResourceErrors:YES];
- return self;
-}
-
-- (void)dealloc
-{
- [externalResourceQueue cancelAllOperations];
- [externalResourceQueue release];
- [resourceList release];
- [parentRequest release];
- [super dealloc];
-}
-
-// This is a bit of a hack
-// The role of this method in normal ASIHTTPRequests is to tell the queue we are done with the request, and perform some cleanup
-// We override it to stop that happening, and instead do that work in the bottom of finishedFetchingExternalResources:
-- (void)markAsFinished
-{
- if ([self error]) {
- [super markAsFinished];
- }
-}
-
-// This method is normally responsible for telling delegates we are done, but it happens to be the most convenient place to parse the responses
-// Again, we call the super implementation in finishedFetchingExternalResources:, or here if this download was not an HTML or CSS file
-- (void)requestFinished
-{
- complete = NO;
- if ([self mainRequest] || [self didUseCachedResponse]) {
- [super requestFinished];
- [super markAsFinished];
- return;
- }
- webContentType = ASINotParsedWebContentType;
- NSString *contentType = [[[self responseHeaders] objectForKey:@"Content-Type"] lowercaseString];
- contentType = [[contentType componentsSeparatedByString:@";"] objectAtIndex:0];
- if ([contentType isEqualToString:@"text/html"] || [contentType isEqualToString:@"text/xhtml"] || [contentType isEqualToString:@"text/xhtml+xml"] || [contentType isEqualToString:@"application/xhtml+xml"]) {
- [self parseAsHTML];
- return;
- } else if ([contentType isEqualToString:@"text/css"]) {
- [self parseAsCSS];
- return;
- }
- [super requestFinished];
- [super markAsFinished];
-}
-
-- (void)parseAsCSS
-{
- webContentType = ASICSSWebContentType;
-
- NSString *responseCSS = nil;
- NSError *err = nil;
- if ([self downloadDestinationPath]) {
- responseCSS = [NSString stringWithContentsOfFile:[self downloadDestinationPath] encoding:[self responseEncoding] error:&err];
- } else {
- responseCSS = [self responseString];
- }
- if (err) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:100 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to read HTML string from response",NSLocalizedDescriptionKey,err,NSUnderlyingErrorKey,nil]]];
- return;
- } else if (!responseCSS) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:100 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Unable to read HTML string from response",NSLocalizedDescriptionKey,nil]]];
- return;
- }
- NSArray *urls = [[self class] CSSURLsFromString:responseCSS];
-
- [self setResourceList:[NSMutableDictionary dictionary]];
-
- for (NSString *theURL in urls) {
- [self addURLToFetch:theURL];
- }
- if (![[self resourceList] count]) {
- [super requestFinished];
- [super markAsFinished];
- return;
- }
-
- // Create a new request for every item in the queue
- [[self externalResourceQueue] cancelAllOperations];
- [self setExternalResourceQueue:[ASINetworkQueue queue]];
- [[self externalResourceQueue] setDelegate:self];
- [[self externalResourceQueue] setShouldCancelAllRequestsOnFailure:[self shouldIgnoreExternalResourceErrors]];
- [[self externalResourceQueue] setShowAccurateProgress:[self showAccurateProgress]];
- [[self externalResourceQueue] setQueueDidFinishSelector:@selector(finishedFetchingExternalResources:)];
- [[self externalResourceQueue] setRequestDidFinishSelector:@selector(externalResourceFetchSucceeded:)];
- [[self externalResourceQueue] setRequestDidFailSelector:@selector(externalResourceFetchFailed:)];
- for (NSString *theURL in [[self resourceList] keyEnumerator]) {
- ASIWebPageRequest *externalResourceRequest = [ASIWebPageRequest requestWithURL:[NSURL URLWithString:theURL relativeToURL:[self url]]];
- [externalResourceRequest setRequestHeaders:[self requestHeaders]];
- [externalResourceRequest setDownloadCache:[self downloadCache]];
- [externalResourceRequest setCachePolicy:[self cachePolicy]];
- [externalResourceRequest setCacheStoragePolicy:[self cacheStoragePolicy]];
- [externalResourceRequest setUserInfo:[NSDictionary dictionaryWithObject:theURL forKey:@"Path"]];
- [externalResourceRequest setParentRequest:self];
- [externalResourceRequest setUrlReplacementMode:[self urlReplacementMode]];
- [externalResourceRequest setShouldResetDownloadProgress:NO];
- [externalResourceRequest setDelegate:self];
- [externalResourceRequest setUploadProgressDelegate:self];
- [externalResourceRequest setDownloadProgressDelegate:self];
- if ([self downloadDestinationPath]) {
- [externalResourceRequest setDownloadDestinationPath:[self cachePathForRequest:externalResourceRequest]];
- }
- [[self externalResourceQueue] addOperation:externalResourceRequest];
- }
- [[self externalResourceQueue] go];
-}
-
-- (const char *)encodingName
-{
- xmlCharEncoding encoding = XML_CHAR_ENCODING_NONE;
- switch ([self responseEncoding])
- {
- case NSASCIIStringEncoding:
- encoding = XML_CHAR_ENCODING_ASCII;
- break;
- case NSJapaneseEUCStringEncoding:
- encoding = XML_CHAR_ENCODING_EUC_JP;
- break;
- case NSUTF8StringEncoding:
- encoding = XML_CHAR_ENCODING_UTF8;
- break;
- case NSISOLatin1StringEncoding:
- encoding = XML_CHAR_ENCODING_8859_1;
- break;
- case NSShiftJISStringEncoding:
- encoding = XML_CHAR_ENCODING_SHIFT_JIS;
- break;
- case NSISOLatin2StringEncoding:
- encoding = XML_CHAR_ENCODING_8859_2;
- break;
- case NSISO2022JPStringEncoding:
- encoding = XML_CHAR_ENCODING_2022_JP;
- break;
- case NSUTF16BigEndianStringEncoding:
- encoding = XML_CHAR_ENCODING_UTF16BE;
- break;
- case NSUTF16LittleEndianStringEncoding:
- encoding = XML_CHAR_ENCODING_UTF16LE;
- break;
- case NSUTF32BigEndianStringEncoding:
- encoding = XML_CHAR_ENCODING_UCS4BE;
- break;
- case NSUTF32LittleEndianStringEncoding:
- encoding = XML_CHAR_ENCODING_UCS4LE;
- break;
- case NSNEXTSTEPStringEncoding:
- case NSSymbolStringEncoding:
- case NSNonLossyASCIIStringEncoding:
- case NSUnicodeStringEncoding:
- case NSMacOSRomanStringEncoding:
- case NSUTF32StringEncoding:
- default:
- encoding = XML_CHAR_ENCODING_ERROR;
- break;
- }
- return xmlGetCharEncodingName(encoding);
-}
-
-- (void)parseAsHTML
-{
- webContentType = ASIHTMLWebContentType;
-
- // Only allow parsing of a single document at a time
- [xmlParsingLock lock];
-
- if (![requestsUsingXMLParser count]) {
- xmlInitParser();
- }
- [requestsUsingXMLParser addObject:self];
-
-
- /* Load XML document */
- if ([self downloadDestinationPath]) {
- doc = htmlReadFile([[self downloadDestinationPath] cStringUsingEncoding:NSUTF8StringEncoding], [self encodingName], HTML_PARSE_NONET | HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR);
- } else {
- NSData *data = [self responseData];
- doc = htmlReadMemory([data bytes], (int)[data length], "", [self encodingName], HTML_PARSE_NONET | HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR);
- }
- if (doc == NULL) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:101 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Error: unable to parse reponse XML",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
- [self setResourceList:[NSMutableDictionary dictionary]];
-
- // Populate the list of URLS to download
- [self readResourceURLs];
-
- if ([self error] || ![[self resourceList] count]) {
- [requestsUsingXMLParser removeObject:self];
- xmlFreeDoc(doc);
- doc = NULL;
- }
-
- [xmlParsingLock unlock];
-
- if ([self error]) {
- return;
- } else if (![[self resourceList] count]) {
- [super requestFinished];
- [super markAsFinished];
- return;
- }
-
- // Create a new request for every item in the queue
- [[self externalResourceQueue] cancelAllOperations];
- [self setExternalResourceQueue:[ASINetworkQueue queue]];
- [[self externalResourceQueue] setDelegate:self];
- [[self externalResourceQueue] setShouldCancelAllRequestsOnFailure:[self shouldIgnoreExternalResourceErrors]];
- [[self externalResourceQueue] setShowAccurateProgress:[self showAccurateProgress]];
- [[self externalResourceQueue] setQueueDidFinishSelector:@selector(finishedFetchingExternalResources:)];
- [[self externalResourceQueue] setRequestDidFinishSelector:@selector(externalResourceFetchSucceeded:)];
- [[self externalResourceQueue] setRequestDidFailSelector:@selector(externalResourceFetchFailed:)];
- for (NSString *theURL in [[self resourceList] keyEnumerator]) {
- ASIWebPageRequest *externalResourceRequest = [ASIWebPageRequest requestWithURL:[NSURL URLWithString:theURL relativeToURL:[self url]]];
- [externalResourceRequest setRequestHeaders:[self requestHeaders]];
- [externalResourceRequest setDownloadCache:[self downloadCache]];
- [externalResourceRequest setCachePolicy:[self cachePolicy]];
- [externalResourceRequest setCacheStoragePolicy:[self cacheStoragePolicy]];
- [externalResourceRequest setUserInfo:[NSDictionary dictionaryWithObject:theURL forKey:@"Path"]];
- [externalResourceRequest setParentRequest:self];
- [externalResourceRequest setUrlReplacementMode:[self urlReplacementMode]];
- [externalResourceRequest setShouldResetDownloadProgress:NO];
- [externalResourceRequest setDelegate:self];
- [externalResourceRequest setUploadProgressDelegate:self];
- [externalResourceRequest setDownloadProgressDelegate:self];
- if ([self downloadDestinationPath]) {
- [externalResourceRequest setDownloadDestinationPath:[self cachePathForRequest:externalResourceRequest]];
- }
- [[self externalResourceQueue] addOperation:externalResourceRequest];
- }
- [[self externalResourceQueue] go];
-}
-
-- (void)externalResourceFetchSucceeded:(ASIHTTPRequest *)externalResourceRequest
-{
- NSString *originalPath = [[externalResourceRequest userInfo] objectForKey:@"Path"];
- NSMutableDictionary *requestResponse = [[self resourceList] objectForKey:originalPath];
- NSString *contentType = [[externalResourceRequest responseHeaders] objectForKey:@"Content-Type"];
- if (!contentType) {
- contentType = @"application/octet-stream";
- }
- [requestResponse setObject:contentType forKey:@"ContentType"];
- if ([self downloadDestinationPath]) {
- [requestResponse setObject:[externalResourceRequest downloadDestinationPath] forKey:@"DataPath"];
- } else {
- NSData *data = [externalResourceRequest responseData];
- if (data) {
- [requestResponse setObject:data forKey:@"Data"];
- }
- }
-}
-
-- (void)externalResourceFetchFailed:(ASIHTTPRequest *)externalResourceRequest
-{
- if ([[self externalResourceQueue] shouldCancelAllRequestsOnFailure]) {
- [self failWithError:[externalResourceRequest error]];
- }
-}
-
-- (void)finishedFetchingExternalResources:(ASINetworkQueue *)queue
-{
- if ([self urlReplacementMode] != ASIDontModifyURLs) {
- if (webContentType == ASICSSWebContentType) {
- NSMutableString *parsedResponse;
- NSError *err = nil;
- if ([self downloadDestinationPath]) {
- parsedResponse = [NSMutableString stringWithContentsOfFile:[self downloadDestinationPath] encoding:[self responseEncoding] error:&err];
- } else {
- parsedResponse = [[[self responseString] mutableCopy] autorelease];
- }
- if (err) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:101 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Error: unable to read response CSS from disk",NSLocalizedDescriptionKey,nil]]];
- return;
- }
- if (![self error]) {
- for (NSString *resource in [[self resourceList] keyEnumerator]) {
- if ([parsedResponse rangeOfString:resource].location != NSNotFound) {
- NSString *newURL = [self contentForExternalURL:resource];
- if (newURL) {
- [parsedResponse replaceOccurrencesOfString:resource withString:newURL options:0 range:NSMakeRange(0, [parsedResponse length])];
- }
- }
- }
- }
- if ([self downloadDestinationPath]) {
- [parsedResponse writeToFile:[self downloadDestinationPath] atomically:NO encoding:[self responseEncoding] error:&err];
- if (err) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:101 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Error: unable to write response CSS to disk",NSLocalizedDescriptionKey,nil]]];
- return;
- }
- } else {
- [self setRawResponseData:(id)[parsedResponse dataUsingEncoding:[self responseEncoding]]];
- }
- } else {
- [xmlParsingLock lock];
-
- [self updateResourceURLs];
-
- if (![self error]) {
-
- // We'll use the xmlsave API so we can strip the xml declaration
- xmlSaveCtxtPtr saveContext;
-
- if ([self downloadDestinationPath]) {
-
- // Truncate the file first
- [[[[NSFileManager alloc] init] autorelease] createFileAtPath:[self downloadDestinationPath] contents:nil attributes:nil];
-
- saveContext = xmlSaveToFd([[NSFileHandle fileHandleForWritingAtPath:[self downloadDestinationPath]] fileDescriptor],NULL,2); // 2 == XML_SAVE_NO_DECL, this isn't declared on Mac OS 10.5
- xmlSaveDoc(saveContext, doc);
- xmlSaveClose(saveContext);
-
- } else {
- #if TARGET_OS_MAC && MAC_OS_X_VERSION_MAX_ALLOWED <= __MAC_10_5
- // xmlSaveToBuffer() is not implemented in the 10.5 version of libxml
- NSString *tempPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]];
- [[[[NSFileManager alloc] init] autorelease] createFileAtPath:tempPath contents:nil attributes:nil];
- saveContext = xmlSaveToFd([[NSFileHandle fileHandleForWritingAtPath:tempPath] fileDescriptor],NULL,2); // 2 == XML_SAVE_NO_DECL, this isn't declared on Mac OS 10.5
- xmlSaveDoc(saveContext, doc);
- xmlSaveClose(saveContext);
- [self setRawResponseData:[NSMutableData dataWithContentsOfFile:tempPath]];
- #else
- xmlBufferPtr buffer = xmlBufferCreate();
- saveContext = xmlSaveToBuffer(buffer,NULL,2); // 2 == XML_SAVE_NO_DECL, this isn't declared on Mac OS 10.5
- xmlSaveDoc(saveContext, doc);
- xmlSaveClose(saveContext);
- [self setRawResponseData:[[[NSMutableData alloc] initWithBytes:buffer->content length:buffer->use] autorelease]];
- xmlBufferFree(buffer);
- #endif
- }
-
- // Strip the content encoding if the original response was gzipped
- if ([self isResponseCompressed]) {
- NSMutableDictionary *headers = [[[self responseHeaders] mutableCopy] autorelease];
- [headers removeObjectForKey:@"Content-Encoding"];
- [self setResponseHeaders:headers];
- }
- }
-
- xmlFreeDoc(doc);
- doc = nil;
-
- [requestsUsingXMLParser removeObject:self];
- if (![requestsUsingXMLParser count]) {
- xmlCleanupParser();
- }
- [xmlParsingLock unlock];
- }
- }
- if (![self parentRequest]) {
- [[self class] updateProgressIndicator:&downloadProgressDelegate withProgress:contentLength ofTotal:contentLength];
- }
-
- NSMutableDictionary *newHeaders = [[[self responseHeaders] mutableCopy] autorelease];
- [newHeaders removeObjectForKey:@"Content-Encoding"];
- [self setResponseHeaders:newHeaders];
-
- // Write the parsed content back to the cache
- if ([self urlReplacementMode] != ASIDontModifyURLs) {
- [[self downloadCache] storeResponseForRequest:self maxAge:[self secondsToCache]];
- }
-
- [super requestFinished];
- [super markAsFinished];
-}
-
-- (void)readResourceURLs
-{
- // Create xpath evaluation context
- xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc);
- if(xpathCtx == NULL) {
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:101 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Error: unable to create new XPath context",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
- // Evaluate xpath expression
- xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
- if(xpathObj == NULL) {
- xmlXPathFreeContext(xpathCtx);
- [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:101 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Error: unable to evaluate XPath expression!",NSLocalizedDescriptionKey,nil]]];
- return;
- }
-
- // Now loop through our matches
- xmlNodeSetPtr nodes = xpathObj->nodesetval;
-
- int size = (nodes) ? nodes->nodeNr : 0;
- int i;
- for(i = size - 1; i >= 0; i--) {
- assert(nodes->nodeTab[i]);
- NSString *parentName = [NSString stringWithCString:(char *)nodes->nodeTab[i]->parent->name encoding:[self responseEncoding]];
- NSString *nodeName = [NSString stringWithCString:(char *)nodes->nodeTab[i]->name encoding:[self responseEncoding]];
-
- xmlChar *nodeValue = xmlNodeGetContent(nodes->nodeTab[i]);
- NSString *value = [NSString stringWithCString:(char *)nodeValue encoding:[self responseEncoding]];
- xmlFree(nodeValue);
-
- // Our xpath query matched all elements, but we're only interested in stylesheets
- // We do the work here rather than in the xPath query because the query is case-sensitive, and we want to match on 'stylesheet', 'StyleSHEEt' etc
- if ([[parentName lowercaseString] isEqualToString:@"link"]) {
- xmlChar *relAttribute = xmlGetNoNsProp(nodes->nodeTab[i]->parent,(xmlChar *)"rel");
- if (relAttribute) {
- NSString *rel = [NSString stringWithCString:(char *)relAttribute encoding:[self responseEncoding]];
- xmlFree(relAttribute);
- if ([[rel lowercaseString] isEqualToString:@"stylesheet"]) {
- [self addURLToFetch:value];
- }
- }
-
- // Parse the content of
-
-
-
-
-
Your browser fingerprint with default settings (canvas, screen resolutin, activeX disabled)
-
-
-
-
Your browser fingerprint with canvas enabled is:
-
-
-
-
Your browser fingerprint with ie_activex enabled is:
-
-
-
-
Your browser fingerprint with screen_resolution enabled is: