generate base URL
163431
protected function generateUrl($urlpath)
    {
        $baseUrl = $this->sc->get('request')->getUri()->getBasePath();
//        $baseUrl = trim($baseUrl, '/');
//        $urlpath = trim($urlpath, '/');
        return $baseUrl . $urlpath;
    }
976975
protected function baseUrl()
    {
        $path       = dirname($_SERVER['SCRIPT_NAME']);
        $path       = trim($path, '/');
        $baseUrl    = Request::getUrl();
        $baseUrl    = trim($baseUrl, '/');
        return $baseUrl.'/'.$path.( $path ? '/' : '' );
    }
1063852
def base_url(self):
        ''''''
        config_value = self.config.get('url')
        if config_value:
            return self._clean_url(config_value)
        default_url = current_app.config.get('FS_URL')
        default_url = current_app.config.get('{0}URL'.format(self.backend_prefix), default_url)
        if default_url:
            url = urljoin(default_url, self.name)
            return self._clean_url(url)
        return url_for('fs.get_file', fs=self.name, filename='', _external=True)
1334781
def base_url(self, url):
        """"""
        parts = list(self.parse_url(url))
        parts[4:] = ['' for i in parts[4:]]
        return urlunparse(parts)
559252
def _buildUrl(self):
		""""""
		return '%(protocol)s://%(host)s:%(port)s%(address)s'%{
			'protocol': self._protocol,
			'host': self._host,
			'port': self._port,
			'address': self._address,
		}
474284
public function addBaseUrlScript()
    {
        // Add base Url and absolute base Url to the head
        $arrJsPosHEad = empty($this->js[static::POS_HEAD]) ? [] : $this->js[static::POS_HEAD];
        array_unshift($arrJsPosHEad,
            "var absoluteBaseUrl = \"" . Yii::$app->urlManager->createAbsoluteUrl('site/index') . "\";");
        array_unshift($arrJsPosHEad, "var baseUrl = \"" . Yii::$app->urlManager->baseUrl . "\";");
        $this->js[static::POS_HEAD] = $arrJsPosHEad;
    }
583536
function Base (source, layer, options) {
  options = options || {};
  this._id = options.id || Base.$generateId();
}
1153560
def to_url(self):
        """"""
        base_url = urlparse(self.url)

        if PY3:
            query = parse_qs(base_url.query)
            for k, v in self.items():
                query.setdefault(k, []).append(to_utf8_optional_iterator(v))
            scheme = base_url.scheme
            netloc = base_url.netloc
            path = base_url.path
            params = base_url.params
            fragment = base_url.fragment
        else:
            query = parse_qs(to_utf8(base_url.query))
            for k, v in self.items():
                query.setdefault(to_utf8(k), []).append(to_utf8_optional_iterator(v))
            scheme = to_utf8(base_url.scheme)
            netloc = to_utf8(base_url.netloc)
            path = to_utf8(base_url.path)
            params = to_utf8(base_url.params)
            fragment = to_utf8(base_url.fragment)

        url = (scheme, netloc, path, params, urlencode(query, True), fragment)
        return urlunparse(url)
538621
function buildPath (basePath, queryParams) {
    basePath = basePath.concat('?')
    var url = basePath.concat(queryString.stringify(queryParams))
    return url
  }
746296
protected function getBaseUrl() {
        $str_base_url = $this->obj_http_client->getConfig(self::CONFIG_CLIENT_BASE_URL);
        if (!empty($str_base_url)) {
            return $str_base_url;
        }

        return self::DEFAULT_BASE_URL;
    }
277405
function baseRequest(uri, cb) {
  var url = `${BASE_URL}${uri}`;
  request(url, function (error, response, body) {
    debug(`Url: ${url} statusCode: ${response && response.statusCode}`);
    if(error || (response && response.statusCode === 404)) {
       cb(error || response);
    }
    cb(null, JSON.parse(body));
  });
}
518207
def base_url(klass, space_id, resource_id=None, public=False, environment_id=None, **kwargs):
        

        if public:
            environment_slug = ""
            if environment_id is not None:
                environment_slug = "/environments/{0}".format(environment_id)
            return "spaces/{0}{1}/public/content_types".format(space_id, environment_slug)
        return super(ContentType, klass).base_url(
            space_id,
            resource_id=resource_id,
            environment_id=environment_id,
            **kwargs
        )
826405
def get_base_url(url, include_path=False):
    

    if not url:
        return None

    parts = _urlsplit(url)
    base_url = _urlunsplit((
        parts.scheme, parts.netloc, (parts.path if include_path else ''), None, None
    ))

    return base_url if base_url.endswith('/') else base_url + '/'
586528
def matching_base_url(self, url):
        

        n = len(self.baseurl)
        return url[0:n] == self.baseurl
103998
def base_url(root):
    """"""
    for attr, value in root.attrib.iteritems():
        if attr.endswith('base') and 'http' in value:
            return value
    return None
1201002
private function getBaseUrl() {
        $uri = $this->getRequest()->getUri();
        return sprintf('%s://%s', $uri->getScheme(), $uri->getHost());
    }
1316213
function regenerateLink(base, link) {
  const parsedBase = (0, _url.parse)(base);
  const parsedLink = link.split("/");
  let parts = [];
  let port = "";

  if (!link.startsWith("/")) {
    parts = parsedBase.pathname.split("/");
    parts.pop();
  }

  for (const part of parsedLink) {
    // Current directory:
    if (part === ".") {
      continue;
    } // Parent directory:


    if (part === "..") {
      // Accessing non-existing parent directories:
      if (!parts.pop() || parts.length === 0) {
        return null;
      }
    } else {
      parts.push(part);
    }
  }

  if (parsedBase.port) {
    port = ":" + parsedBase.port;
  } // eslint-disable-next-line max-len


  return `${parsedBase.protocol}//${parsedBase.hostname}${port}${parts.join("/")}`;
}