Next: , Up: microhttpd-dauth   [Contents][Index]


10.1 Using Basic Authentication

Function: void MHD_free (void *ptr)

Free the memory given at ptr. Used to free data structures allocated by MHD. Calls free(ptr).

Function: char * MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password)

Get the username and password from the basic authorization header sent by the client. Return NULL if no username could be found, a pointer to the username if found. If returned value is not NULL, the value must be MHD_free()’ed.

password reference a buffer to store the password. It can be NULL. If returned value is not NULL, the value must be MHD_free()’ed.

Function: enum MHD_Result MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)

Queues a response to request basic authentication from the client. Return MHD_YES if successful, otherwise MHD_NO.

realm must reference to a zero-terminated string representing the realm.

response a response structure to specify what shall be presented to the client with a 401 HTTP status.