Menu

ATTENTION IE6.0 + Cache header+PHPLIB

Help
2002-07-12
2002-07-12
  • Nikolas Hagelstein

    Hi

    i spend the whole last night figuring out the following:

    IE6.0 has massive problems handling no-caching headers.

    First for PHPLIB 7.2d users:

    --
    <? page_open(array("sess" => "mysess","auth" => "myauth"));
    header ("Content-type: application/pdf");
    header("Content-disposition: inline; filename=test.pdf");
    $length = filesize("a.pdf");
    header ("Content-length: $length");

    readfile("a.pdf");
    page_close();?>
    --
    If allow-caching is set to no
    page_open sends a :
    --
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache");
    header("Cache-Control: post-check=0, pre-check=0");
    header("Pragma: no-cache");
    --
    It seems as if IE6.0 is not interpreting the content-type, an content-disposion header
    after the no caching header is send.

    it makes no difference if you are using phplib
    or your are sending the caching header manual.

    workaround :

    Commenting out the header lines in session.inc or add a parameter to the page_open function to turn on/off nocaching.

    Further more it seems as if this is only occuring on a ssl connection.

    hopefully this information will prevent others from running in that pitfall.

    if i am wrong or someone discovers another solution -> please keep me informed.

    testsystem was :
    apache 1.3.20 + php 4.0.6 (linux 2.4.18)

    regards,
    niko

    this message has also been postet at phpbuilder.com

     
    • Layne Weathers

      Layne Weathers - 2002-07-12

      This has been around since at least IE 5.5 - the problem is only manifested when viewing files other than text/html and images over an SSL connection. In my implementation I am calling page_open() in a prepended file, so in the few scripts where I was sending other files, I sent additional headers that overrode the headers sent by Session. I found the following to work:

      header("Expires: " . gmdate("D, d M Y H:i:s", time() + 1440 * 60) . " GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) . " GMT");
      header("Cache-Control: public");
      header("Cache-Control: max-age=" . 1440 * 60, false);
      header("Pragma: public");

      header("Content-Type: httpd/send-as-is");
      readfile($FR."files/$file_md5");

       

Log in to post a comment.