# Class type Nethttp_client.key_handler

    class type key_handler = object .. end

    method inquire_key : domain:Neturl.url option -> realm:string -> auth:string -> key

The method is called when a new session must be authenticated. The `domain` is the URI from the request. URIs must have the form "http://host:port/path", i.e. the port is always written out. If the request doesn't have a URI, or if the request is directed to a proxy, `domain` will be `None`. The `realm` parameter is the realm identifier. In `auth` the name of the authentication method is passed (lowercase characters). The method must search (or interactively ask for) a key, and return it. The key must refer to one of the passed realms. If the method raises `Not_found`, authentication will fail.

    method invalidate_key : key -> unit

The handler is notified that authentication failed for this key