protected function buildAuthorityStr()
    {
        if ($this->host != null) {
            $authority = '//';
            if ($this->userInfo != null) {
                $authority .= $this->userInfo . '@';
            }
            $flag = (strpos($this->host, ':') !== false) && !(substr($this->host, 0,
                        1) == '[') && !(substr($this->host, -1) == ']');
            if ($flag) {
                $authority .= '[';
            }
            $authority .= $this->host;
            if ($flag) {
                $authority .= ']';
            }
            if ($this->port != null) {
                $authority .= ':' . $this->port;
            }
            return $authority;
        } else {
            if ($this->scheme) {
                return '//' . $this->authority;
            } else {
                return $this->authority;
            }
        }
    }