Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SanitizeCombinedHeadersPropagationGetter.php

class SanitizeCombinedHeadersPropagationGetter

Some servers concatenate multiple headers with ';' -- we need to replace these with ',' This is still a workaround and doesn't get around the problem fully, specifically it doesn't handle edge cases where the header has a trailing ';' or an empty trace state. We also need to trim trailing separators from the header, found when a header is empty.

Hierarchy

  • class \OpenTelemetry\Context\Propagation\SanitizeCombinedHeadersPropagationGetter implements \OpenTelemetry\Context\Propagation\PropagationGetterInterface

Expanded class hierarchy of SanitizeCombinedHeadersPropagationGetter

File

vendor/open-telemetry/context/Propagation/SanitizeCombinedHeadersPropagationGetter.php, line 15

Namespace

OpenTelemetry\Context\Propagation
View source
final class SanitizeCombinedHeadersPropagationGetter implements PropagationGetterInterface {
    private const LIST_MEMBERS_SEPARATOR = ',';
    private const SERVER_CONCAT_HEADERS_REGEX = '/;(?=[^,=;]*=|$)/';
    private const TRAILING_LEADING_SEPARATOR_REGEX = '/^' . self::LIST_MEMBERS_SEPARATOR . '+|' . self::LIST_MEMBERS_SEPARATOR . '+$/';
    public function __construct(PropagationGetterInterface $getter) {
    }
    public function keys($carrier) : array {
        return $this->getter
            ->keys($carrier);
    }
    public function get($carrier, string $key) : ?string {
        $value = $this->getter
            ->get($carrier, $key);
        if ($value === null) {
            return null;
        }
        return preg_replace([
            self::SERVER_CONCAT_HEADERS_REGEX,
            self::TRAILING_LEADING_SEPARATOR_REGEX,
        ], [
            self::LIST_MEMBERS_SEPARATOR,
        ], $value);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
SanitizeCombinedHeadersPropagationGetter::get public function Gets the value of a given key from a carrier. Overrides PropagationGetterInterface::get
SanitizeCombinedHeadersPropagationGetter::keys public function Returns the list of all the keys in the carrier. Overrides PropagationGetterInterface::keys
SanitizeCombinedHeadersPropagationGetter::LIST_MEMBERS_SEPARATOR private constant
SanitizeCombinedHeadersPropagationGetter::SERVER_CONCAT_HEADERS_REGEX private constant
SanitizeCombinedHeadersPropagationGetter::TRAILING_LEADING_SEPARATOR_REGEX private constant
SanitizeCombinedHeadersPropagationGetter::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal