logstash-plugins / logstash-input-couchdb_changes

This plugin captures the _changes stream from a CouchDB instance
Apache License 2.0
27 stars 22 forks source link

Fix #8 Authentication Broken #9

Closed emig closed 9 years ago

emig commented 9 years ago

Implementation was not correct and its test was returning a false positive.

A couchdb db with no members in it is public. The test was missing the important step of adding a member to the database to get an enviroment that requires authentication.

The implementation was performing the authentication using the URI::HTTP 'build' method The documentation signals the problem of using it:

   Currently, if passed userinfo components this method generates
   invalid HTTP URIs as per RFC 1738.

This PR uses the suggested basic authentication method in Net::HTTP

untergeek commented 9 years ago

Thanks for this! This is a wonderful addition.

Can you bump the version? https://github.com/logstash-plugins/logstash-input-couchdb_changes/blob/master/logstash-input-couchdb_changes.gemspec#L4

Once that's in place, we can merge this.

Sorry for the delay. We've been busy with Elastic{ON} and an engineering all-hands at HQ.

emig commented 9 years ago

Bumped to 1.0.4 . Special mention to @skoni that found out the source of the problem after my PR. The method https://github.com/logstash-plugins/logstash-input-couchdb_changes/blob/master/lib/logstash/inputs/couchdb_changes.rb#L148 uses the URI:HTTP#request_uri and not the absolute uri, losing the scheme, userinfo, host and port information.