Hi Daniel,
For a cgi, application callback functions are define in HTTPD_CGI_LINK_STRUCT.
So when requested a cgi web page, the RTCS library calls the cgi_ callback function linked to this web page by the HTTPD_CGI_LINK_STRUCT.
From the cgi callback function, we can request the RTCS to send a header. An example for this in MQX 4.0, in /rtcs/examples/httpsrv/cgi.c, cgi callback functions should look like this:
static _mqx_int cgi_rtc_data(HTTPD_SESSION_STRUCT *session)
{
TIME_STRUCT time;
int min, hour;
_time_get(&time);
min = time.SECONDS / 60;
hour = min / 60;
min %= 60;
session->response.contenttype = CONTENT_TYPE_PLAIN;
httpd_sendhdr(session, 0, 0);
CGI_SEND_NUM(hour);
CGI_SEND_NUM(min);
CGI_SEND_NUM(time.SECONDS % 60);
return session->request.content_len;
}
Regards
Sol