Get the proper http URL prefix depending on if this was a secure page request or not
485950
public function getCssFiles()
	{
		//$return = array();
		//$return = $this->cssFiles;
		$return = '';		
		//print_r($this->cssFiles);
		if(!empty($this->cssFiles)) {
			foreach($this->cssFiles as $key=>$val) {
				if((is_string($key)) || is_array($val))
					if($key == $row)
						$cssFile = $this->getProtocol()."://".Yii::app()->request->serverName.$key;
					$return .= '@import url("'.$cssFile.'");';
			}
		}
		
		//$return = $this->coreScripts;
		//print_r($this->coreScripts);
		if(!empty($this->coreScripts)) {
			foreach($this->coreScripts as $key=>$val) {
				if((is_string($key) && $key != 'jquery') && is_array($val)) {
				//if((is_string($key)) && is_array($val))
					if($val['css'] != null && $val['baseUrl'] != null)
						$cssFile = $this->getProtocol()."://".Yii::app()->request->serverName.$val['baseUrl'].'/'.$val['css'][0];
					$return .= '@import url("'.$cssFile.'");';
				}
			}
		}
		return $return;
	}
1171632
def _get_base_url(request):
    
    if request.is_secure():
        base_url = 'https://%s'
    else:
        base_url = 'http://%s'
    base_url %= request.META['HTTP_HOST']
    return base_url
341508
def sanitize_http_request_querystring(client, event):
    
    try:
        query_string = force_text(event["context"]["request"]["url"]["search"], errors="replace")
    except (KeyError, TypeError):
        return event
    if "=" in query_string:
        sanitized_query_string = _sanitize_string(query_string, "&", "=")
        full_url = event["context"]["request"]["url"]["full"]
        event["context"]["request"]["url"]["search"] = sanitized_query_string
        event["context"]["request"]["url"]["full"] = full_url.replace(query_string, sanitized_query_string)
    return event
542107
def get_base_url(use_ssl, instance=None, host=None):
        

        if instance is not None:
            host = ("%s.service-now.com" % instance).rstrip('/')

        if use_ssl is True:
            return "https://%s" % host

        return "http://%s" % host
456917
def safe_url(self):
        
        ret = str(self.endpoint_url)
        if self.params:
            ret += '?' + '&'.join(
                ['%s=%s' % (k, [v, '[%s]' % k.upper()][
                    k in ['A', 'token', 'password', 'session']]) for k, v in
                 self.params.items()])
        return ret
34966
def cache_key_prefix(request):
    
    cache_key = "%s.%s.%s." % (
        settings.CACHE_MIDDLEWARE_KEY_PREFIX,
        current_site_id(),
        device_from_request(request) or "default",
    )
    return _i18n_cache_key_suffix(request, cache_key)
1134191
def check_uri_security(uri):
    """"""
    if urlparse(uri).scheme != 'https':
        warning_message = (
            'WARNING: this client is sending a request to an insecure'
            ' API endpoint. Any API request you make may expose your API key and'
            ' secret to third parties. Consider using the default endpoint:\n\n'
            '  %s\n') % uri
        warnings.warn(warning_message, UserWarning)
    return uri
71670
function getUrlParameter(sPageURL) {
    var url = sPageURL.split('?');
    var obj = {};
    if (url.length == 2) {
      var sURLVariables = url[1].split('&'),
          sParameterName,
          i;
      for (i = 0; i < sURLVariables.length; i++) {
          sParameterName = sURLVariables[i].split('=');
          obj[sParameterName[0]] = sParameterName[1];
      }
      return obj;
    } else {
      return undefined;
    }
}
276042
function getFingerprintForURL(url) {
	var domain = getDomain(url);
	var found = global.requestSSLFingerprints[domain];
	debug('getFingerprintForURL %s -> %s=%s',url,domain,found);
	if (!found) {
		// try a wildcard search
		var u = urlib.parse(domain),
			tokens = (u && u.host || domain).split('.');
		domain = '*.'+tokens.splice(tokens.length > 1 ? 0 : 1).join('.');
		found = global.requestSSLFingerprints[domain];
		debug('getFingerprintForURL (wildcard) %s -> %s=%s',url,domain,found);
	}
	return found;
}
457708
protected static function getRequestUrl()
    {
        $hostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null);

        if(isset($hostname))
        {
            $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';

            if(!isset($_SERVER['REQUEST_URI']))
            {
                if(isset($_SERVER['QUERY_STRING']))
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
                }
                else
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'];
                }
            }
            else
            {
                return $protocol . '://' . $hostname . $_SERVER['REQUEST_URI'];
            }
        }
        else
        {
            return null;
        }
    }
130799
protected function checkGetRequest($page)
    {
        $this->url .= $this->explodeRequestGetValue();

        if( strstr($this->url, '?') )
        {
            $urlEx = explode('?', $this->url);

            return Base::suffix($urlEx[0]) . $page . '?' . rtrim($urlEx[1], '/');
        }

        return $this->type === 'ajax' ? $this->url : Base::suffix($this->url) . $page;
    }
557440
function getURLFromRequest(request) {
	const queryString = makeQueryString(request.query || {});
	let formatted = request.route;
	let value;
	let regexp;

	// Replace route params with their values. If the route param is specified
	// with an extension (e.g., ':id.json'), keep the extension.
	Object.keys(request.params || {}).forEach((name) => {
		value = request.params[name];
		regexp = new RegExp(':' + name + '(?=(?:\\.|\\/|$|\\?))');
		formatted = formatted.replace(regexp, value);
	});

	return formatted + (queryString ? '?' + queryString : '');
}
1239402
private static function unsigned_download_url_prefix(
        $source,
        $cloud_name,
        $private_cdn,
        $cdn_subdomain,
        $secure_cdn_subdomain,
        $cname,
        $secure,
        $secure_distribution
    ) {
        $shared_domain = !$private_cdn;
        $prefix = null;
        if ($secure) {
            if (empty($secure_distribution) || $secure_distribution == Cloudinary::OLD_AKAMAI_SHARED_CDN) {
                $secure_distribution = $private_cdn ? $cloud_name . '-res.cloudinary.com' : Cloudinary::SHARED_CDN;
            }

            if (empty($shared_domain)) {
                $shared_domain = ($secure_distribution == Cloudinary::SHARED_CDN);
            }

            if (is_null($secure_cdn_subdomain) && $shared_domain) {
                $secure_cdn_subdomain = $cdn_subdomain;
            }

            if ($secure_cdn_subdomain) {
                $secure_distribution = str_replace(
                    'res.cloudinary.com',
                    "res-" . Cloudinary::domain_shard($source) . ".cloudinary.com",
                    $secure_distribution
                );
            }

            $prefix = "https://".$secure_distribution;
        } else {
            if ($cname) {
                $subdomain = $cdn_subdomain ? "a" . Cloudinary::domain_shard($source) . '.' : "";
                $prefix = "http://" . $subdomain . $cname;
            } else {
                $host = implode(
                    array(
                        $private_cdn ? $cloud_name."-" : "",
                        "res",
                        $cdn_subdomain ? "-".Cloudinary::domain_shard($source) : "",
                        ".cloudinary.com",
                    )
                );
                $prefix = "http://".$host;
            }
        }
        if ($shared_domain) {
            $prefix = $prefix . '/' . $cloud_name;
        }

        return $prefix;
    }
177611
function getRequestUri() {
    if (isset($_SERVER['REQUEST_URI'])) {
      $uri = $_SERVER['REQUEST_URI'];
    }
    else {
      if (isset($_SERVER['argv'])) {
        $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
      }
      elseif (isset($_SERVER['QUERY_STRING'])) {
        $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
      }
      else {
        $uri = $_SERVER['SCRIPT_NAME'];
      }
    }
    // Prevent multiple slashes to avoid cross site requests via the Form API.
    $uri = '/' . ltrim($uri, '/');

    return $uri;
  }
789394
def rewrite_to_secure_url(url, secure_base=None):
    
    if secure_base is None:
        secure_base = cfg.get('CFG_SITE_SECURE_URL')
    url_parts = list(urlparse(url))
    url_secure_parts = urlparse(secure_base)
    url_parts[0] = url_secure_parts[0]
    url_parts[1] = url_secure_parts[1]
    return urlunparse(url_parts)
433036
function current_page_url() {
            $url = 'http';

            if ( isset( $_SERVER["HTTPS"] ) ) {
                if ( $_SERVER["HTTPS"] == "on" ) {
                    $url .= "s";
                }
            }
            $url .= "://";
            if ( $_SERVER["SERVER_PORT"] != "80" ) {
                $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
            } else {
                $url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
            }

            return esc_url( $url );
        }
150277
protected function getHttpProtocol()
    {
        if ($this->trustForwarded && isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
            if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
                return 'https';
            }

            return 'http';
        }

        /*apache + variants specific way of checking for https*/
        if (isset($_SERVER['HTTPS']) &&
            ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)) {
            return 'https';
        }

        /*nginx way of checking for https*/
        if (isset($_SERVER['SERVER_PORT']) &&
            ($_SERVER['SERVER_PORT'] === '443')) {
            return 'https';
        }

        return 'http';
    }