On Monday 07 February 2005 12:30, The Mage wrote:
> When I send a form via the 'POST' method in both Camino and Safari on
> the Mac, the final line of the HTTP request is passed unterminated by
> a CR or LF ... and unfortunately this line contains all of the
> relevant POST data generated by the form. But E_WEB uses the read()
> function to read the web request, and as far as I can tell, read()
> will not return any info without a carriage return, so E_WEB gets
> hung at the very end of the request waiting for the data to be
> terminated.
[...]
> And there the loop hangs ... presumably waiting for the final line to
> be terminated. Most web servers don't need the termination, since
> they use the preceding 'Content-Length' header as a cue to when to
> stop reading. As far as I can see, there is no way to implement this
> behaviour in MOO code. Or is there something I have overlooked? Is
> there a way that I can read a single character off of a connection at
> a time? If there is, E_WEB doesn't use it, and I don't understand why
> the programmers of E_WEB expected their POST routine to work.

There is something you have overlooked... You can use 
set_connection_option(conn, "binary", 1), assuming the negative object number 
you're reading from is stored in 'conn'.

The ancient LambdaCore help I looked at says:
--- snip ---
"binary"
If <value> is true, then both input from and output to <conn> can contain 
arbitrary bytes. Input from a connection in binary mode is not broken into 
lines at all; it is delivered to either the `read()' function or built-in 
command parser as `binary strings', in whatever size chunks come back from 
the operating system. (See the early section in the LambdaMOO Programmers 
Manual on MOO value types for a description of the binary string 
representation.) For output to a connection in binary mode, the second 
argument to `notify()' must be a binary string; if it is malformed, E_INVARG    
 
is raised.
--- snip ---

You can use this to read unterminated lines... You can't request just one 
character at a time, though. It's going to give you as much data as it has, 
and you'll have to do your own buffering.

#############################################################
This message is sent to you because you are subscribed to
  the mailing list <moo-cows@the-b.org>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to  <[EMAIL PROTECTED]>

Reply via email to