diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-01-18 15:56:09 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-01-18 15:56:09 +0300 |
commit | 6ed5b52d3e41a706904e05277afad92087a54784 (patch) | |
tree | 522e20fc7f08eaee3363ca955d695515ad0b81af | |
parent | 84a92e8a7130c351b200dedc41b317e8a75ffcac (diff) | |
download | libmicrohttpd-6ed5b52d3e41a706904e05277afad92087a54784.tar.gz libmicrohttpd-6ed5b52d3e41a706904e05277afad92087a54784.zip |
Fixed early response with digest auth in tests, examples, and documentation
-rw-r--r-- | doc/libmicrohttpd.texi | 8 | ||||
-rw-r--r-- | src/examples/digest_auth_example.c | 8 | ||||
-rw-r--r-- | src/testcurl/test_digestauth.c | 8 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_sha256.c | 8 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_with_arguments.c | 8 |
5 files changed, 40 insertions, 0 deletions
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi index a14c28d3..46eed3b0 100644 --- a/doc/libmicrohttpd.texi +++ b/doc/libmicrohttpd.texi | |||
@@ -3302,6 +3302,14 @@ ahc_echo (void *cls, | |||
3302 | const char *password = "testpass"; | 3302 | const char *password = "testpass"; |
3303 | const char *realm = "test@@example.com"; | 3303 | const char *realm = "test@@example.com"; |
3304 | int ret; | 3304 | int ret; |
3305 | static int already_called_marker; | ||
3306 | |||
3307 | if (&already_called_marker != *req_cls) | ||
3308 | @{ /* Called for the first time, request not fully read yet */ | ||
3309 | *req_cls = &already_called_marker; | ||
3310 | /* Wait for complete request */ | ||
3311 | return MHD_YES; | ||
3312 | @} | ||
3305 | 3313 | ||
3306 | username = MHD_digest_auth_get_username (connection); | 3314 | username = MHD_digest_auth_get_username (connection); |
3307 | if (username == NULL) | 3315 | if (username == NULL) |
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c index 44faefeb..ea3da19a 100644 --- a/src/examples/digest_auth_example.c +++ b/src/examples/digest_auth_example.c | |||
@@ -48,6 +48,7 @@ ahc_echo (void *cls, | |||
48 | const char *realm = "test@example.com"; | 48 | const char *realm = "test@example.com"; |
49 | int res; | 49 | int res; |
50 | enum MHD_Result ret; | 50 | enum MHD_Result ret; |
51 | static int already_called_marker; | ||
51 | (void) cls; /* Unused. Silent compiler warning. */ | 52 | (void) cls; /* Unused. Silent compiler warning. */ |
52 | (void) url; /* Unused. Silent compiler warning. */ | 53 | (void) url; /* Unused. Silent compiler warning. */ |
53 | (void) method; /* Unused. Silent compiler warning. */ | 54 | (void) method; /* Unused. Silent compiler warning. */ |
@@ -56,6 +57,13 @@ ahc_echo (void *cls, | |||
56 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 57 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
57 | (void) req_cls; /* Unused. Silent compiler warning. */ | 58 | (void) req_cls; /* Unused. Silent compiler warning. */ |
58 | 59 | ||
60 | if (&already_called_marker != *req_cls) | ||
61 | { /* Called for the first time, request not fully read yet */ | ||
62 | *req_cls = &already_called_marker; | ||
63 | /* Wait for complete request */ | ||
64 | return MHD_YES; | ||
65 | } | ||
66 | |||
59 | username = MHD_digest_auth_get_username (connection); | 67 | username = MHD_digest_auth_get_username (connection); |
60 | if (NULL == username) | 68 | if (NULL == username) |
61 | { | 69 | { |
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c index 13c9c826..5dd9d466 100644 --- a/src/testcurl/test_digestauth.c +++ b/src/testcurl/test_digestauth.c | |||
@@ -94,10 +94,18 @@ ahc_echo (void *cls, | |||
94 | const char *realm = "test@example.com"; | 94 | const char *realm = "test@example.com"; |
95 | enum MHD_Result ret; | 95 | enum MHD_Result ret; |
96 | int ret_i; | 96 | int ret_i; |
97 | static int already_called_marker; | ||
97 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 98 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
98 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 99 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
99 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ | 100 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
100 | 101 | ||
102 | if (&already_called_marker != *req_cls) | ||
103 | { /* Called for the first time, request not fully read yet */ | ||
104 | *req_cls = &already_called_marker; | ||
105 | /* Wait for complete request */ | ||
106 | return MHD_YES; | ||
107 | } | ||
108 | |||
101 | username = MHD_digest_auth_get_username (connection); | 109 | username = MHD_digest_auth_get_username (connection); |
102 | if ( (username == NULL) || | 110 | if ( (username == NULL) || |
103 | (0 != strcmp (username, "testuser")) ) | 111 | (0 != strcmp (username, "testuser")) ) |
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c index 7f8ebcd5..fff3a1d7 100644 --- a/src/testcurl/test_digestauth_sha256.c +++ b/src/testcurl/test_digestauth_sha256.c | |||
@@ -95,10 +95,18 @@ ahc_echo (void *cls, | |||
95 | const char *realm = "test@example.com"; | 95 | const char *realm = "test@example.com"; |
96 | enum MHD_Result ret; | 96 | enum MHD_Result ret; |
97 | int ret_i; | 97 | int ret_i; |
98 | static int already_called_marker; | ||
98 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 99 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
99 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 100 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
100 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ | 101 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
101 | 102 | ||
103 | if (&already_called_marker != *req_cls) | ||
104 | { /* Called for the first time, request not fully read yet */ | ||
105 | *req_cls = &already_called_marker; | ||
106 | /* Wait for complete request */ | ||
107 | return MHD_YES; | ||
108 | } | ||
109 | |||
102 | username = MHD_digest_auth_get_username (connection); | 110 | username = MHD_digest_auth_get_username (connection); |
103 | if ( (username == NULL) || | 111 | if ( (username == NULL) || |
104 | (0 != strcmp (username, "testuser")) ) | 112 | (0 != strcmp (username, "testuser")) ) |
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c index ce4b8970..91f2dd67 100644 --- a/src/testcurl/test_digestauth_with_arguments.c +++ b/src/testcurl/test_digestauth_with_arguments.c | |||
@@ -88,10 +88,18 @@ ahc_echo (void *cls, | |||
88 | const char *realm = "test@example.com"; | 88 | const char *realm = "test@example.com"; |
89 | enum MHD_Result ret; | 89 | enum MHD_Result ret; |
90 | int ret_i; | 90 | int ret_i; |
91 | static int already_called_marker; | ||
91 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 92 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
92 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 93 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
93 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ | 94 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
94 | 95 | ||
96 | if (&already_called_marker != *req_cls) | ||
97 | { /* Called for the first time, request not fully read yet */ | ||
98 | *req_cls = &already_called_marker; | ||
99 | /* Wait for complete request */ | ||
100 | return MHD_YES; | ||
101 | } | ||
102 | |||
95 | username = MHD_digest_auth_get_username (connection); | 103 | username = MHD_digest_auth_get_username (connection); |
96 | if ( (username == NULL) || | 104 | if ( (username == NULL) || |
97 | (0 != strcmp (username, "testuser")) ) | 105 | (0 != strcmp (username, "testuser")) ) |