lib/sw_apps/img_rcvry/src/xbir_http.c
static int Xbir_HttpGenerateHdr (char *Buffer, const char *Ext, u16 Size)
{
	char LocalBuffer[40U];
	char *HttpHdr = (char *) Buffer;

	strcpy(HttpHdr, "HTTP/1.1 200 OK\r\nContent-Type: ");

	if (Ext == NULL) {
		strcat(HttpHdr, "text/html");	/* For unknown types */
	}
	else if (strncmp(Ext, "htm", strlen("htm")) == 0) {
		strcat(HttpHdr, "text/html");
	}
	else if (strncmp(Ext, "jsn", strlen("jsn")) == 0) {
		strcat(HttpHdr, "application/json");
	}
	else if (strncmp(Ext, "js", strlen("js")) == 0) {
		strcat(HttpHdr, "application/javascript");
	}
	else if (strncmp(Ext, "css", strlen("css")) == 0) {
		strcat(HttpHdr, "text/css");
	}
	else if (strncmp(Ext, "ico", strlen("ico")) == 0) {
		strcat(HttpHdr, "image/ico");
	}
	else if (strncmp(Ext, "svg", strlen("svg")) == 0) {
		strcat(HttpHdr, "image/svg+xml");
	}
	else {
		/* For unknown types */
		strcat(HttpHdr, "text/plain");
	}
	strcat(HttpHdr, "\r\n");

	sprintf(LocalBuffer, "Content-length: %d", Size);
	strcat(HttpHdr, LocalBuffer);
	strcat(HttpHdr, "\r\n");

	strcat(HttpHdr, "Connection: close\r\n");
	strcat(HttpHdr, "\r\n");

	return strlen(HttpHdr);
}
/*****************************************************************************/
/**
 * @brief
 * This function dynamically generates HTTP header based on file type and size.
 *
 * @param	Buffer	Pointer to buffer to store HTTP Header
 * @param	Ext	Extension of file or data type string
 * @param	Size	Size of file or size of data
 *
 * @return	Len	Length of the HTTP header
 *
 *****************************************************************************/
@brief
This function dynamically generates HTTP header based on file type and size.

@param       Buffer  Pointer to buffer to store HTTP Header
@param       Ext     Extension of file or data type string
@param       Size    Size of file or size of data

@return      Len     Length of the HTTP header
@brief This function dynamically generates HTTP header based on file type and size . @param Buffer Pointer to buffer to store HTTP Header @param Ext Extension of file or data type string @param Size Size of file or size of data @return Len Length of the HTTP header
static int Xbir_HttpGenerateHdr (char *Buffer, const char *Ext, u16 Size)
{
	char LocalBuffer[40U];
	char *HttpHdr = (char *) Buffer;
	strcpy(HttpHdr, "HTTP/1.1 200 OK\r\nContent-Type: ");
	if (Ext == NULL) {
		strcat(HttpHdr, "text/html");	
	}
	else if (strncmp(Ext, "htm", strlen("htm")) == 0) {
		strcat(HttpHdr, "text/html");
	}
	else if (strncmp(Ext, "jsn", strlen("jsn")) == 0) {
		strcat(HttpHdr, "application/json");
	}
	else if (strncmp(Ext, "js", strlen("js")) == 0) {
		strcat(HttpHdr, "application/javascript");
	}
	else if (strncmp(Ext, "css", strlen("css")) == 0) {
		strcat(HttpHdr, "text/css");
	}
	else if (strncmp(Ext, "ico", strlen("ico")) == 0) {
		strcat(HttpHdr, "image/ico");
	}
	else if (strncmp(Ext, "svg", strlen("svg")) == 0) {
		strcat(HttpHdr, "image/svg+xml");
	}
	else {
		strcat(HttpHdr, "text/plain");
	}
	strcat(HttpHdr, "\r\n");
	sprintf(LocalBuffer, "Content-length: %d", Size);
	strcat(HttpHdr, LocalBuffer);
	strcat(HttpHdr, "\r\n");
	strcat(HttpHdr, "Connection: close\r\n");
	strcat(HttpHdr, "\r\n");
	return strlen(HttpHdr);
}
static int Xbir_HttpGenerateHdr ( char * Buffer , const char * Ext , u16 Size ) { char LocalBuffer [ 40U ] ; char * HttpHdr = ( char * ) Buffer ; strcpy ( HttpHdr , " \r \n " ) ; if ( Ext == NULL ) { strcat ( HttpHdr , " " ) ; } else if ( strncmp ( Ext , " " , strlen ( " " ) ) == 0 ) { strcat ( HttpHdr , " " ) ; } else if ( strncmp ( Ext , " " , strlen ( " " ) ) == 0 ) { strcat ( HttpHdr , " " ) ; } else if ( strncmp ( Ext , " " , strlen ( " " ) ) == 0 ) { strcat ( HttpHdr , " " ) ; } else if ( strncmp ( Ext , " " , strlen ( " " ) ) == 0 ) { strcat ( HttpHdr , " " ) ; } else if ( strncmp ( Ext , " " , strlen ( " " ) ) == 0 ) { strcat ( HttpHdr , " " ) ; } else if ( strncmp ( Ext , " " , strlen ( " " ) ) == 0 ) { strcat ( HttpHdr , " " ) ; } else { strcat ( HttpHdr , " " ) ; } strcat ( HttpHdr , " \r \n " ) ; sprintf ( LocalBuffer , " " , Size ) ; strcat ( HttpHdr , LocalBuffer ) ; strcat ( HttpHdr , " \r \n " ) ; strcat ( HttpHdr , " \r \n " ) ; strcat ( HttpHdr , " \r \n " ) ; return strlen ( HttpHdr ) ; }
@brief
 This function dynamically generates HTTP header based on file type and size.
@brief This function dynamically generates HTTP header based on file type and size .
/* For unknown types */ /* For unknown types */