code/dispatcher/request/abstract.php
public function getOrigin($isInternal = true)
    {
        $origin = null;

        if ($this->_headers->has('Origin'))
        {
            try {
                $origin = $this->getObject('lib:http.url', [
                    'url' => $this->getObject('lib:filter.url')->sanitize($this->_headers->get('Origin'))
                ]);

                if($isInternal)
                {
                    $target_origin = $this->getUrl()->getHost();
                    $source_origin = $origin->getHost();

                    // Check if the source matches the target
                    if($target_origin !== $source_origin)
                    {
                        // Special case: check if the source is a subdomain of the target origin
                        if ('.'.$target_origin !== substr($source_origin, -1 * (strlen($target_origin)+1))) {
                            $origin = null;
                        }
                    }
                }
            }
            catch (\UnexpectedValueException $e) {}
        }

        return $origin;
    }
public function getOrigin($isInternal = true)
    {
        $origin = null;

        if ($this->_headers->has('Origin'))
        {
            try {
                $origin = $this->getObject('lib:http.url', [
                    'url' => $this->getObject('lib:filter.url')->sanitize($this->_headers->get('Origin'))
                ]);

                if($isInternal)
                {
                    $target_origin = $this->getUrl()->getHost();
                    $source_origin = $origin->getHost();

                    // Check if the source matches the target
                    if($target_origin !== $source_origin)
                    {
                        // Special case: check if the source is a subdomain of the target origin
                        if ('.'.$target_origin !== substr($source_origin, -1 * (strlen($target_origin)+1))) {
                            $origin = null;
                        }
                    }
                }
            }
            catch (\UnexpectedValueException $e) {}
        }

        return $origin;
    }
public function getOrigin ( $ isInternal = true ) { $ origin = null ; if ( $ this -> _headers -> has ( 'Origin' ) ) { try { $ origin = $ this -> getObject ( 'lib:http.url' , [ 'url' => $ this -> getObject ( 'lib:filter.url' ) -> sanitize ( $ this -> _headers -> get ( 'Origin' ) ) ] ) ; if ( $ isInternal ) { $ target_origin = $ this -> getUrl ( ) -> getHost ( ) ; $ source_origin = $ origin -> getHost ( ) ; // Check if the source matches the target if ( $ target_origin !== $ source_origin ) { // Special case: check if the source is a subdomain of the target origin if ( '.' . $ target_origin !== substr ( $ source_origin , - 1 * ( strlen ( $ target_origin ) + 1 ) ) ) { $ origin = null ; } } } } catch ( \ UnexpectedValueException $ e ) { } } return $ origin ; }
Returns the HTTP origin header.

@param   boolean  $isInternal Only allow internal URLs
@return  HttpUrl|null  A HttpUrl object or NULL if no origin header could be found
Returns the HTTP origin header .