Skip to content

Commit 3512841

Browse files
committed
Issue-256 - TestClient - Update logs
1 parent 62cc073 commit 3512841

File tree

1 file changed

+14
-3
lines changed
  • test/PwrDrvr.LambdaDispatch.Router.TestClient

1 file changed

+14
-3
lines changed

test/PwrDrvr.LambdaDispatch.Router.TestClient/Program.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ static async Task Main(string[] args)
8787
var sslStream = new SslStream(
8888
client.GetStream(),
8989
false
90-
// new RemoteCertificateValidationCallback((sender, certificate, chain, errors) => true)
9190
);
9291

9392
await sslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions
@@ -141,9 +140,12 @@ await sslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions
141140

142141
// Write chunk data
143142
await stream.WriteAsync(buffer.AsMemory(0, bytesRead));
143+
144+
// Write the trailing \r\n after the chunk data
144145
await stream.WriteAsync(Encoding.ASCII.GetBytes("\r\n"));
146+
// await stream.FlushAsync();
145147

146-
await Task.Delay(30);
148+
// await Task.Delay(30);
147149

148150
totalBytesSent += bytesRead;
149151

@@ -435,6 +437,14 @@ public static async Task<long> ReadResponse(Stream stream)
435437

436438
if (chunkSizeBytes.Count == 0)
437439
{
440+
if (b == -1)
441+
{
442+
Console.WriteLine("ERROR - Received (chunked): EOF when reading chunk size");
443+
}
444+
else
445+
{
446+
Console.WriteLine("ERROR - Received (chunked): empty chunk size");
447+
}
438448
break;
439449
}
440450

@@ -457,8 +467,9 @@ public static async Task<long> ReadResponse(Stream stream)
457467

458468
totalBytesReceived += bytesRead;
459469

460-
if (bytesRead == 0)
470+
if (bytesRead <= 0)
461471
{
472+
Console.WriteLine("ERROR - Received (chunked): EOF when reading chunk data");
462473
break;
463474
}
464475
remaining -= bytesRead;

0 commit comments

Comments
 (0)