I am using AFNetworking
3.1.0 to make a http request.
It shows below after i made the request. The code i made the request is in the bottom. The url below you can see is not visitable without ssl VPN.
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: forbidden (403)" UserInfo={com.alamofire.serialization.response.error.response= { URL: https://223.71.215.70/web/1/http/0/10.100.5.105:6666/entry } { status code: 403, headers { Connection = "Keep-Alive"; "Content-Length" = 238; "Content-Type" = "text/html; charset=iso-8859-1"; Date = "Wed, 14 Dec 2016 14:27:48 GMT"; "Keep-Alive" = "timeout=15, max=100"; "X-Frame-Options" = SAMEORIGIN; } }, NSErrorFailingURLKey=https://223.71.215.70/web/1/http/0/10.100.5.105:6666/entry, NSLocalizedDescription=Request failed: forbidden (403), com.alamofire.serialization.response.error.data=<3c21444f 43545950 45204854 4d4c2050 55424c49 4320222d 2f2f4945 54462f2f 44544420 48544d4c 20322e30 2f2f454e 223e0a3c 68746d6c 3e3c6865 61643e0a 3c746974 6c653e34 30332046 6f726269 6464656e 3c2f7469 746c653e 0a3c2f68 6561643e 3c626f64 793e0a3c 68313e46 6f726269 6464656e 3c2f6831 3e0a3c70 3e596f75 20646f6e 27742068 61766520 7065726d 69737369 6f6e2074 6f206163 63657373 202f7765 622f312f 68747470 2f302f31 302e3130 302e352e 3130353a 36363636 2f656e74 72790a6f 6e207468 69732073 65727665 722e3c2f 703e0a3c 2f626f64 793e3c2f 68746d6c 3e0a>} Request failed: forbidden (403)
let config = URLSessionConfiguration.default
config.timeoutIntervalForRequest = 30
let manager = AFHTTPSessionManager(sessionConfiguration: config)
manager.requestSerializer = AFHTTPRequestSerializer() // AFJSONRequestSerializer(writingOptions: .prettyPrinted)
manager.responseSerializer = AFHTTPResponseSerializer() // AFJSONResponseSerializer(readingOptions: .mutableContainers)
// manager.responseSerializer.acceptableContentTypes = ["text/html"]
manager.responseSerializer.acceptableContentTypes = ["application/json", "text/json", "text/JavaScript", "text/html", "text/plain"]
let policy = AFSecurityPolicy(pinningMode: .none)
policy.allowInvalidCertificates = true
policy.validatesDomainName = false
manager.securityPolicy = policy
manager.post(url, parameters: para, progress: nil, success: { (task:URLSessionDataTask, a:Any?) in
print(123)
}) { (task: URLSessionDataTask?, error: Error) in
// print(task?.description)
print(error)
print(error.localizedDescription)
}