1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-18 09:13:14 +00:00

Fixed Digest Unit test issue with persistent connections

Removed debug lines
This commit is contained in:
Bryan Roe
2022-07-02 01:05:14 -07:00
parent 143f7ef578
commit 44e2dfaae4
2 changed files with 36 additions and 58 deletions

View File

@@ -1871,10 +1871,6 @@ ILibWebClient_DataResults ILibWebClient_OnData(ILibAsyncSocket_SocketModule sock
ILibDestructPacket(wcdo->header); ILibDestructPacket(wcdo->header);
wcdo->header = tph; wcdo->header = tph;
} }
//else
//{
// printf("WCDO/HEADER was NULL\n");
//}
} }
} }
} }
@@ -2216,6 +2212,7 @@ void ILibWebClient_OnDisconnectSink(ILibAsyncSocket_SocketModule socketModule, v
wcdo->FinHeader = 0; wcdo->FinHeader = 0;
h = wcdo->header; h = wcdo->header;
wcdo->header = NULL; wcdo->header = NULL;
if (wr != NULL && wr->OnResponse != NULL) if (wr != NULL && wr->OnResponse != NULL)
{ {
wr->OnResponse( wr->OnResponse(

View File

@@ -235,65 +235,46 @@ server.on('request', function (imsg, rsp)
username = imsg.Digest_GetUsername(); username = imsg.Digest_GetUsername();
qop = imsg.Digest_GetQOP(); qop = imsg.Digest_GetQOP();
switch (imsg.url) imsg.on('end', function ()
{ {
case '/': switch (imsg.url)
if (imsg.Digest_ValidatePassword(digest_password)) {
{ case '/auth':
rsp.statusCode = 200; if (qop != 'auth') { promises.digest_auth.reject('Received Incorrect QOP: ' + qop); }
rsp.setHeader('Content-Type', 'text/html'); break;
rsp.end('<html>Success!</html>'); case '/auth-int':
} if (qop != 'auth-int') { promises.digest_authint.reject('Received Incorrect QOP: ' + qop); }
else break;
{ }
rsp.Digest_writeUnauthorized(digest_realm); if (imsg.Digest_ValidatePassword(digest_password))
} {
break; rsp.statusCode = 200;
case '/auth': rsp.setHeader('Content-Type', 'text/html');
if (qop != 'auth') { promises.digest_auth.reject('Received Incorrect QOP: ' + qop); } rsp.end('<html>Success!</html>');
if (imsg.Digest_ValidatePassword(digest_password)) }
{ else
rsp.statusCode = 200; {
rsp.setHeader('Content-Type', 'text/html'); rsp.Digest_writeUnauthorized(digest_realm);
rsp.end('<html>Success!</html>'); }
} });
else
{
rsp.Digest_writeUnauthorized(digest_realm, { qop: 'auth' });
}
break;
case '/auth-int':
if (qop != 'auth-int') { promises.digest_authint.reject('Received Incorrect QOP: ' + qop); }
imsg.on('end', function ()
{
if (imsg.Digest_ValidatePassword(digest_password))
{
rsp.statusCode = 200;
rsp.setHeader('Content-Type', 'text/html');
rsp.end('<html>Success!</html>');
}
else
{
rsp.Digest_writeUnauthorized(digest_realm);
}
});
break;
}
} }
else else
{ {
switch (imsg.url) imsg.on('end', function ()
{ {
case '/': switch (imsg.url)
rsp.Digest_writeUnauthorized(digest_realm); {
break; case '/':
case '/auth': rsp.Digest_writeUnauthorized(digest_realm);
rsp.Digest_writeUnauthorized(digest_realm, { qop: 'auth' }); break;
break; case '/auth':
case '/auth-int': rsp.Digest_writeUnauthorized(digest_realm, { qop: 'auth' });
rsp.Digest_writeUnauthorized(digest_realm, { qop: 'auth-int, auth' }); break;
break; case '/auth-int':
} rsp.Digest_writeUnauthorized(digest_realm, { qop: 'auth-int, auth' });
break;
}
});
} }
} }
}); });