This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Custom HTTP Header Content-type

Hi everyone

I am working on an HTTP server on a Cortex-M7 ARM to transmit SOAP messages (with text/xml content) via CGI script, and transmit JSON-AJAX (with application/json content) via CGX script. All HTTP requests are POST requests.
HTTP Headers for CGX scripts are automatically generated via the function netCGX_ContentType(void)

const char* netCGX_ContentType (void)
{
	return("application/json; charset=utf-8");
}


Currently, HTTP headers for CGI scripts return a content-type "text/html" instead of "text/xml".
According to the documentation Common Gateway Interface, documentation, there is a function to change the content type of an HTTP header. It does not work..
(Here's mine function below)

/* Generate http header content-type for cgi call */
const char* netCGI_ContentType (const char *file_ext)
{
	if (strcmp (file_ext, "cgi") == 0) 
	{
		return("text/xml; charset=utf-8\r\n");
	}
	return(NULL);
}

I noticed that the function is never called by the HTTP server. Where should I call the netCGI_ContentType() function to modify its HTTP header?

My set-up :

STM32F769I card
Versions:
HTTP_Server_FS.c: v7.2.0
HTTP_Server_CGI.c: v7.0.0
Net_Config.c: v7.7.0 (variant IPv4 / IPv6 Release)
Net_Config_HTTP_Server.c: v7.0.0"

Thanks,