Feature Request/Rant - Last-modified and Expires MIME
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 36233
interpreted = N
texte = I decided I was sick of not being able to View Source on my generatedpages, so I coded up the following include file to send the proper MIMEheaders for Last-modified and Expires.  It is so complex because all MIME date/time values must be sent as UTC (GMT).  Since this is true, it is truly bizarre that the WebCat [date] function does not have a format, say %G, that outputs the correct string format automaticallyfor the timezone the server is locate in (including Daylight SavingsTime).  I checked, and the Win32 libraries do include a function gmtime() that takes a time structure and returns it as UTC time.It would also be nice if [math date] understood that if I write:  [math date&format=%a, %d %b %Y]{[date]}+{04:10:00}[/math] GMTI mean that it should take the current date and time, add 4 hours and 10 minutes and then format it as Thu, 17 Aug 2000 14:00:58 GMT for example.  This would also have to include carry from the time to the date, so that when the time goes past midnight as a result of an addition, it would add to the day (possibly carrying to the month and year as well).Alternatively, there could be a system setting so that WebCatalog wouldalways generate the appropriate MIME headers for Last-modified and Expires, with a system wide default Expires offset.  Since we can override any MIME headers that WebCat would want to send with our own[SETMIMEHEADER], I don't see how this could be a problem for anyone.If anyone wanted to not use it at all, simply set the Expires offset=0.In any case, here is the source code to enable proper MIME headers forLast-modified and Expires to put in your Globals directory.Share and enjoy...John Peacock[!]  ------- MIMEHeaders.inc -------  [/!][!]4:00 is offset from UTC - replace with your offset[/!][math time&show=f]GMT={[date %X]}+{04:00:00}[/math][math time&show=f]NOW={[date %X]}[/math][SETMIMEHEADER name=Last-modified&value=  [date format=%a, %d]   [if ([GMT]>[NOW])][!]if GMT before midnight[/!]  [then]    [date format=%b]  [/then]  [else][!]if GMT after midnight then increment date too[/!]    [format days_to_date %b][math]{[date]}+{00/01/0000}[/math][/format]  [/else]  [/if]  [date format=%Y] [Format Seconds_To_Time][GMT][/Format] GMT][SETMIMEHEADER name=Expires&value=  [date format=%a, %d]  [if ([GMT]>[NOW])]  [then]    [date format=%b]  [/then]  [else]    [format days_to_date %b][math]{[date]}+{00/01/0000}[/math][/format]  [/else]  [/if]  [!]600 will give a 10 minute expiration[/!]  [date format=%Y] [FormatSeconds_To_Time][math][GMT]+600[/math][/Format] GMT]-------------------------------------------------------------This message is sent to you because you are subscribed to  the mailing list 
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
|  | 
Feature Request/Rant - Last-modified and Expires MIME (John Peacock  2000) | 
I decided I was sick of not being able to View Source on my generatedpages, so I coded up the following include file to send the proper MIMEheaders for Last-modified and Expires.  It is so complex because all MIME date/time values must be sent as UTC (GMT).  Since this is true, it is truly bizarre that the WebCat [date] function does not have a format, say %G, that outputs the correct string format automaticallyfor the timezone the server is locate in (including Daylight SavingsTime).  I checked, and the Win32 libraries do include a function gmtime() that takes a time structure and returns it as UTC time.It would also be nice if [math date] understood that if I write:  [math date&format=%a, %d %b %Y]{[date]}+{04:10:00}[/math] GMTI mean that it should take the current date and time, add 4 hours and 10 minutes and then format it as Thu, 17 Aug 2000 14:00:58 GMT for example.  This would also have to include carry from the time to the date, so that when the time goes past midnight as a result of an addition, it would add to the day (possibly carrying to the month and year as well).Alternatively, there could be a system setting so that WebCatalog wouldalways generate the appropriate MIME headers for Last-modified and Expires, with a system wide default Expires offset.  Since we can override any MIME headers that WebCat would want to send with our own[setmimeheader], I don't see how this could be a problem for anyone.If anyone wanted to not use it at all, simply set the Expires offset=0.In any case, here is the source code to enable proper MIME headers forLast-modified and Expires to put in your Globals directory.Share and enjoy...John Peacock[!]  ------- MIMEHeaders.inc -------  [/!][!]4:00 is offset from UTC - replace with your offset[/!][math time&show=f]GMT={[date %X]}+{04:00:00}[/math][math time&show=f]NOW={[date %X]}[/math][SETMIMEHEADER name=Last-modified&value=  [date format=%a, %d]   [if ([GMT]>[NOW])][!]if GMT before midnight[/!]  [then]    [date format=%b]  [/then]  [else][!]if GMT after midnight then increment date too[/!]    [format days_to_date %b][math]{[date]}+{00/01/0000}[/math][/format]  [/else]  [/if]  [date format=%Y] [Format Seconds_To_Time][GMT][/Format] GMT][SETMIMEHEADER name=Expires&value=  [date format=%a, %d]  [if ([GMT]>[NOW])]  [then]    [date format=%b]  [/then]  [else]    [format days_to_date %b][math]{[date]}+{00/01/0000}[/math][/format]  [/else]  [/if]  [!]600 will give a 10 minute expiration[/!]  [date format=%Y] [FormatSeconds_To_Time][math][GMT]+600[/math][/Format] GMT]-------------------------------------------------------------This message is sent to you because you are subscribed to  the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
John Peacock 
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
 
Not really WebCat (1997)
 
WebCat2b12 CGI Mac - [shownext] problem (1997)
 
 Search: Is this possible? (2005)
 
not interpreting Q (2001)
 
[url] link (1998)
 
Using Cookie for client specific info? (1997)
 
WebCat2 - Getting to the browser's username/password data (1997)
 
WebCat2_Mac RETURNs in .db (1997)
 
WebCatalog Beta Documentation (1997)
 
WebCatalog for Postcards ? (1997)
 
E-mailer error codes (1997)
 
Webstar 1.3.1 PPC (1997)
 
Nested search index (2000)
 
Email Problems on 4.0 (2000)
 
[WebDNA] agree? --> [url] broken inside [redirect], on a square-bracket-style include, included from a XML-style page (2009)
 
pop up building with summarize (1998)
 
Dummy Credit Card Number for debug? (1997)
 
[WebDNA] divisible by 1 (2011)
 
Beta5??? (2000)
 
 Help Please WebDNA 6 Secure Forms Problem (2004)