From a507ee9daa975bf30c984f6000a103251f89d3fd Mon Sep 17 00:00:00 2001 From: Orkhan Alikhanov Date: Mon, 2 Jul 2018 19:17:31 +0400 Subject: [PATCH] Added option to allow secure connection over self-signed certificate --- Request.swift.podspec | 2 +- Sources/Requester.swift | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Request.swift.podspec b/Request.swift.podspec index 9b99ff6..5ebbd5b 100755 --- a/Request.swift.podspec +++ b/Request.swift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Request.swift' - s.version = '2.2.2' + s.version = '2.2.3' s.summary = 'A (sync/async) tiny http client written in swift.' s.homepage = 'https://github.com/BiAtoms/Request.swift' s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/Sources/Requester.swift b/Sources/Requester.swift index 4c27c77..0623d08 100644 --- a/Sources/Requester.swift +++ b/Sources/Requester.swift @@ -19,8 +19,9 @@ open class Requester { open var request: Request open var response: Response? open var error: Error? - open var handler: ResponseHandler? = nil - open var proxy: Proxy? = nil + open var handler: ResponseHandler? + open var proxy: Proxy? + open var allowSelfSigned = false public init(request: Request, queue: DispatchQueue, timeout: Int, proxy: Proxy?) { self.request = request @@ -96,7 +97,7 @@ open class Requester { } if request.isSecure { - try socket.startTls(.init(peer: hostname)) + try socket.startTls(.init(peer: hostname, allowSelfSigned: allowSelfSigned)) } }