Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @throws MissingHostException If a relative path is queued for purge/
  *                              refresh and no base URL is set
  *
  */
 protected function queueRequest($method, $url, array $headers = [])
 {
     $request = new InvalidationRequest($method, $url, $headers);
     if (self::HTTP_METHOD_BAN !== $method && !$this->baseUriSet && !$request->getHeaderLine('Host')) {
         throw MissingHostException::missingHost($url);
     }
     parent::queueRequest($method, $url, $headers);
 }
Ejemplo n.º 2
0
    /**
     * {@inheritdoc}
     *
     * @throws MissingHostException If a relative path is queued for purge/
     *                              refresh and no base URL is set
     *
     */
    protected function createRequest($method, $url, array $headers = array())
    {
        $request = parent::createRequest($method, $url, $headers);

        // For purge and refresh, add a host header to the request if it hasn't
        // been set
        if (self::HTTP_METHOD_BAN !== $method
            && '' == $request->getHeader('Host')
        ) {
            throw MissingHostException::missingHost($url);
        }

        return $request;
    }
Ejemplo n.º 3
0
 /**
  * Build the invalidation request and validate it.
  *
  * {@inheritdoc}
  *
  * @throws MissingHostException If a relative path is queued for purge/
  *                              refresh and no base URL is set
  */
 protected function queueRequest($method, $url, array $headers = [])
 {
     $request = $this->messageFactory->createRequest($method, $url, $headers);
     if (self::HTTP_METHOD_BAN !== $method && null === $this->options['base_uri'] && !$request->getHeaderLine('Host')) {
         throw MissingHostException::missingHost($url);
     }
     $this->httpAdapter->invalidate($request);
 }