bool VHTTPResponse::_NormalizeResponseHeader()
{
/*
	HTTP automatic fixes: (to mimic Apache's behavior for CGIs (m.c)
*/
	XBOX::VString fieldValue;
	
	// Special CGI case: the cgi author can use the Status field to set the response code
	if (GetHeaders().IsHeaderSet (STRING_HEADER_STATUS))
	{
		if (GetHeaders().GetHeaderValue (STRING_HEADER_STATUS, fieldValue))
		{
			SetResponseStatusCode ((HTTPStatusCode)HTTPServerTools::GetLongFromString (fieldValue));
			GetHeaders().RemoveHeader (STRING_HEADER_STATUS);
		}
	}

	// We still support some legacy, non standard special token:
	if (GetHeaders().IsHeaderSet (STRING_HEADER_X_STATUS))
	{
		if (GetHeaders().GetHeaderValue (STRING_HEADER_X_STATUS, fieldValue))
		{
			SetResponseStatusCode ((HTTPStatusCode)HTTPServerTools::GetLongFromString (fieldValue));
			GetHeaders().RemoveHeader (STRING_HEADER_X_STATUS);
		}
	}

	if (GetHeaders().IsHeaderSet (STRING_HEADER_X_VERSION))
	{
		if (GetHeaders().GetHeaderValue (STRING_HEADER_X_VERSION, fieldValue))
		{
			if (HTTPServerTools::EqualASCIICString (fieldValue, "http/1.0"))
				SetHTTPVersion (VERSION_1_0);
			else
				SetHTTPVersion (VERSION_1_1);
			GetHeaders().RemoveHeader (STRING_HEADER_X_VERSION);
		}
	}

	// Classic Redirect trick
	if (GetHeaders().IsHeaderSet (STRING_HEADER_LOCATION) && (((sLONG)fResponseStatusCode / 100) != 3))
		SetResponseStatusCode (HTTP_FOUND);


	// Best practice see: http://developer.yahoo.com/performance/rules.html#expires
	/*
	if (fCanCacheBody && fResponseStatusCode == 200 && !GetHeaders().IsHeaderSet (STRING_HEADER_EXPIRES))
	{
		HTTPProtocol::MakeRFC822GMTDateString (GMT_FAR_FUTURE, fieldValue);
		GetHeaders().SetHeaderValue (STRING_HEADER_EXPIRES, fieldValue);
	}
	*/

	if (!GetHeaders().IsHeaderSet (STRING_HEADER_CONTENT_LENGTH) && GetBody().GetDataSize())
	{
		fieldValue.FromLong8 (GetBody().GetDataSize());
		GetHeaders().SetHeaderValue (STRING_HEADER_CONTENT_LENGTH, fieldValue);
	}

	if (!GetHeaders().IsHeaderSet (STRING_HEADER_CONTENT_TYPE) && GetBody().GetDataSize())
		GetHeaders().SetHeaderValue (STRING_HEADER_CONTENT_TYPE, STRING_CONTENT_TYPE_BINARY);

	return true;
}
bool VHTTPResponse::SetContentLengthHeader (const sLONG8 inValue)
{
	XBOX::VString string;
	string.FromLong8 (inValue);
	return GetHeaders().SetHeaderValue (STRING_HEADER_CONTENT_LENGTH, string, true);
}