TCPnet hanging in cgi_func()

Hi all,
I have a problem with a cgi handler I'm writing. My cgi_func() needs to format and output an html table. I took the inspiration from the tcp.cgi handler in HTTP Demo code.
I experience the problem of the http server getting stuck sometimes when I request my cgi url: the page itself is not displayed in the browser and I cannot access any other page.

I found out the problem is that I made the assumption of a minimum size for the output buffer passed to cgi_func() by the caller. This was because of the following comment from the function skeleton in http_cgi.c:

/* buflen - length of this buffer (500-1400 bytes - depends on MSS) */

Do I read the wrong value for the minimum size (500) or should I set up the function to be able to work with any buflen (at worst down to a single byte)?

The point is that in cgi_func() I'm cycling over my table's row and using the len |= 0x8000 trick to get the function called again. But if I miss to write a single byte due to the buffer being shorter than the size of a single row in my table, the function get called back again (this is ok, since the table is not over yet) with buflen ALWAYS having the same (too short value).

Is this supposed to be the correct behaviour? If so is there a minimum value for buflen I can assume in order to correctly dimension my iterative task?

TIA

Parents Reply Children
No data
More questions in this forum