<commit_before><?php
/**
 * $Id$
 * @package server
 */

/**
 * HTTP protocol components of an active request
 * 
 * @package server
 */
class HttpEnvelope {
	private $headers;

	function __construct() {
		if (function_exists('apache_request_headers')) {
			$this->headers = apache_request_headers();
		} else {
			throw new Exception("Apache Unsupported");
		}
	}
	
	/**
	 * Returns true if header exists for this request
	 * 
	 * @return boolean
	 */
	function hasHeader($name) {
		return (array_key_exists($name, $this->headers));
	}
	
	/**
	 * Returns the HTTP header value for given key
	 * 
	 * @return string
	 */
	function header($key) {
		if ($this->hasHeader($key)) {
			return $this->headers[$key];
		}<commit_msg>Removed the exception that was thrown when PHP is unable to access the Apache API... need to verify where and when this becomes significant. In the meantime, server code now operates correctly on PHP/CGI (specifically Dreamhost), not that I would ever recommend running websites on such...<commit_after><?php
/**
 * $Id$
 * @package server
 */

/**
 * HTTP protocol components of an active request
 * 
 * @package server
 */
class HttpEnvelope {
	private $headers;

	function __construct() {
		if (function_exists('apache_request_headers')) {
			$this->headers = apache_request_headers();
		} else {
			$this->headers = array();
		}
	}
	
	/**
	 * Returns true if header exists for this request
	 * 
	 * @return boolean
	 */
	function hasHeader($name) {
		return (array_key_exists($name, $this->headers));
	}
	
	/**
	 * Returns the HTTP header value for given key
	 * 
	 * @return string
	 */
	function header($key) {
		if ($this->hasHeader($key)) {
			return $this->headers[$key];
		}
{'fraction_non_alphanumeric': 0.1334113516676419, 'fraction_numerical': 0.0, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '968645', 'n_tokens_mistral': 552, 'n_tokens_neox': 493, 'n_words': 161}