// ExcludeURL adds a new URL u to be ignored during logging. The URL u is parsed, hence the returned error
426705
func (m *Middleware) ExcludeURL(u string) error {
	if _, err := url.Parse(u); err != nil {
		return err
	}
	m.excludeURLs = append(m.excludeURLs, u)
	return nil
}
925918
func prepUrl(str string) (*url.URL, error) {
	u, err := url.Parse(str)
	if err != nil {
		return nil, err
	}
	u.Scheme = "google"

	// Discard the query string
	u.RawQuery = ""
	return u, nil
}
195876
func (u *User) GetURL() string {
	if u == nil || u.URL == nil {
		return ""
	}
	return *u.URL
}
28791
func ExcludeIfs(selectorName, selectorParam string, inputIfAddrs IfAddrs) (IfAddrs, error) {
	var excludedIfs IfAddrs
	var err error

	switch strings.ToLower(selectorName) {
	case "address":
		_, excludedIfs, err = IfByAddress(selectorParam, inputIfAddrs)
	case "flag", "flags":
		_, excludedIfs, err = IfByFlag(selectorParam, inputIfAddrs)
	case "name":
		_, excludedIfs, err = IfByName(selectorParam, inputIfAddrs)
	case "network":
		_, excludedIfs, err = IfByNetwork(selectorParam, inputIfAddrs)
	case "port":
		_, excludedIfs, err = IfByPort(selectorParam, inputIfAddrs)
	case "rfc", "rfcs":
		_, excludedIfs, err = IfByRFCs(selectorParam, inputIfAddrs)
	case "size":
		_, excludedIfs, err = IfByMaskSize(selectorParam, inputIfAddrs)
	case "type":
		_, excludedIfs, err = IfByType(selectorParam, inputIfAddrs)
	default:
		return IfAddrs{}, fmt.Errorf("invalid exclude selector %q", selectorName)
	}

	if err != nil {
		return IfAddrs{}, err
	}

	return excludedIfs, nil
}
1282886
func (api *ProductInternetAPI) Exclude(key string) *ProductInternetAPI {
	api.exclude(key)
	return api
}
1259789
func (f *Force) qualifyUrl(url string) string {
	return fmt.Sprintf("%s/%s", f.Credentials.InstanceUrl, strings.TrimLeft(url, "/"))
}
704112
func (api *PublicPriceAPI) Exclude(key string) *PublicPriceAPI {
	api.exclude(key)
	return api
}
1335943
func exclude(path string) (GitIgnore, error) {
	// attempt to locate GIT_DIR
	_gitdir := os.Getenv("GIT_DIR")
	if _gitdir == "" {
		_gitdir = filepath.Join(path, ".git")
	}
	_info, _err := os.Stat(_gitdir)
	if _err != nil {
		if os.IsNotExist(_err) {
			return nil, nil
		} else {
			return nil, _err
		}
	} else if !_info.IsDir() {
		return nil, nil
	}

	// is there an info/exclude file within this directory?
	_file := filepath.Join(_gitdir, "info", "exclude")
	_, _err = os.Stat(_file)
	if _err != nil {
		if os.IsNotExist(_err) {
			return nil, nil
		} else {
			return nil, _err
		}
	}

	// attempt to load the exclude file
	return NewFromFile(_file)
}
1323671
func (ns *Namespace) SanitizeURL(a interface{}) (string, error) {
	s, err := cast.ToStringE(a)
	return helpers.SanitizeURL(s), err
}
1233470
func copyURL(i *url.URL) *url.URL {
	out := *i
	if i.User != nil {
		out.User = &(*i.User)
	}
	return &out
}
98340
func (api *GSLBAPI) Exclude(key string) *GSLBAPI {
	api.exclude(key)
	return api
}
854837
func (api *NoteAPI) Exclude(key string) *NoteAPI {
	api.exclude(key)
	return api
}
1255990
func (api *IPv6AddrAPI) Exclude(key string) *IPv6AddrAPI {
	api.exclude(key)
	return api
}
61945
func excludeForCompression(header http.Header, object string) bool {
	objStr := object
	contentType := header.Get("Content-Type")
	if globalIsCompressionEnabled {
		// We strictly disable compression for standard extensions/content-types (`compressed`).
		if hasStringSuffixInSlice(objStr, standardExcludeCompressExtensions) || hasPattern(standardExcludeCompressContentTypes, contentType) {
			return true
		}
		// Filter compression includes.
		if len(globalCompressExtensions) > 0 || len(globalCompressMimeTypes) > 0 {
			extensions := globalCompressExtensions
			mimeTypes := globalCompressMimeTypes
			if hasStringSuffixInSlice(objStr, extensions) || hasPattern(mimeTypes, contentType) {
				return false
			}
			return true
		}
		return false
	}
	return true
}
634756
func ClickableURL(in string) string {
	out, err := url.Parse(in)
	if err != nil {
		return in
	}
	host, port, err := net.SplitHostPort(out.Host)
	if err != nil {
		return in
	}
	ip := net.ParseIP(host)
	// if address is not an IP, unspecified, e.g. all interfaces 0.0.0.0 or multicast,
	// replace with localhost that is clickable
	if len(ip) == 0 || ip.IsUnspecified() || ip.IsMulticast() {
		out.Host = fmt.Sprintf("127.0.0.1:%v", port)
		return out.String()
	}
	return out.String()
}
46101
func ParseUrl(inUrl string) (*url.URL, error) {
	parsedUrl, err := url.Parse(inUrl)
	if err != nil {
		return nil, err
	}

	if parsedUrl.Host == "" || parsedUrl.Scheme == "" {
		return nil, fmt.Errorf("Empty Url is not allowed")
	}
	return parsedUrl, nil
}
521664
func CopyURL(u *url.URL) (ret *url.URL) {
	ret = new(url.URL)
	*ret = *u
	if u.User != nil {
		ret.User = new(url.Userinfo)
		*ret.User = *u.User
	}
	return
}