Welcome Guest, Not a member yet? Register   Sign In
Caching and headers
#51

[eluser]Aquillyne[/eluser]
[quote author="Randy Casburn" date="1216780923"]CI MIME type caching.

Possible Help Documentation
---------------------------
By default, when caching is turned on, CI will cache your output as type text/html.

Simultaneous caching of other MIME types is also supported. This would allow you to maintain a long term cache of one file while periodically updating other files without the need to update your entire cache. As an example, you may send dynamic CSS from a View file and have that CSS saved to a cache. The CSS cache file may rarely change. The CSS styles may apply to an HTML View file that is saved to a separate cache file that can change independently of the CSS cache. This could also apply to a separate JavaScript file built from a View file and saved independently to a separate cache file. Now if you edit your JavaScript View content the only the JavaScript cache will require a refresh while the other cache files will remain untouched.[/quote]

I don't like this shift back to focus on MIME-types. Nor do I like the idea of default caching as text/html! PHP and CI may be designed with html in mind, but they aren't capable of nothing but that. That seems limiting, and furthermore a limitation, a "my html way or explicitly override on my highway" sort of thing.

I'm not really proposing all this as a solution to caching MIME-types as much as a solution to caching headers i.e. meta-data, in general. Because that's the problem. Meta-data is attached to the document, but stripped from it in the cache.

Here's an example not to do with mime-types. Let's just say you want to cache your error 404 page. Your 404 page outputs the header "HTTP 1.0 404 Page Not Found" (I can't remember the exact wording of that header, but you get the picture: it's not a mime-type). Well, when that 404 page is served from the cache it won't have that header anymore!

There are two things that a server side script is responsible for, regards the client-end browser: giving it content, and giving it headers. Currently, CI strips off those headers when caching is turned on.

It's that very, very general problem I want to patch.
#52

[eluser]Randy Casburn[/eluser]
So you want to cache this then:

Code:
HTTP/1.x 404 Not Found
Date: Tue, 22 Jul 2008 22:06:17 GMT
Server: Apache/2.0.52 (Red Hat)
Content-Length: 359
Keep-Alive: timeout=2, max=148
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

[ edit ] That's the full 404 header...the whole thing. And you want to cache the whole thing. Right?

NOT just the FIRST line. Please be precise. I'll ask the same thing of beemr, as maybe the only part that is important to him is the LAST line. But I don't know.

[end edit ]

Randy
#53

[eluser]Randy Casburn[/eluser]
You've lost my support. Sorry.

I've tried to get you to zero in so we could build support for a SPECIFIC resolution to a SPECIFIC deficiency with a SPECIFIC goal in mind.

And you come back with this...

Quote:It’s that very, very general problem I want to patch.

I've unsubscribed from this thread.

Randy
#54

[eluser]Aquillyne[/eluser]
[quote author="Randy Casburn" date="1216782483"]So you want to cache this then:
Code:
HTTP/1.x 404 Not Found
Date: Tue, 22 Jul 2008 22:06:17 GMT
Server: Apache/2.0.52 (Red Hat)
Content-Length: 359
Keep-Alive: timeout=2, max=148
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
[/quote]

Nope. I want to cache THIS:

Code:
$this->output->set_header("HTTP/1.0 404 Not Found");

i.e., whatever output the programmer has specified. Of course I don't want to cache every header; tons of them are automated and nothing to do with the programmer. But if the programmer has specified that he wants the header "HTTP/1.0 404 Not Found", I want that cached, so that his specified header is there next time too.
#55

[eluser]Aquillyne[/eluser]
[quote author="Randy Casburn" date="1216783869"]You've lost my support. Sorry.[/quote]

Lol. Oh well!

But it's because of how general the problem is that I'm making the suggestion at all. If it was specific I'd have written my own extension and been done with it. I'm suggesting a core change just because it's a general problem.
#56

[eluser]Randy Casburn[/eluser]
LOL for sure...

if(

Code:
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;title&gt;&lt;?=$app_title?&gt;&lt;/title&gt;
        &lt;link rel="shortcut icon" href="/logo.ico" /&gt;
        &lt;link rel="favicon" href="/logo.ico" /&gt;
        &lt;meta http-equiv="Cache-Control" content="no-cache" /&gt;
        &lt;meta http-equiv="Cache-Control" content="no-store" /&gt;
        &lt;meta http-equiv="Expires" content="0" /&gt;
        &lt;meta http-equiv="Pragma" content="no-cache" /&gt;
        &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;
        &lt;meta http-equiv="Content-Language" content="en-us" /&gt;
        &lt;meta name="abstract" content="&lt;?=$app_title?&gt;" /&gt;
        &lt;meta name="author" content="&lt;?=$app_author?&gt;" /&gt;
        &lt;meta name="distribution" content="global" /&gt;
        &lt;meta name="rating" content="general" /&gt;
        &lt;meta name="ROBOTS" content="NONE" /&gt;
        &lt;meta name="MSSmartTagsPreventParsing" content="true" /&gt;
        &lt;meta name="Keywords" content="&lt;?=$app_keywords?&gt;" /&gt;
        &lt;meta name="Description" content="&lt;?=$app_description?&gt;" /&gt;
        &lt;meta name="Copyright" content="&lt;?=$app_copyright?&gt;" /&gt;
&lt;/head&gt;

== IN THE VIEW) {

My headers are cached, and problem is solved

}

Hence no reason to waste my time on this any longer. LoL...indeed.

good day.
#57

[eluser]beemr[/eluser]
[quote author="Randy Casburn" date="1216785544"]Hence no reason to waste my time on this any longer. LoL...indeed.

good day.[/quote]

Wow. Step away to the gym for an hour and look what happens. :bug:

If you're still reading, Randy, thanks for trying to progress the discussion.

[quote author="Aquillyne" date="1216780983"]This was my original gripe. It's a horrible MY_Output extension. The code I've given is a mix of original code and basically 10 lines of new or changed code. You'd have to extend the output class and override 2 core functions, each of which is about 70 lines long - so 140 lines - just to effectively change 10 lines. It's ugly.[/quote]

@Aquillyne - Funny thing is, I think this extendability is one of CodeIgniter's more distinguishing benefits. I've extended Validation, URI, Output, and Session. All the while, I've updated from the svn trunk at least once a week. I've been caching headers and overloading controllers since May, yet in all that time only one variable has been regressed in my code.

Even if your changes happen to be the final say, I'd still suggest that you make a MY_Output until Ellis makes them official. It's the best way to build up momentum.
#58

[eluser]Aquillyne[/eluser]
[quote author="Randy Casburn" date="1216785544"]

if(

Code:
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;title&gt;&lt;?=$app_title?&gt;&lt;/title&gt;
        &lt;link rel="shortcut icon" href="/logo.ico" /&gt;
        &lt;link rel="favicon" href="/logo.ico" /&gt;
        &lt;meta http-equiv="Cache-Control" content="no-cache" /&gt;
        &lt;meta http-equiv="Cache-Control" content="no-store" /&gt;
        &lt;meta http-equiv="Expires" content="0" /&gt;
        &lt;meta http-equiv="Pragma" content="no-cache" /&gt;
        &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;
        &lt;meta http-equiv="Content-Language" content="en-us" /&gt;
        &lt;meta name="abstract" content="&lt;?=$app_title?&gt;" /&gt;
        &lt;meta name="author" content="&lt;?=$app_author?&gt;" /&gt;
        &lt;meta name="distribution" content="global" /&gt;
        &lt;meta name="rating" content="general" /&gt;
        &lt;meta name="ROBOTS" content="NONE" /&gt;
        &lt;meta name="MSSmartTagsPreventParsing" content="true" /&gt;
        &lt;meta name="Keywords" content="&lt;?=$app_keywords?&gt;" /&gt;
        &lt;meta name="Description" content="&lt;?=$app_description?&gt;" /&gt;
        &lt;meta name="Copyright" content="&lt;?=$app_copyright?&gt;" /&gt;
&lt;/head&gt;

== IN THE VIEW) {

My headers are cached, and problem is solved

}[/quote]

You can't always specify headers in the view. CSS, images, etc., which need mime-type headers, can't have those hard-written in. 404's can't have hard-coded headers.
#59

[eluser]Aquillyne[/eluser]
[quote author="beemr" date="1216788561"]Even if your changes happen to be the final say, I'd still suggest that you make a MY_Output until Ellis makes them official. It's the best way to build up momentum.[/quote]

Okay fair enough. I'll post an extension for now. But I'd still like to see backing for a patch if you agree it's a good idea.
#60

[eluser]Randy Casburn[/eluser]
I'm glad you edited your post. My attempts at helping you recognize inconsistencies in what you've presented along the way have failed and I accept responsibility for that. I'm sorry I have not been a better facilitator. On the other hand, if you continue to try to discredit me, I will continue to point out inconsistencies in your approach. It would be best if you simply left my attempts to normalize the discussion as they stand.

Earlier you said...
Quote:I don’t like this shift back to focus on MIME-types.

Now you say...

Quote:You can’t always specify headers in the view. CSS, images, etc., which need mime-type headers...

It would seem you are going in circles. In one post you don't want a thing to do with the MIME types, but here you seem to insist the MIME type header is the most relevant header for some, but not all, doc types.

You see, this lack of consistency was all I was attempting to get you to recognize earlier.




Theme © iAndrew 2016 - Forum software by © MyBB