Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decode URL-encoded headers in environment vars
The [opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables) wants `OTEL_EXPORTER_OTLP_HEADERS` to conform to the [Baggage HTTP Header Format](https://github.com/w3c/baggage/blob/main/baggage/HTTP_HEADER_FORMAT.md). To effectively use the headers from `OTEL_EXPORTER_OTLP_HEADERS` for things like authentication (a common use case) the values need to be decoded. Given a header like this: ``` export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic base64" ``` The code prior to this commit would reject the header for containing whitespace mid-value. If the header is modified to this: ``` export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic%20base64" ``` The code prior to this commit would send the header as `Authorization: Basic%20base64`, which will be rejected upstream. This change applies `urllib.parse.unquote` to header **names** and **values**, based on precedent set by the following libraries: - [opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go) - [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js) - [opentelemetry-ruby](https://github.com/open-telemetry/opentelemetry-ruby)
- Loading branch information