Exemple #1
0
void URL_DataDescriptor::SetupContentDecodingL(const char *header)
{
	if(!header)
		LEAVE(OpStatus::ERR);
	
	ParameterList params(KeywordIndex_HTTP_General_Parameters); 
	ANCHOR(ParameterList, params);
	
	params.SetValueL((char *) header, PARAM_SEP_COMMA| PARAM_NO_ASSIGN | PARAM_ONLY_SEP);

	Parameters *encoding = params.First();

	while(encoding)
	{
		ParameterList *current_encoding = encoding->GetParametersL(PARAM_SEP_SEMICOLON, KeywordIndex_HTTP_General_Parameters);
		Parameters *name = (current_encoding ? current_encoding->First() : NULL);
		
		if(name)
		{
			HTTP_compression mth;
			
			switch(mth = (HTTP_compression) name->GetNameID())
			{
			case HTTP_Deflate:
			case HTTP_Compress:
			case HTTP_Gzip:
				{
					HTTP_Transfer_Decoding *decoder = HTTP_Transfer_Decoding::Create(mth);
					if(decoder)
						decoder->Into(&CE_decoding);
					else
					{
						g_memory_manager->RaiseCondition(OpStatus::ERR_NO_MEMORY);
						LEAVE(OpStatus::ERR_NO_MEMORY);
					}
				}
				break;

			default: break; // nothing to do for plaintext
			}
		}
		encoding = encoding->Suc();
	}
}