my head(er) sounds like that (((((((=^..^=)))))))

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

my head(er) sounds like that (((((((=^..^=)))))))

Post by Mariasole » Tue Jun 28, 2016 3:36 pm

Hello everyone!
I'm doing some tests with Live Code Server :D .
This time I'm trying to understand the management of the header! :shock:

But first things first.

I created a simple html page and I sent it to the server.
The page will then run with Apache.
The returned header is this:

###############################################################
HTTP Status Code HTTP/1.1 200 OK
Cache-Control max-age=0, no-cache, no-store, must-revalidate
Expires Tue, 28 Jun 2016 10:10:05 GMT
Last-Modified Tue, 28 Jun 2016 10:09:00 GMT
Content-Length 232
Content-Type text/html;
charset=UTF-8
Content-Length 232
Content-Encoding gzip
Vary Accept-Encoding
Date Tue, 28 Jun 2016 10:10:05 GMT
Accept-Ranges bytes
Pragma no-cache
Connection close
###############################################################


Then put the same page in a .lc file and, in this way it, the file will be managed by LIveCodeServer.
The header returned by the server was this:

###############################################
HTTP Status Code HTTP/1.1 200 OK
Content-Type text/html;
charset=iso-8859-1
Transfer-Encoding chunked
Content-Encoding gzip
Vary Accept-Encoding
Date Tue, 28 Jun 2016 10:10:05 GMT
Accept-Ranges bytes
Connection close
###############################################

The two header, even for me (that I have a hard head like a rock), are different. 8)

So, I'm trying to force the .lc page to return the header as if the page was run with Apache! :roll:

So, let's start ...

a) HTTP Status Code HTTP/1.1 200 OK ---> ok, It is the same in the two header!
b) Content-Type text/html; ---> ok, It is the same in the two header!
c) Content-Encoding gzip ---> ok, It is the same in the two header!
d) Vary Accept-Encoding ---> ok, It is the same in the two header!
e) Accept-Ranges bytes ---> ok, It is the same in the two header!
f) Date Tue, 28 Jun 2016 10:10:05 GMT ---> ok, It is the same in the two header!
g) Connection close ---> ok, It is the same in the two header!

Instead these are the strings of the header that I am able to "rebuild" via this code:
:D

Code: Select all

<?lc
put header "Content-Type: text/html; charset=utf-8" 
put header "Cache-Control 	max-age=0, no-cache, no-store, must-revalidate"
put header "Pragma: no-cache"
?>

But I fail to create: :roll:

Expires Tue, 28 Jun 2016 10:10:05 GMT
Last-Modified Tue, 28 Jun 2016 10:09:00 GMT
Content-Length 232



The Expires header string is controlled by Apache row:

Code: Select all

ExpiresActive On
ExpiresByType text/html "access plus 0 seconds" 

I have searched everywhere in the forum and in the livecode mailing list, and so here I am to ask you kindly help :oops: that I think will be useful to all of LCS explorers!


Many thanks to all, may God bless you!

Mariasole
=^..^=
Last edited by Mariasole on Tue Jul 05, 2016 1:38 pm, edited 2 times in total.
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: my head(er) sounds like that ***(=^..^=)***

Post by Mariasole » Fri Jul 01, 2016 4:26 pm

Dear knights, bishops, code heroes...
someone could help this girl who is losing his head(er) to solve this problem? :D
I understand that it is a very stupid question, but I can not find any source or manual that can help me ... :(
Thank you all, I throw my braid from the tower ...


Mariasole
(=^..^=)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: my head(er) sounds like that ***(=^..^=)***

Post by [-hh] » Fri Jul 01, 2016 5:09 pm

Hi Rapunzel.

Sorry, when climbing the braid I noticed, that I was wrong at first time.
[Now throw away the scissors, please.]

You can get Apache stamps by SSI.
https://httpd.apache.org/docs/current/howto/ssi.html

For example the last modified stamp of the server:
<!--#flastmod file="index.html" -->

Read on the Apache pages also the lines about xBitHack, if you want to use SSI for single pages only.
shiftLock happens

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: my head(er) sounds like that ***(=^..^=)***

Post by mwieder » Fri Jul 01, 2016 8:37 pm

Herman-

I think the OP's objective is to replace the Apache server, not to configure it. I could be wrong.

Mariasole-

If I'm right about the above, the question I would ask is "why are you trying to do this?"
Are you trying to fool browsers into thinking you are running an Apache server?

Also: what are you setting for the "Last_Modified" and "Expires" timestamps?
The "Expires" header in particular can reference either the file modification time or the client access time.

And I believe the "Cache-Control" settings you're seeing override anything in the "Expires" header anyway.
I'm not sure why your Apache server is putting both in the headers.

See https://httpd.apache.org/docs/current/m ... pires.html

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: my head(er) sounds like that ***(=^..^=)***

Post by Mariasole » Sat Jul 02, 2016 11:40 am

Thanks [-hh] and mwieder !
Thank you for responding to this sad lady who lives on a tower (creative and colorful) built with basis bricks of LCS!

Actually I do not want to do anything unusual with my page ".lc", but I just want to take control of the header as it does in php.

I do not know php (I could not ever learn it, for me it is natural to write only in livecode), but I found dozens of examples where control header in php is absolutely normal.

Now, I do not know if php and Apache are in relationships of affection and kinship, so the things you can do with php NOT you can do with LCS.

But I would only create a dynamic page with LCS controlling the header.

I was able to control "everything" except the three lines that I mentioned before:

Expires
Last-Modified
Content-Length

Among other things, I imagine that certain strings as "Content-Encoding gzip" (etc., probably all " ok, It is the same in the two header!) is providing yet by Apache even when my page is no longer static (HTML) but dynamic (.LC).

In summary, I am trying to build a simple and obvious dynamic page with LCS exactly as I could (if I knew) to build simple and common page with php.

On this page I would like to control the header, especially for being in good standing with search engines.


Where am I wrong? What am I doing so strange? :shock:

Thanks knights loved ones! :P

And I assure you that my braid is now reinforced with graphene nanotubes, and you can not break it except by a special laser scissor driven with a script in LC(S).... :wink:

Mariasole
(=^..^=)


This is for you [-hh]:

Considerate la vostra semenza:
fatti non foste a viver come bruti,
ma per seguir virtute e canoscenza

(Dante Alighieri)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: my head(er) sounds like that (((((((=^..^=)))))))

Post by Mariasole » Wed Jul 06, 2016 1:51 pm

Hello gentlemen,
Is there any Live Code Server expert who can help a member of the minority of female beginners coders? :cry:
Not only that, I am part of the small minority who uses LCS! :?
Someone in high places, which is fond of LCS, could tell me a solution? :|
Because in PHP I ask is business as usual, while in LCS seems something strange and alien? :?:

:shock:

Grazie a tutti, che Dio vi benedica!
Mariasole
(=^..^=)



---------------------------------------------
the oil is spitting in the saucepan
i squeeze the sponge and let the cat out ----------------------------> (=^..^=)
oh my head sounds like that
oh my head
oh oh oh
oh oh oh

(Peter Gabriel, My Head Sounds Like That)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: my head(er) sounds like that (((((((=^..^=)))))))

Post by Mariasole » Fri Jul 08, 2016 11:37 am

I am continuing to work on the solution of the three strings of header that I can not generate:

Expires
Last-Modified
Content-Length



For the Expires header: :idea:
To this string I thought to ask the internet data to the server and then process it and put it in the header. The solution could be this.

For the Last-Modified header: :?: :idea:
For this I have to find the function of the creation date of .lc file and print it on the string (by the way, how can I ask to file his date of birth?)


For the Content-Length header: :?:
I have no idea how to generate, however, I try to study.


If anyone can help, at least explaining the "header relationship generation" between Apache and LCS, and generally how to manage the header would be very happy. :D

I'm sure that these explanations could be very useful to other beginners LCS like me! 8)

Thank you all for your cooperation!

(=^..^=)
Mariasole
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: my head(er) sounds like that (((((((=^..^=)))))))

Post by [-hh] » Fri Jul 08, 2016 1:32 pm

Was useless, sorry.
Last edited by [-hh] on Sat Jul 09, 2016 8:44 am, edited 2 times in total.
shiftLock happens

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: my head(er) sounds like that (((((((=^..^=)))))))

Post by wsamples » Sat Jul 09, 2016 3:28 am

Please note that the date/time format for these headers must be in the format shown in the examples in your initial post. They must reference GMT and not any local time zone. If these are lc files specifically because you are serving dynamic content then it could be appropriate to set the Last-Modified and the Expires to the current time. You could also write a script which converts the seconds, subtracting some seconds for 'Last-Modified' and adding some seconds for 'Expires' then convert these to date items and format appropriately. As Mark suggests, the primary purpose of these headers is to aid in cache management and precision isn't really required. Facebook, btw, sets the 'Expires' header to Jan 1, 2000.

Content-Length is complicated to calculate for dynamic pages where the content is changeable. You could sent a 'Content-length: 0' or ignore it altogether. LiveCode server sends the 'Transfer-Encoding: chunked' header to help the browser figure out how to know when the request is completed.

You might find it interesting to spend some time looking at the response headers of a number of sites to see how much variation in usage there is, including custom headers

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: my head(er) sounds like that (((((((=^..^=)))))))

Post by Mariasole » Tue Jul 12, 2016 1:45 pm

Thank you very much wsamples, :D
You have been very clear, now I will continue my experiments and I will make a tour to see the other sites as manage the header!
Thanks again

(=^..^=)
Mariasole
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

Mariasole
Posts: 235
Joined: Tue May 07, 2013 9:38 pm

Re: my head(er) sounds like that (((((((=^..^=)))))))

Post by Mariasole » Tue Jul 12, 2016 1:47 pm

[-hh] wrote:Was useless, sorry.
In fact the post then you have modified :wink: helped me to learn other things! :D
So ... thank you very much [-hh]

(=^..^=)
Mariasole
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator

Post Reply