aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-09 22:41:11 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-09 22:41:11 +0200
commit330a40552cbd26ebcdf25bf209e12697ac330737 (patch)
tree7db9138ce0dfb398aae4aa560ea43cbe3baeedd6 /doc
parent181ac3c59fffd599cd6b351940bffd5c6c930fd7 (diff)
downloadlibmicrohttpd-330a40552cbd26ebcdf25bf209e12697ac330737.tar.gz
libmicrohttpd-330a40552cbd26ebcdf25bf209e12697ac330737.zip
add MHD_free(), as suggested by Tim on the mailinglist
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/basicauthentication.c11
-rw-r--r--doc/libmicrohttpd.texi10
2 files changed, 13 insertions, 8 deletions
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c
index 0e13a2ee..88cb79b7 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -42,12 +42,13 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
42 return MHD_YES; 42 return MHD_YES;
43 } 43 }
44 pass = NULL; 44 pass = NULL;
45 user = MHD_basic_auth_get_username_password (connection, &pass); 45 user = MHD_basic_auth_get_username_password (connection,
46 fail = ( (user == NULL) || 46 &pass);
47 fail = ( (NULL == user) ||
47 (0 != strcmp (user, "root")) || 48 (0 != strcmp (user, "root")) ||
48 (0 != strcmp (pass, "pa$$w0rd") ) ); 49 (0 != strcmp (pass, "pa$$w0rd") ) );
49 if (user != NULL) free (user); 50 if (NULL != user) MHD_free (user);
50 if (pass != NULL) free (pass); 51 if (NULL != pass) MHD_free (pass);
51 if (fail) 52 if (fail)
52 { 53 {
53 const char *page = "<html><body>Go away.</body></html>"; 54 const char *page = "<html><body>Go away.</body></html>";
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 05b1f834..2e0f196f 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -2342,13 +2342,17 @@ client certificates is presented in the MHD tutorial.
2342@node microhttpd-dauth basic 2342@node microhttpd-dauth basic
2343@section Using Basic Authentication 2343@section Using Basic Authentication
2344 2344
2345@deftypefun {void} MHD_free (void *ptr)
2346Free the memory given at @code{ptr}. Used to free data structures allocated by MHD. Calls @code{free(ptr)}.
2347@end deftypefun
2348
2345@deftypefun {char *} MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password) 2349@deftypefun {char *} MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password)
2346Get the username and password from the basic authorization header sent by the client. 2350Get the username and password from the basic authorization header sent by the client.
2347Return @code{NULL} if no username could be found, a pointer to the username if found. 2351Return @code{NULL} if no username could be found, a pointer to the username if found.
2348If returned value is not @code{NULL}, the value must be @code{free()}'ed. 2352If returned value is not @code{NULL}, the value must be @code{MHD_free()}'ed.
2349 2353
2350@var{password} reference a buffer to store the password. It can be @code{NULL}. 2354@var{password} reference a buffer to store the password. It can be @code{NULL}.
2351If returned value is not @code{NULL}, the value must be @code{free()}'ed. 2355If returned value is not @code{NULL}, the value must be @code{MHD_free()}'ed.
2352@end deftypefun 2356@end deftypefun
2353 2357
2354@deftypefun {int} MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response) 2358@deftypefun {int} MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)
@@ -2370,7 +2374,7 @@ client with a 401 HTTP status.
2370@deftypefun {char *} MHD_digest_auth_get_username (struct MHD_Connection *connection) 2374@deftypefun {char *} MHD_digest_auth_get_username (struct MHD_Connection *connection)
2371Find and return a pointer to the username value from the request header. 2375Find and return a pointer to the username value from the request header.
2372Return @code{NULL} if the value is not found or header does not exist. 2376Return @code{NULL} if the value is not found or header does not exist.
2373If returned value is not @code{NULL}, the value must be @code{free()}'ed. 2377If returned value is not @code{NULL}, the value must be @code{MHD_free()}'ed.
2374@end deftypefun 2378@end deftypefun
2375 2379
2376@deftypefun int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout) 2380@deftypefun int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout)