<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Webserver missing header of HTTP answer in .cgi files in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Webserver-missing-header-of-HTTP-answer-in-cgi-files/m-p/269882#M8209</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I think it's not the library but the application code should trigger the header of HTTP message.&lt;/P&gt;&lt;P&gt;For a cgi web page, application callback functions are defined in HTTPD_CGI_LINK_STRUCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_13619792776209747 jive_macro_code" jivemacro_uid="_13619792776209747"&gt;
&lt;P&gt;static _mqx_int cgi_rtc_data(HTTPD_SESSION_STRUCT *session)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TIME_STRUCT time;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int min, hour;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; _time_get(&amp;amp;time);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; min = time.SECONDS / 60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; hour = min / 60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; min %= 60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; session-&amp;gt;response.contenttype = CONTENT_TYPE_PLAIN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; httpd_sendhdr(session, 0, 0);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; CGI_SEND_NUM(hour);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CGI_SEND_NUM(min);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CGI_SEND_NUM(time.SECONDS % 60);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return session-&amp;gt;request.content_len;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the write to response struct contenttype and a call to httpd_sendhdr().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2013 15:36:10 GMT</pubDate>
    <dc:creator>Martin_</dc:creator>
    <dc:date>2013-02-27T15:36:10Z</dc:date>
    <item>
      <title>Webserver missing header of HTTP answer in .cgi files</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Webserver-missing-header-of-HTTP-answer-in-cgi-files/m-p/269881#M8208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good mornig,&lt;/P&gt;&lt;P&gt;I'm using MCF52255 with MQX3.8.1 developped by CW10.2. I implemented a webserver but when I try to enter in the my website, inserting a password, I will get an error on Mozilla which indicates that there isn't the header of the HTTP answer message. I passed a file called "password.cgi" which has not the header message of HTTP (the content-type is missing). &lt;/P&gt;&lt;P&gt;Is it possible that the libraries don't put header HTTP message if I transfer a .cgi file? To put the header of HTTP message, do I have to transfer an html file?&lt;/P&gt;&lt;P&gt;How can I put a dinamyc part of the HTML page using cgi and sending the header of the HTTP message?&lt;/P&gt;&lt;P&gt;I attached the error which I get on Mozilla browser.&lt;/P&gt;&lt;P&gt;I attached the file html of my home page.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Fortunato Mirko&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338634"&gt;home.html.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 17:04:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Webserver-missing-header-of-HTTP-answer-in-cgi-files/m-p/269881#M8208</guid>
      <dc:creator>kappa74</dc:creator>
      <dc:date>2013-02-22T17:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Webserver missing header of HTTP answer in .cgi files</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Webserver-missing-header-of-HTTP-answer-in-cgi-files/m-p/269882#M8209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I think it's not the library but the application code should trigger the header of HTTP message.&lt;/P&gt;&lt;P&gt;For a cgi web page, application callback functions are defined in HTTPD_CGI_LINK_STRUCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_13619792776209747 jive_macro_code" jivemacro_uid="_13619792776209747"&gt;
&lt;P&gt;static _mqx_int cgi_rtc_data(HTTPD_SESSION_STRUCT *session)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TIME_STRUCT time;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int min, hour;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; _time_get(&amp;amp;time);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; min = time.SECONDS / 60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; hour = min / 60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; min %= 60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; session-&amp;gt;response.contenttype = CONTENT_TYPE_PLAIN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; httpd_sendhdr(session, 0, 0);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; CGI_SEND_NUM(hour);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CGI_SEND_NUM(min);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; CGI_SEND_NUM(time.SECONDS % 60);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return session-&amp;gt;request.content_len;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the write to response struct contenttype and a call to httpd_sendhdr().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2013 15:36:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Webserver-missing-header-of-HTTP-answer-in-cgi-files/m-p/269882#M8209</guid>
      <dc:creator>Martin_</dc:creator>
      <dc:date>2013-02-27T15:36:10Z</dc:date>
    </item>
  </channel>
</rss>

