in reply to Basic HTTP Authentication
If you're trying to do basic HTTP authentication against an LDAP server, I'd recommend mod_auth_ldap, rather than trying to roll your own.