LWP::Protocol::ldap(3) User Contributed Perl Documentation LWP::Protocol::ldap(3)
LWP::Protocol::ldap - Provide LDAP support for LWP::UserAgent
$ua = LWP::UserAgent->new();
$res = $ua->get('ldap://ldap.example.com/' .
Accept => 'text/json'):
The LWP::Protocol::ldap module provides support for using ldap schemed URLs following RFC
4516 with LWP. This module is a plug-in to the LWP protocol handling, so you don't use it
In addition to being used with LDAP URIs, LWP::Protocol::ldap also acts as the base class
for its sibling modules LWP::Protocol::ldaps and LWP::Protocol::ldapi.
HTTP methods supported
LWP::Protocol::ldap implements the HTTP GET and HEAD methods. They are mapped to the LDAP
Depending on the HTTP Accept header provided by the user agent, LWP::Protocol::ldap can
answer the requests in one of the following formats:
When the HTTP Accept header contains the "text/dsml" MIME type, the response is sent
When the HTTP Accept header contains the "text/json" MIME type, the response is sent
as JSON. For this to work the JSON Perl module needs to be installed.
When the HTTP Accept header contains the "text/ldif" MIME type, the response is sent
in LDIFv1 format.
In case no HTTP Accept header has been sent or none of the above MIME types can be
detected, and the x-format extension has not been provided either, the response is
sent using HTML markup in a 2-column table format (roughly modeled on LDIF).
As an alternative to sending an HTTP Accept header, LWP::Protocol::ldap also accepts the
For ldap and ldapi URIs, the module implements the "x-tls" extension that switches the
LDAP connection to TLS using a call of the start_tls method.
Note: In the above example, ideally giving "x-tls" should be sufficient, but unfortunately
the parser in URI::ldap has a little flaw.
Usually the connection is done anonymously, but if the HTTP Authorization header is
provided with credentials for HTTP Basic authorization, the credentials given in that
header will be used to do a simple bind to the LDAP server.
Copyright (c) 1998-2004 Graham Barr, 2012 Peter Marschall. All rights reserved. This
program is free software; you can redistribute it and/or modify it under the same terms as
perl v5.16.3 2013-06-08 LWP::Protocol::ldap(3)