Make WordPress Core

Changeset 347


Ignore:
Timestamp:
08/26/2003 05:07:36 PM (23 years ago)
Author:
emc3
Message:

Added support for Conditional GET

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2rdf.php

    r302 r347  
    33$doing_rss=1;
    44header('Content-type: text/xml');
     5
     6// Handle Conditional GET
     7
     8// Get the time of the most recent article
     9$sql = "SELECT max(post_date) FROM $tableposts";
     10
     11$maxdate = $wbdp->get_var($sql);
     12
     13$unixtime = strtotime($maxdate);
     14
     15// format timestamp for Last-Modified header
     16$last = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
     17
     18// send it in a Last-Modified header
     19header("Last-Modified: $last");
     20
     21// compare it to aggregator's If_Modified_Since
     22// if they match, send a 304 and die
     23if ($_SERVER[HTTP_IF_MODIFIED_SINCE] == $last){
     24    header("HTTP/1.1 304 Not Modified");
     25    exit;
     26}
     27
     28
    529include('blog.header.php');
    630add_filter('the_content', 'trim');
  • trunk/b2rss.php

    r302 r347  
    44$doing_rss=1;
    55header('Content-type: text/xml');
     6
     7// Handle Conditional GET
     8
     9// Get the time of the most recent article
     10$sql = "SELECT max(post_date) FROM $tableposts";
     11
     12$maxdate = $wbdp->get_var($sql);
     13
     14$unixtime = strtotime($maxdate);
     15
     16// format timestamp for Last-Modified header
     17$last = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
     18
     19// send it in a Last-Modified header
     20header("Last-Modified: $last");
     21
     22// compare it to aggregator's If_Modified_Since
     23// if they match, send a 304 and die
     24if ($_SERVER[HTTP_IF_MODIFIED_SINCE] == $last){
     25    header("HTTP/1.1 304 Not Modified");
     26    exit;
     27}
     28
     29
    630include('blog.header.php');
    731if (!isset($rss_language)) { $rss_language = 'en'; }
  • trunk/b2rss2.php

    r302 r347  
    44$doing_rss=1;
    55header('Content-type: text/xml');
     6
     7// Handle Conditional GET
     8
     9// Get the time of the most recent article
     10$sql = "SELECT max(post_date) FROM $tableposts";
     11
     12$maxdate = $wbdp->get_var($sql);
     13
     14$unixtime = strtotime($maxdate);
     15
     16// format timestamp for Last-Modified header
     17$last = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
     18
     19// send it in a Last-Modified header
     20header("Last-Modified: $last");
     21
     22// compare it to aggregator's If_Modified_Since
     23// if they match, send a 304 and die
     24if ($_SERVER[HTTP_IF_MODIFIED_SINCE] == $last){
     25    header("HTTP/1.1 304 Not Modified");
     26    exit;
     27}
     28
    629include('blog.header.php');
    730if (!isset($rss_language)) { $rss_language = 'en'; }
Note: See TracChangeset for help on using the changeset viewer.