Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Send-Last-modified sends Thu, 01 Jan 1970 00:00:00 GMT
If I have the Preference “Send “Last-Modified” header?” activated. The Header Response for last-modified is set to “Thu, 01 Jan 1970 00:00:00 GMT”.
I have done a complete clean install of txp 4.8.8, diagnostics are fine, I have evend tried switching the theme but the problem persists on all sites.
Do you have any idea, what the problem could be?
Offline
Re: Send-Last-modified sends Thu, 01 Jan 1970 00:00:00 GMT
The reason must be here. Our pre-4.8.8 rfc822 format was not the true RFC822 but valid for last-modified
header. Now it’s correct but invalid header-wise (should be RFC7231). Most servers are permissive, but probably not yours. To fix, I’m afraid, the only way is to edit txplib_misc.php
file, replacing rfc822
in handle_lastmod()
function with '%a, %d %b %Y %H:%M:%S GMT'
. Sorry for that.
Offline
Re: Send-Last-modified sends Thu, 01 Jan 1970 00:00:00 GMT
etc wrote #335149:
the only way is to edit
txplib_misc.php
file, replacingrfc822
inhandle_lastmod()
function with'%a, %d %b %Y %H:%M:%S GMT'
.
Can we raise a callback in handle_lastmod()
(or safe_strftime()
???) so someone whose server is affected can at least plugin their way to a solution?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Send-Last-modified sends Thu, 01 Jan 1970 00:00:00 GMT
Bloke wrote #335150:
Can we raise a callback in
handle_lastmod()
(orsafe_strftime()
???) so someone whose server is affected can at least plugin their way to a solution?
It’s hopefully fixed in 4.9, though someone should test it on a misbehaving server (I’ve got none).
Actually, placing this in the page template might work too (untested):
<txp:php>
// Make sure lastmod isn't in the future.
$unix_ts = min(get_lastmod(), time());
$last = gmdate('D, d M Y H:i:s \G\M\T', $unix_ts);
header("Last-Modified: $last", true);
</txp:php>
Offline