// SitemapAbsURL is a convenience method giving the absolute URL to the sitemap.
493755
func (s *SiteInfo) SitemapAbsURL() string {
	p := s.HomeAbsURL()
	if !strings.HasSuffix(p, "/") {
		p += "/"
	}
	p += s.s.siteCfg.sitemap.Filename
	return p
}
1135098
func (s *Stream) baseUrl() (url string) {
	url = fmt.Sprintf("%s/%s/%s", s.domainName, s.appName, s.StreamName)
	return
}
1201640
func (c *CommitsComparison) GetPermalinkURL() string {
	if c == nil || c.PermalinkURL == nil {
		return ""
	}
	return *c.PermalinkURL
}
1302129
func (conf *Config) APIURL() *url.URL {
	host := Configuration.Host
	if Configuration.Port != 80 && Configuration.Port != 443 {
		host += ":" + strconv.Itoa(int(Configuration.Port))
	}
	return &url.URL{
		Scheme: Configuration.Scheme,
		Host:   host,
	}
}
340344
func (sm *Sitemap) Add(url interface{}) *Sitemap {
	if sm.bldr == nil {
		sm.bldr = NewBuilderFile(sm.opts, sm.opts.Location())
	}

	err := sm.bldr.Add(url)
	if err != nil {
		if err.FullError() {
			sm.Finalize()
			return sm.Add(url)
		}
	}

	return sm
}
589176
func ValidateWebhookURL(fldPath *field.Path, URL string, forceHttps bool) field.ErrorList {
	var allErrors field.ErrorList
	const form = "; desired format: https://host[/path]"
	if u, err := url.Parse(URL); err != nil {
		allErrors = append(allErrors, field.Required(fldPath, "url must be a valid URL: "+err.Error()+form))
	} else {
		if forceHttps && u.Scheme != "https" {
			allErrors = append(allErrors, field.Invalid(fldPath, u.Scheme, "'https' is the only allowed URL scheme"+form))
		}
		if len(u.Host) == 0 {
			allErrors = append(allErrors, field.Invalid(fldPath, u.Host, "host must be provided"+form))
		}
		if u.User != nil {
			allErrors = append(allErrors, field.Invalid(fldPath, u.User.String(), "user information is not permitted in the URL"))
		}
		if len(u.Fragment) != 0 {
			allErrors = append(allErrors, field.Invalid(fldPath, u.Fragment, "fragments are not permitted in the URL"))
		}
		if len(u.RawQuery) != 0 {
			allErrors = append(allErrors, field.Invalid(fldPath, u.RawQuery, "query parameters are not permitted in the URL"))
		}
	}
	return allErrors
}
100919
func AbsoluteURL(req *goa.RequestData, relative string, config configuration) string {
	host := Host(req, config)
	return absoluteURLForHost(req, host, relative)
}
1131112
func (s *CreateApplicationRequest) SetHomePageUrl(v string) *CreateApplicationRequest {
	s.HomePageUrl = &v
	return s
}
721928
func baseURL(serverBaseURL, listenAddr string) (string, error) {
	backendURL, err := url.Parse(serverBaseURL)
	if err != nil {
		return "", fmt.Errorf("invalid baseURL %q: %v", serverBaseURL, err)
	}
	scheme := backendURL.Scheme
	host := backendURL.Host
	if netutil.HasPort(host) {
		host = host[:strings.LastIndex(host, ":")]
	}
	port := portMap[scheme]
	if netutil.HasPort(listenAddr) {
		port = listenAddr[strings.LastIndex(listenAddr, ":")+1:]
	}
	return fmt.Sprintf("%s://%s:%s/", scheme, host, port), nil
}
930823
func AbsoluteURLAsURL(req *http.Request, relative string) (*url.URL, error) {
	return url.Parse(AbsoluteURL(req, relative))
}
1217737
func (a *Application) CharmURL() (curl *charm.URL, force bool) {
	return a.doc.CharmURL, a.doc.ForceCharm
}
695710
func (u *DockerRegistryURL) baseURL(includeCredentials bool) string {
	if u.Scheme == "" || u.Host == "" {
		return ""
	}

	var result string
	if u.Userinfo != nil && includeCredentials {
		result = fmt.Sprintf("%s://%s@%s", u.Scheme, u.Userinfo, u.Host)
	} else {
		result = fmt.Sprintf("%s://%s", u.Scheme, u.Host)
	}

	if u.Port != "" {
		result = fmt.Sprintf("%s:%s", result, u.Port)
	}
	return result

}
219533
func (p *Page) GetHTMLURL() string {
	if p == nil || p.HTMLURL == nil {
		return ""
	}
	return *p.HTMLURL
}
1206579
func (r *requestVars) URLParam(pname string) string {
	return r.params.Get(pname)
}
23810
func (l PermalinkExpander) pageToPermalinkFilename(p Page, _ string) (string, error) {
	name := p.File().TranslationBaseName()
	if name == "index" {
		// Page bundles; the directory name will hopefully have a better name.
		dir := strings.TrimSuffix(p.File().Dir(), helpers.FilePathSeparator)
		_, name = filepath.Split(dir)
	}

	return l.ps.URLize(name), nil
}
1012153
func (ctx *context) URLParamEscape(name string) string {
	return DecodeQuery(ctx.URLParam(name))
}
1210704
func (p *PathSpec) PermalinkForBaseURL(link, baseURL string) string {
	link = strings.TrimPrefix(link, "/")
	if !strings.HasSuffix(baseURL, "/") {
		baseURL += "/"
	}
	return baseURL + link

}