Problem/Motivation

Usernames and passwords with special characters do not work due to the underlying libraries setting basic auth credentials as part of the URL request.

Steps to reproduce

Set a password as: Password!@#

Proposed resolution

Use CURLAUTH_BASIC and CURLOPT_USERPWD when setting up the Elasticsearch client.

Remaining tasks

Write a patch

User interface changes

No

API changes

No

Data model changes

No

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nick_schuch created an issue. See original summary.

nick_schuch’s picture

StatusFileSize
new1.24 KB

Here is a patch which sets the required curl options for basic authentication while leaving the "Digest" and "NTLM" options to be handled at the library level.

nick_schuch’s picture

StatusFileSize
new1.19 KB

Updated patch with debug code removed (should have had that extra coffee).

nick_schuch’s picture

nicksanta’s picture

Related - we encountered a regression recently where changes to FILTER_VALIDATE_URL in PHP 7.4.21 caused our apps using @ symbols in the credentials to stop connecting to the cluster.

https://bugs.php.net/bug.php?id=81122

sokru’s picture

Status: Active » Needs review
StatusFileSize
new1.55 KB

Good catch! I was not able to apply the patch from #3, so I created a new one. I did minor coding style improvements and added `ext-curl` requirement for composer.json. Most of Linux distributions have php-curl installed by default, but since neither Drupal core or dependent PHP-libraries require ext-curl, it might save some troubleshooting time from developers trying this module without php-curl installed, if they face the problem already on composer require drupal/elasticsearch_connector phase.

  • sokru committed aaa2ea81 on 8.x-7.x
    Issue #3241071 by nick_schuch, sokru: Use CURLAUTH_BASIC and...
sokru’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.