Пример #1
0
 /**
  * @dataProvider headersWithInjectionVectorsDataProvider
  * @test
  */
 public function doesNotAllowCRLFInjectionWhenCallingWithAddedHeader($name, $value)
 {
     $this->setExpectedException('InvalidArgumentException');
     $this->message->withAddedHeader($name, $value);
 }
Пример #2
0
 /**
  * Retrieves a message header value by the given case-insensitive name.
  *
  * This method returns an array of all the header values of the given
  * case-insensitive header name.
  *
  * If the header does not appear in the message, this method MUST return an
  * empty array.
  *
  * @param string $name Case-insensitive header field name.
  * @return string[] An array of string values as provided for the given
  *    header. If the header does not appear in the message, this method MUST
  *    return an empty array.
  */
 public function getHeader($header)
 {
     if (!$this->hasHeader($header) && strtolower($header) === 'host' && ($this->uri && $this->uri->getHost())) {
         return [$this->getHostFromUri()];
     }
     return parent::getHeader($header);
 }
Пример #3
0
 /**
  * @test
  */
 public function testWithAddedHeaderAllowsHeaderContinuations()
 {
     $message = $this->message->withAddedHeader('X-Foo-Bar', "value,\r\n second value");
     $this->assertEquals("value,\r\n second value", $message->getHeaderLine('X-Foo-Bar'));
 }