<commit_before><?
	#
	# $Id$
	#

	########################################################################

	$GLOBALS['timings']['http_count']	= 0;
	$GLOBALS['timings']['http_time']	= 0;
	$GLOBALS['timing_keys']['http'] = 'HTTP Requests';

	########################################################################

	function http_head($url, $headers=array(), $more=array()){
		$more['head'] = 1;
		return http_get($url, $headers, $more);
	}

	########################################################################

	function http_get($url, $headers=array(), $more=array()){

		$ch = _http_curl_handle($url, $headers, $more);

		if ($more['head']){
			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
			curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
		}

		if ($more['return_curl_handle']){
			return $ch;
		}

		return _http_request($ch, $url, $more);
	}

	########################################################################<commit_msg>ensure CURLOPT_NOBODY when doing HEAD request so that headers are returned<commit_after><?
	#
	# $Id$
	#

	########################################################################

	$GLOBALS['timings']['http_count']	= 0;
	$GLOBALS['timings']['http_time']	= 0;
	$GLOBALS['timing_keys']['http'] = 'HTTP Requests';

	########################################################################

	function http_head($url, $headers=array(), $more=array()){
		$more['head'] = 1;
		return http_get($url, $headers, $more);
	}

	########################################################################

	function http_get($url, $headers=array(), $more=array()){

		$ch = _http_curl_handle($url, $headers, $more);

		if ($more['head']){

			# ensure NOBODY is set so that headers are returned

			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
			curl_setopt($ch, CURLOPT_NOBODY, true);
			curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
		}

		if ($more['return_curl_handle']){
			return $ch;
		}

		return _http_request($ch, $url, $more);
	}

	########################################################################
{'fraction_non_alphanumeric': 0.4166266218164344, 'fraction_numerical': 0.004805382027871216, 'mean_word_length': 7.395161290322581, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4584891', 'n_tokens_mistral': 713, 'n_tokens_neox': 609, 'n_words': 108}