ec_httpsrv_register_auth

March 26, 2020 Contributors

Name

ec_httpsrv_register_auth — Register an HTTP handler for authenticating a URI

Synopsis

#include "/modules/listeners/httpsrv.h"

| int **ec_httpsrv_register_auth** ( | instance, |   |
|   | method, |   |
|   | path, |   |
|   | closure, |   |
|   | handler); |   |

const char * <var class="pdparam">instance</var>;
const char * <var class="pdparam">method</var>;
const char * <var class="pdparam">path</var>;
ec_blobject * <var class="pdparam">closure</var>;
ec_httpsrv_auth_handler_func <var class="pdparam">handler</var>;

Description

This function registers an HTTP handler for authenticating a URI.

Parameters

instance

This is reserved for future use in virtual host support and must currently be NULL.

method

HTTP method to be handled

For example: GET

path

Base URI path

The trailing ‘/’ character is optional.

closure

Closure that is passed through to the handler via ec_httpsrv_service_ctx_get

handler

Function that is invoked on matching requests

Authentication handlers are matched using the same algorithm as request handlers. See the description of ec_httpsrv_register for details.

Return Values

This function returns 0 on success. On failure, it returns an error number that indicates the nature of the failure.

Threading

This hook can be called in any thread.