// . s is a NULL terminated string like "text/html"
int32_t HttpMime::getContentTypePrivate ( char *s ) {
	char *send = NULL;
	char c;
	int32_t ct;
	// skip spaces
	while ( *s==' ' || *s=='\t' ) s++;
	// find end of s
	send = s;
	// they can have "text/plain;charset=UTF-8" too
	for ( ; *send && *send !=';' && *send !='\r' && *send !='\n' ; send++);

	//
	// point to possible charset desgination
	//
	char *t = send ;
	// charset follows the semicolon
	if ( *t == ';' ) {
		// skip semicolon
		t++;
		// skip spaces
		while ( *t==' ' || *t=='\t' ) t++;
		// get charset name "charset=euc-jp"
		if ( strncasecmp ( t , "charset" , 7 ) != 0 ) goto next;
		// skip it
		t += 7;
		// skip spaces, equal, spaces
		while ( *t==' ' || *t=='\t' ) t++;
		if    ( *t=='='             ) t++;
		while ( *t==' ' || *t=='\t' ) t++;
		// get charset
		m_charset = t;
		// get length
		while ( *t && *t!='\r' && *t!='\n' && *t!=' ' && *t!='\t') t++;
		m_charsetLen = t - m_charset;
	}

 next:

	// temp term it for the strcmp() function
	c = *send; *send = '\0';
	// set this
	//ct = -1;

	// returns CT_UNKNOWN if unknown
	ct = getContentTypeFromStr  ( s );

	// log it for reference
	//if ( ct == -1 ) { char *xx=NULL;*xx=0; }
	if ( ct == CT_UNKNOWN ) { 
		//ct = CT_UNKNOWN;
		log("http: unrecognized content type \"%s\"",s);
	}
	// unterm it
	*send = c;
	// return 0 for the contentType if unknown
	return ct;
}
// . s is a NULL terminated string like "text/html"
int32_t HttpMime::getContentTypePrivate(const char *s, size_t slen) {
	const char *send = NULL;
	int32_t ct;
	// skip spaces
	while ( *s==' ' || *s=='\t' ) s++;
	// find end of s
	send = s;
	// they can have "text/plain;charset=UTF-8" too
	for ( ; *send && *send !=';' && *send !='\r' && *send !='\n' ; send++);

	//
	// point to possible charset desgination
	//
	const char *t = send ;
	// charset follows the semicolon
	if ( *t == ';' ) {
		// skip semicolon
		t++;
		// skip spaces
		while ( *t==' ' || *t=='\t' ) t++;
		// get charset name "charset=euc-jp"
		if ( strncasecmp ( t , "charset" , 7 ) == 0 ) {
			// skip it
			t += 7;
			// skip spaces, equal, spaces
			while ( *t==' ' || *t=='\t' ) t++;
			if    ( *t=='='             ) t++;
			while ( *t==' ' || *t=='\t' ) t++;
			// get charset
			m_charset = t;
			// get length
			while ( *t && *t!='\r' && *t!='\n' && *t!=' ' && *t!='\t') t++;
			m_charsetLen = t - m_charset;
		}
	}

	// returns CT_UNKNOWN if unknown
	ct = getContentTypeFromStr(s, slen);

	// log it for reference
	//if ( ct == -1 ) { g_process.shutdownAbort(true); }
	if ( ct == CT_UNKNOWN ) {
		log("http: unrecognized content type \"%s\"",s);
	}

	// return 0 for the contentType if unknown
	return ct;
}