
rst at ai
Mar 14, 1995, 9:37 AM
Post #2 of 5
(136 views)
Permalink
|
Randy --- I looked your form over, and found what may be part of the problem. The cgi-postin.c code that you're using expects to be able to get the entire request body out of the socket in one C-library read call --- /* * Create space to hold the raw data and load it in. */ if ((buf = (char *)malloc(len+1)) == NULL) die(0, "cannot allocate space for buffer"); if ((i = read(STDIN_FILENO, buf, len)) < 0) die(errno, "error reading form data"); if (i != len) die(0, "error reading form data [expected %d chars, got %d]", le n, i); Note that with the NCSA server, this read() always reads the socket directly, and reads on a socket (or a pipe, for that matter) are not guaranteed to yield the number of bytes requested, even if that many bytes will ultimately be made available. Typically, you only get as many as the kernel has buffered up, which may be less. It's also *possible* that there's server trouble here --- the errors you're seeing are consistent with HTTP request body data disappearing into a buffer. However, if this is a problem with drtr's getline() code, it's a subtle and system-dependant one --- I tested POST here with drtr's code before releasing apache-pre, and it worked fine. rst
|