From e06dd1fa8cf5982a4a6d0506c7f06592f82f0350 Mon Sep 17 00:00:00 2001 From: fenric Date: Fri, 7 Dec 2018 05:09:09 +0300 Subject: [PATCH] New constants for a header parts validation --- src/HeaderInterface.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/HeaderInterface.php b/src/HeaderInterface.php index 362e87e..b9a4638 100644 --- a/src/HeaderInterface.php +++ b/src/HeaderInterface.php @@ -22,6 +22,27 @@ interface HeaderInterface { + /** + * Regular Expression for a token validation + * + * @link https://tools.ietf.org/html/rfc7230#section-3.2 + */ + public const RFC7230_TOKEN = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]+$/'; + + /** + * Regular Expression for a field-value validation + * + * @link https://tools.ietf.org/html/rfc7230#section-3.2 + */ + public const RFC7230_FIELD_VALUE = '/^[\x09\x20-\x7E\x80-\xFF]*$/'; + + /** + * Regular Expression for a quoted-string validation + * + * @link https://tools.ietf.org/html/rfc7230#section-3.2 + */ + public const RFC7230_QUOTED_STRING = '/^[\x09\x20\x21\x23-\x5B\x5D-\x7E\x80-\xFF]*$/'; + /** * Gets the header field-name *