What exactly does "put" do on Server?

Richard Gaskin ambassador at fourthworld.com
Tue Apr 20 21:01:34 EDT 2021

Postman shows a single reply to the client from Apache.

strace on the server shows each "put" implemented at the system level as 
a write to stdout.

So it looks to me like Apache buffers writes it receives and sends all 
of it to the client in one go, with a header that accurately accounts 
for the total size of multiple "put"s in the Content-Length.

I'm still curious to know how Apache knows when to send to the client - 
does it wait for the CGI to terminate?

But for now, at least it seems we have an answer to the question of 
whether LC Server or Apache buffers the writes.

  Richard Gaskin
  Fourth World Systems

Tom Glod wrote:

> Following, I've wondered this, but never had enough motivation to test it.
> On Tue, Apr 20, 2021 at 4:00 PM Richard Gaskin via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>> Normally, HTTP is used for request-reply patterns, where the server
>> receives the request, does some processing to it, and then sends back
>> the reply.
>> In a faceless environment like Server, "put" goes to stdout, yes?  So
>> when we say "put tData", then the contents of tData are handed back to
>> Apache which then sends them along to the client.
>> So what happens when I have a script that uses multiple "put" statements?
>> Does LC Server buffer all "put" output together and send it as one
>> string back to the client?
>> If so, why do I see faster results if I collect data myself and use only
>> one "put"?
>> If not, how does it write a meaningful header, since the length can't be
>> known in advance?
>> What exactly is the Server engine doing with "put"?
>> --
>>   Richard Gaskin
> -- 
> Tom Glod
> Founder & Developer
> MakeShyft R.D.A (www.makeshyft.com)
> Mobile:647.562.9411

More information about the use-livecode mailing list