<commit_before><!---
	/**
	* OWASP Enterprise Security API (ESAPI)
	* 
	* This file is part of the Open Web Application Security Project (OWASP)
	* Enterprise Security API (ESAPI) project. For details, please see
	* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
	*
	* Copyright (c) 2011 - The OWASP Foundation
	* 
	* The ESAPI is published by OWASP under the BSD license. You should read and accept the
	* LICENSE before you use, modify, and/or redistribute this software.
	* 
	* @author <NAME>
	* @created 2011
	*/
	--->
<!--- Declare ESAPI convenience function for persistence, i.e. ESAPI() --->

<cffunction access="private" returntype="cfesapi.org.owasp.esapi.ESAPI" name="ESAPI" output="false" hint="Your one stop shop to access all things ESAPI. This function takes care of instantiating ESAPI the first time and persisting ESAPI for subsequent use.">
	<cfscript>
		if (!structKeyExists(application, "ESAPI") || !isInstanceOf(application["ESAPI"], "cfesapi.org.owasp.esapi.ESAPI")) {
			lock scope="application" type="exclusive" timeout="1" {
				if (!structKeyExists(application, "ESAPI") || !isInstanceOf(application["ESAPI"], "cfesapi.org.owasp.esapi.ESAPI")) {
					application["ESAPI"] = createObject("component", "cfesapi.org.owasp.esapi.ESAPI");
				}
			}
		}
		return application["ESAPI"];
	</cfscript> 
</cffunction>

<cfscript>
	/* Configure ESAPI */

	// ensure every request sets the HTTP request and response objects
	ESAPI().httpUtilities().setCurrentHTTP(getPageContext().getRequest(), getPageContext().getResponse());

	// set up response with default content type, i.e. text/html; charset=UTF-8
	// NOTE: you can override per request by using ESAPI().httpUtilities().getCurrentResponse().setContentType("text/json; charset=UTF-8");
	ESAPI().httpUtilities().setContentType();

	// is there anything we should always configure per request?
</cfscript> 
<!--- ESAPI helper methods --->

<cffunction access="private" returntype="String" name="encodeForBase64" output="false" hint="Base64 encode a string. UTF-8 is used to encode the string and no line wrapping is performed.">
	<cfargument type="String" name="str" required="true" hint="The string to encode.">
	<cfscript>
		return encodeForBase64Charset("UTF-8", arguments.str);
	</cfscript> 
</cffunction>


<cffunction access="private" returntype="String" name="encodeForBase64Wrap" output="false" hint="Base64 encode a string with line wrapping. UTF-8 is used to encode the string and lines are wrapped at 64 characters..">
	<cfargument type="String" name="str" required="true" hint="The string to encode.">
	<cfscript>
		return encodeForBase64CharsetWrap("UTF-8", arguments.str);
	</cfscript> 
</cffunction>


<cffunction access="private" returntype="String" name="encodeForBase64Charset" output="false" hint="Base64 encode a string after converting to bytes using the specified character set. No line wrapping is performed.">
	<cfargument type="String" name="charset" required="true" hint="The character set used to convert str to bytes.">
	<cfargument type="String" name="str" required="true" hint="The string to encode."><commit_msg>Removed code now handled by Filter<commit_after><!---
	/**
	* OWASP Enterprise Security API (ESAPI)
	* 
	* This file is part of the Open Web Application Security Project (OWASP)
	* Enterprise Security API (ESAPI) project. For details, please see
	* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
	*
	* Copyright (c) 2011 - The OWASP Foundation
	* 
	* The ESAPI is published by OWASP under the BSD license. You should read and accept the
	* LICENSE before you use, modify, and/or redistribute this software.
	* 
	* @author <NAME>
	* @created 2011
	*/
	--->
<!--- Declare ESAPI convenience function for persistence, i.e. ESAPI() --->

<cffunction access="private" returntype="cfesapi.org.owasp.esapi.ESAPI" name="ESAPI" output="false" hint="Your one stop shop to access all things ESAPI. This function takes care of instantiating ESAPI the first time and persisting ESAPI for subsequent use.">
	<cfscript>
		if (!structKeyExists(application, "ESAPI") || !isInstanceOf(application["ESAPI"], "cfesapi.org.owasp.esapi.ESAPI")) {
			lock scope="application" type="exclusive" timeout="1" {
				if (!structKeyExists(application, "ESAPI") || !isInstanceOf(application["ESAPI"], "cfesapi.org.owasp.esapi.ESAPI")) {
					application["ESAPI"] = createObject("component", "cfesapi.org.owasp.esapi.ESAPI");
				}
			}
		}
		return application["ESAPI"];
	</cfscript> 
</cffunction>

<!--- ESAPI helper methods --->

<cffunction access="private" returntype="String" name="encodeForBase64" output="false" hint="Base64 encode a string. UTF-8 is used to encode the string and no line wrapping is performed.">
	<cfargument type="String" name="str" required="true" hint="The string to encode.">
	<cfscript>
		return encodeForBase64Charset("UTF-8", arguments.str);
	</cfscript> 
</cffunction>


<cffunction access="private" returntype="String" name="encodeForBase64Wrap" output="false" hint="Base64 encode a string with line wrapping. UTF-8 is used to encode the string and lines are wrapped at 64 characters..">
	<cfargument type="String" name="str" required="true" hint="The string to encode.">
	<cfscript>
		return encodeForBase64CharsetWrap("UTF-8", arguments.str);
	</cfscript> 
</cffunction>


<cffunction access="private" returntype="String" name="encodeForBase64Charset" output="false" hint="Base64 encode a string after converting to bytes using the specified character set. No line wrapping is performed.">
	<cfargument type="String" name="charset" required="true" hint="The character set used to convert str to bytes.">
	<cfargument type="String" name="str" required="true" hint="The string to encode.">
{'fraction_non_alphanumeric': 0.13908085694540429, 'fraction_numerical': 0.0110573600552868, 'mean_word_length': 5.087276550998949, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6465027', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1739, 'n_words': 544}