Related to Issue 2012: ldap http authentication

As the title says, this pull request is related to issue https://github.com/gitlabhq/gitlabhq/issues/2012.

Notes:
* this fix is for latest master, which I haven't tested in production (couldn't start/enable master version at this time)
* older fix (see issue for details) is in production and works fine