From: chedderslam on
I am getting some odd results when using Httpd_returnData.

The docs for the command are as follows:
-------------------------------------------------------------------------------------------------------
Httpd_ReturnData sock type content ?code? ?close?
Like Httpd_ReturnFile, except that the content is specified
directly as an argument to the command. This command also allows the
specification of an HTTP return code. If none is specified it will
default to 200 (Data follows). Beyond that the caller can order the
command to keep the connection sock open after the data was sent
("close == 1"). By default the connection would be closed, like it is
done by Httpd_ReturnFile.
-------------------------------------------------------------------------------------------------------

When I do not specify the ?close? parameter and leave it to its
default, which the docs state as closing the connection, I get results
that alternate with each request. On the first request, I get the
proper return, in this case a 400 http return code with an error
message. The next request results in a 200 http return code and zero
length content.

This is the code which results in alternating responses:
Httpd_ReturnData $socket text/html $error 400

When I specify the close parameter, I get consistent results, a 400
http return code and the error message. Here's the code:
Httpd_ReturnData $socket text/html $error 400 1

I have it behaving as I need it to, but would like to understand why
it is doing what it is doing.

Thanks.