Skip to content

Commit

Permalink
Adjust tests for longer nonce time on digest-md5
Browse files Browse the repository at this point in the history
  • Loading branch information
vorner committed Dec 4, 2023
1 parent 586d292 commit 15d5ae0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/unit/lib/WUI/nhttp/server_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ TEST_CASE("Digest stale nonce") {
REQUIRE(client_conn == 1);

SECTION("Real stale nonce") {
set_time(0x0000000f);
set_time(0x00000fff);
string request = digest_auth_header("GET", "maker", "aaaaaaaa00000000", "/secret.html", "0cbf0ac5ca4c879c35a3b91430214a47");
server.send(client_conn, request);
}
Expand All @@ -580,7 +580,7 @@ TEST_CASE("Digest stale nonce") {

const auto response = server.recv_all(client_conn);
// Note: connection should be kept alive, beacause it is save to do with GET
check_unauth_digest(response, "aaaaaaaa0000000f", "true", "keep-alive");
check_unauth_digest(response, "aaaaaaaa00000fff", "true", "keep-alive");
}

// should resolve to stale=false, because client should not retry with different nonce
Expand All @@ -592,13 +592,13 @@ TEST_CASE("Stale nonce and wrong auth") {
const size_t client_conn = server.new_conn();
REQUIRE(client_conn == 1);

set_time(0x0000000f);
set_time(0x00000fff);
string request = digest_auth_header("GET", "invaliduser", "aaaaaaaa00000000", "/secret.html", "1dd8be56e6996b274258d7412e671e5f");
server.send(client_conn, request);

const auto response = server.recv_all(client_conn);
// Note: connection should be kept alive, beacause it is save to do with GET
check_unauth_digest(response, "aaaaaaaa0000000f", "false", "keep-alive");
check_unauth_digest(response, "aaaaaaaa00000fff", "false", "keep-alive");
}

TEST_CASE("Not authenticated digest error close") {
Expand Down

0 comments on commit 15d5ae0

Please sign in to comment.