public static function HeaderSecurity::assertValidName in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-diactoros/src/HeaderSecurity.php \Zend\Diactoros\HeaderSecurity::assertValidName()
Assert whether or not a header name is valid.
Parameters
mixed $name:
Throws
InvalidArgumentException
See also
http://tools.ietf.org/html/rfc7230#section-3.2
4 calls to HeaderSecurity::assertValidName()
- MessageTrait::withAddedHeader in vendor/
zendframework/ zend-diactoros/ src/ MessageTrait.php - Return an instance with the specified header appended with the given value.
- MessageTrait::withHeader in vendor/
zendframework/ zend-diactoros/ src/ MessageTrait.php - Return an instance with the provided header, replacing any existing values of any headers with the same case-insensitive name.
- RequestTrait::assertHeaders in vendor/
zendframework/ zend-diactoros/ src/ RequestTrait.php - Ensure header names and values are valid.
- Response::assertHeaders in vendor/
zendframework/ zend-diactoros/ src/ Response.php - Ensure header names and values are valid.
File
- vendor/
zendframework/ zend-diactoros/ src/ HeaderSecurity.php, line 143
Class
- HeaderSecurity
- Provide security tools around HTTP headers to prevent common injection vectors.
Namespace
Zend\DiactorosCode
public static function assertValidName($name) {
if (!preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $name)) {
throw new InvalidArgumentException('Invalid header name');
}
}