<commit_before><?php
namespace wcf\util;
use wcf\system\application\ApplicationHandler;
use wcf\system\event\EventHandler;
use wcf\system\request\RequestHandler;
use wcf\system\request\RouteHandler;
use wcf\system\WCF;

/**
 * Contains header-related functions.
 * 
 * @author	<NAME>
 * @copyright	2001-2017 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\Util
 */
final class HeaderUtil {
	/**
	 * gzip level to user
	 * @var	integer
	 */
	const GZIP_LEVEL = 1;
	
	/**
	 * gzip compression
	 * @var	boolean
	 */
	protected static $enableGzipCompression = false;
	
	/**
	 * output HTML
	 * @var	string
	 */
	public static $output = '';
	
	/**
	 * Alias to php setcookie() function.
	 * 
	 * @param	string		$name
	 * @param	string		$value
	 * @param	integer		$expire
	 */
	public static function setCookie($name, $value = '', $expire = 0) {
		$application = ApplicationHandler::getInstance()->getActiveApplication();
		$addDomain = (mb_strpos($application->cookieDomain, '.') === false || StringUtil::endsWith($application->cookieDomain, '.lan') || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true;
		
		@header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT; max-age='.($expire - TIME_NOW) : '').'; path=/'.($addDomain ? '; domain='.$application->cookieDomain : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false);
	}
	
	/**
	 * Sends the headers of a page.
	 */
	public static function sendHeaders() {
		// send content type
		@header('Content-Type: text/html; charset=UTF-8');
		
		// send no cache headers
		if (!PACKAGE_ID || !WCF::getSession()->spiderID) {
			self::sendNoCacheHeaders();
		}
		<commit_msg>Strip port from cookie domain<commit_after><?php
namespace wcf\util;
use wcf\system\application\ApplicationHandler;
use wcf\system\event\EventHandler;
use wcf\system\request\RequestHandler;
use wcf\system\request\RouteHandler;
use wcf\system\WCF;

/**
 * Contains header-related functions.
 * 
 * @author	<NAME>
 * @copyright	2001-2017 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\Util
 */
final class HeaderUtil {
	/**
	 * gzip level to user
	 * @var	integer
	 */
	const GZIP_LEVEL = 1;
	
	/**
	 * gzip compression
	 * @var	boolean
	 */
	protected static $enableGzipCompression = false;
	
	/**
	 * output HTML
	 * @var	string
	 */
	public static $output = '';
	
	/**
	 * Alias to php setcookie() function.
	 * 
	 * @param	string		$name
	 * @param	string		$value
	 * @param	integer		$expire
	 */
	public static function setCookie($name, $value = '', $expire = 0) {
		$application = ApplicationHandler::getInstance()->getActiveApplication();
		$addDomain = (mb_strpos($application->cookieDomain, '.') === false || StringUtil::endsWith($application->cookieDomain, '.lan') || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true;
		$cookieDomain = $application->cookieDomain;
		if ($addDomain && strpos($cookieDomain, ':') !== false) {
			$cookieDomain = explode(':', $cookieDomain, 2)[0];
		}
		
		@header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT; max-age='.($expire - TIME_NOW) : '').'; path=/'.($addDomain ? '; domain='.$cookieDomain : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false);
	}
	
	/**
	 * Sends the headers of a page.
	 */
	public static function sendHeaders() {
		// send content type
		@header('Content-Type: text/html; charset=UTF-8');
		
		// send no cache headers
		if (!PACKAGE_ID || !WCF::getSession()->spiderID) {
			self::sendNoCacheHeaders();
		}
		
{'fraction_non_alphanumeric': 0.17630282603059372, 'fraction_numerical': 0.00622245268343272, 'mean_word_length': 4.08300395256917, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3430231', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1240, 'n_words': 272}