<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()){

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

		# 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);
	}

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

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

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

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

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

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

	function http_post($url, $post_fields, $headers=array(), $more=array()){

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

		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

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

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

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

	# uncertain what to think about $post_fields as different servers
	# expect different things (aka params sent as GET/query args)...
	# thanks, Roy (20120601/straup)

	function http_delete($url, $post_fields, $headers=array(), $more=array()){

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

		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

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

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

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

	function http_put($url, $bytes, $headers=array(), $more=array()){

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

		# See the monster you've created, Roy? See???!?!?!!

		if (isset($more['donotsend_transfer_encoding'])){
			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
		}
<commit_msg>http_delete: don't set post fields unless, well, post fields<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()){

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

		# 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);
	}

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

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

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

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

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

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

	function http_post($url, $post_fields, $headers=array(), $more=array()){

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

		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

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

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

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

	# uncertain what to think about $post_fields as different servers
	# expect different things (aka params sent as GET/query args)...
	# thanks, Roy (20120601/straup)

	function http_delete($url, $post_fields, $headers=array(), $more=array()){

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

		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');

		if ($post_fields){
			curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
		}

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

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

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

	function http_put($url, $bytes, $headers=array(), $more=array()){

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

		# See the monster you've created, Roy? See???!?!?!!

		if (isset($more['donotsend_transfer_encoding'])){
			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
		}

{'fraction_non_alphanumeric': 0.3241507870753935, 'fraction_numerical': 0.004971002485501243, 'mean_word_length': 6.568965517241379, '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': '5253347', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1511, 'n_words': 304}