Dave Bauer wrote:
>
> This is a known issue. You cannot call ns_conncptofp if you have
> previously called ns_getform
> for a connection.Or something like that :). I am sure it is in the archives.
ns_getform calls ns_conncptofp. Calling ns_conncptofp twice results in
the same error as listed above:
Error writing content: resource temporarily unavailable.
It looks like the error is generated returned from NsTclWriteContentCmd
(nsd/conn.c):
if (Ns_ConnCopyToChannel(conn, conn->contentLength, chan) != NS_OK) {
Tcl_AppendResult(interp, "Error writing content: ",
Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
So 'resource temporarily unavailable' is a posix error message?
I guess it means there isn't anything left to read from the connection.
I set up a test page at http://multi.zmbh.com:8300/conncptofp.tcl which
contains the following script:
------
set fp [open /tmp/fp w+]
ns_conncptofp $fp
close $fp
set fp2 [open /tmp/fp2 w+]
ns_conncptofp $fp2
close $fp2
ns_return 200 text/plain "copied to fp and fp2"
-----------
Telnet to that page and simulate a POST:
$ telnet multi.zmbh.com 8300
Trying 216.254.26.187...
Connected to pathfinderschool.com (216.254.26.187).
Escape character is '^]'.
POST /conncptofp.tcl HTTP/1.0
Content-length: 5
hi how
HTTP/1.0 200 OK
Set-Cookie:
ad_session_id=7243%2c0%2c1E15F7A558C4D44EA829D09AB87181D3853A2581%2c1030992031;
Path=/; Max-Age=86400
Set-Cookie: ad_browser_id=7243; Path=/; Expires=Fri, 01-Jan-2035
01:00:00 GMT
Content-Type: text/plain; charset=iso-8859-1
MIME-Version: 1.0
Date: Mon, 02 Sep 2002 18:40:35 GMT
Server: AOLserver/3.2+ad12
Content-Length: 20
Connection: close
copied to fp and fp2Connection closed by foreign host.
The file /tmp/fp contains 'hi ho' and the file /tmp/fp2 contains 'w',
which suggests that ns_conncptofp first looks for the content-length
number of bytes,
anything over that is available for the second read. If you don't type
in more than
content-length bytes, you get the error. Both files are 5 bytes long.
The length doesn't change if you type in more than 10 characters.
--Tom Jackson