From bec10abcc92a5f9bd7296212e151f30e2118e811 Mon Sep 17 00:00:00 2001 From: Alejandro Orozco Date: Thu, 18 Jan 2024 16:39:13 -0500 Subject: [PATCH] fix: Append buffer from HTTP request to the responseData. (#12) --- README.md | 2 +- SNASources/CellularSession.m | 5 ++++- Sources/TwilioVerifySNAConfig.swift | 2 +- .../TwilioVerifySNADemo.xcodeproj/project.pbxproj | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fce35bf..a340422 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ During the current phase of this project, we only support SPM. We have plans to dependencies: [ .package( url: "https://github.com/twilio/twilio-verify-sna-ios.git", - .upToNextMajor(from: "0.0.3") + .upToNextMajor(from: "0.0.4") ) ] ``` diff --git a/SNASources/CellularSession.m b/SNASources/CellularSession.m index 46b4e79..197bc16 100644 --- a/SNASources/CellularSession.m +++ b/SNASources/CellularSession.m @@ -213,6 +213,8 @@ - (CellularSessionResult * _Nonnull)performRequest:(NSURL * _Nonnull)url { received += bytes; } while (received < total); + // Append the received data to responseData + [responseData appendBytes:buffer length:received]; } else { // Setup SSL if the URL is HTTPS // SSLCreateContext allocates and returns a new context. SSLContextRef context = SSLCreateContext(kCFAllocatorDefault, kSSLClientSide, kSSLStreamType); @@ -285,7 +287,8 @@ - (CellularSessionResult * _Nonnull)performRequest:(NSURL * _Nonnull)url { status = SSLRead(context, buffer, sizeof(buffer) - 1, &processed); if (status == noErr && processed > 0) { - [responseData appendBytes:buffer length:processed]; // Append the received data to responseData + // Append the received data to responseData + [responseData appendBytes:buffer length:processed]; } else if (status == errSSLWouldBlock) { // No more data available SSLClose(context); diff --git a/Sources/TwilioVerifySNAConfig.swift b/Sources/TwilioVerifySNAConfig.swift index 1ee0ccb..92f9594 100644 --- a/Sources/TwilioVerifySNAConfig.swift +++ b/Sources/TwilioVerifySNAConfig.swift @@ -20,5 +20,5 @@ import Foundation public struct TwilioVerifySNAConfig { - public static let version = "0.0.3" + public static let version = "0.0.4" } diff --git a/TwilioVerifySNADemo/TwilioVerifySNADemo.xcodeproj/project.pbxproj b/TwilioVerifySNADemo/TwilioVerifySNADemo.xcodeproj/project.pbxproj index 3a70676..1e34b3b 100644 --- a/TwilioVerifySNADemo/TwilioVerifySNADemo.xcodeproj/project.pbxproj +++ b/TwilioVerifySNADemo/TwilioVerifySNADemo.xcodeproj/project.pbxproj @@ -417,7 +417,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 0.0.3; + MARKETING_VERSION = 0.0.4; PRODUCT_BUNDLE_IDENTIFIER = com.twilio.TwilioVerifySNADemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -448,7 +448,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 0.0.3; + MARKETING_VERSION = 0.0.4; PRODUCT_BUNDLE_IDENTIFIER = com.twilio.TwilioVerifySNADemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "";