What exactly does "put" do on Server?

Ralph DiMola rdimola at evergreeninfo.net
Wed Apr 21 12:38:53 EDT 2021


If it's a POST then you must set the "Content-Length" in the header for
xhttp requests. The client(chrome anyway) will fail. GETs don't require
"Content-Length" to be set in the header. I don't know how multiple "put"s
work for xhttp. Now I'm curious...

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Richard Gaskin via use-livecode
Sent: Tuesday, April 20, 2021 9:02 PM
To: use-livecode at lists.runrev.com
Cc: Richard Gaskin
Subject: Re: What exactly does "put" do on Server?

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


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list