Skip to content

InfluxDbHttpSender encodes auth string with newline symbol in the end #80

Open
@e-vrvr

Description

@e-vrvr

I'm trying to add authorization to my http(s) reporter, so I set config entry to auth: user:password.
Later, here it gets encrypted to dXNlcjpwYXNzd29yZA==\r\n -note the newline symbols in the end. And then during connection construction, it fails with Illegal character(s) in message header field here .

Full stack trace:

java.lang.IllegalArgumentException: Illegal character(s) in message header value: Basic dXNlcjpwYXNzd29yZA==(newline symbol)

	at sun.net.www.protocol.http.HttpURLConnection.checkMessageHeader(HttpURLConnection.java:507)
	at sun.net.www.protocol.http.HttpURLConnection.isExternalMessageHeaderAllowed(HttpURLConnection.java:459)
	at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:3017)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestProperty(HttpsURLConnectionImpl.java:316)
	at com.izettle.metrics.influxdb.InfluxDbHttpSender.writeData(InfluxDbHttpSender.java:68)
	at com.izettle.metrics.influxdb.InfluxDbBaseSender.writeData(InfluxDbBaseSender.java:46)
	at com.izettle.metrics.influxdb.InfluxDbHttpSender.writeData(InfluxDbHttpSender.java:15)
	at com.izettle.metrics.influxdb.InfluxDbReporter.report(InfluxDbReporter.java:240)
	at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162)
	at com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Sample config

metrics:
  frequency: 1m
  reporters:
    - type: influxdb
      protocol: https
      host: influxdb.example.com
      port: 443
      database: test

Is there any way to make this working?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions