Skip to content

Commit

Permalink
fix: Append buffer from HTTP request to the responseData. (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroOrozco committed Jan 18, 2024
1 parent 876798c commit bec10ab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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")
)
]
```
Expand Down
5 changes: 4 additions & 1 deletion SNASources/CellularSession.m
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Sources/TwilioVerifySNAConfig.swift
Expand Up @@ -20,5 +20,5 @@
import Foundation

public struct TwilioVerifySNAConfig {
public static let version = "0.0.3"
public static let version = "0.0.4"
}
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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 = "";
Expand Down

0 comments on commit bec10ab

Please sign in to comment.