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

Breadcrumb

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

function MessageTrait::assertValue

field-value = *( field-content / obs-fold ) field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] field-vchar = VCHAR / obs-text VCHAR = %x21-7E obs-text = %x80-FF obs-fold = CRLF 1*( SP / HTAB )

See also

https://datatracker.ietf.org/doc/html/rfc7230#section-3.2

1 call to MessageTrait::assertValue()
MessageTrait::trimAndValidateHeaderValues in vendor/guzzlehttp/psr7/src/MessageTrait.php
Trims whitespace from the header values.

File

vendor/guzzlehttp/psr7/src/MessageTrait.php, line 246

Class

MessageTrait
Trait implementing functionality common to requests and responses.

Namespace

GuzzleHttp\Psr7

Code

private function assertValue(string $value) : void {
    // The regular expression intentionally does not support the obs-fold production, because as
    // per RFC 7230#3.2.4:
    //
    // A sender MUST NOT generate a message that includes
    // line folding (i.e., that has any field-value that contains a match to
    // the obs-fold rule) unless the message is intended for packaging
    // within the message/http media type.
    //
    // Clients must not send a request with line folding and a server sending folded headers is
    // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting
    // folding is not likely to break any legitimate use case.
    if (!preg_match('/^[\\x20\\x09\\x21-\\x7E\\x80-\\xFF]*$/D', $value)) {
        throw new \InvalidArgumentException(sprintf('"%s" is not valid header value.', $value));
    }
}

API Navigation

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