CFLib.org – Common Function Library Project

GetSecureURL([domain][, path][, queryString][, port])

Last updated May 9, 2009

author

Jon Hartmann

Version: 0 | Requires: CF5 | Library: StrLib

Description:
This function takes cgi information and creates a URL for an https to the current page. Each section can be overridden to allow it to create URLS for other locations.

Return Values:
Returns a string

Example:

<cfdump var="#GetSecureURL()#">

Parameters:

Name Description Required
domain url to secure No
path page to secure No
queryString queryString for page No
port additional port to use in url No

Full UDF Source:

<!---
 Creates an HTTPS URL for the current page, or for given page information.
 
 @param domain 	 url to secure (Optional)
 @param path 	 page to secure (Optional)
 @param queryString 	 queryString for page (Optional)
 @param port 	 additional port to use in url (Optional)
 @return Returns a string 
 @author Jon Hartmann (jon.hartmann@gmail.com) 
 @version 0, May 9, 2009 
--->
<cffunction name="GetSecureURL" output="false" returntype="string">
	<cfargument name="domain" typ="string" required="false" default="#cgi.server_name#" />
	<cfargument name="path" typ="string" required="false" default="#cgi.script_name#" />
	<cfargument name="queryString" typ="string" required="false" default="#cgi.query_string#" />
	<cfargument name="port" typ="string" required="false" default="#cgi.server_port#" />
	
	<cfset var HTTPSURL = "https://" & arguments.domain />
	
	<cfif IsNumeric(arguments.port)>
		<cfset HTTPSURL = HTTPSURL & ":" & arguments.port />
	</cfif>
	
	<cfset HTTPSURL = HTTPSURL & arguments.path />
	
	<cfif Len(arguments.queryString)>
		<cfset HTTPSURL = HTTPSURL & "?" & arguments.queryString />
	</cfif>
	
	<cfreturn HTTPSURL />
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson