Loading ...
Sorry, an error occurred while loading the content.

Can't add an `Expires' header manually in new versions

Expand Messages
  • ivan
    In Apache::ASP 2.30, $Response- AddHeader( Expires = 0); triggers this fatal error: Response- ExpiresAbsolute(): date format 0 not accepted at
    Message 1 of 7 , Feb 15 2:43 PM
    • 0 Attachment
      In Apache::ASP 2.30,

      $Response->AddHeader('Expires' => 0);

      triggers this fatal error:

      Response->ExpiresAbsolute(): date format 0 not accepted at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 3946

      This worked in Apache::ASP 2.07.

      How do I manually set the Expires header with new versions? Since this is
      for a publicly distributed application, I'm interested in supporting old
      versions too, when possible.

      If there is any additional information it would be useful for me to
      provide please let me know.

      --
      _ivan

      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Joshua Chamas
      ... The latest Apache::ASP release code makes the $Response- AddHeader() code go through the ExpiresAbsolute API for the Expires header. This is good in that
      Message 2 of 7 , Feb 15 3:05 PM
      • 0 Attachment
        ivan wrote:
        >
        > In Apache::ASP 2.30,
        >
        > $Response->AddHeader('Expires' => 0);
        >
        > triggers this fatal error:
        >
        > Response->ExpiresAbsolute(): date format 0 not accepted at /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 3946
        >

        The latest Apache::ASP release code makes the $Response->AddHeader()
        code go through the ExpiresAbsolute API for the Expires header.
        This is good in that people setting ExpiresAbsolute as a
        member & as a header won't create duplicate headers as
        was the point of the fix.

        > This worked in Apache::ASP 2.07.
        >
        > How do I manually set the Expires header with new versions? Since this is
        > for a publicly distributed application, I'm interested in supporting old
        > versions too, when possible.
        >

        In your case I think this caught a bug in your program, and
        would call this good behavior of the application. The Expires
        header is supposed to be an HTTP date header of a very particular
        format, not 0 which is likely an illegal value ( not sure but probably ).
        This format is:

        Wed, 09 Feb 1994 22:23:32 GMT

        which is what one would expect being passed to

        $Response->AddHeader('Expires', $value);
        or with direct API
        $Response->{ExpiresAbsolute} = $value;

        What you probably should use for what you want is

        $Response->{Expires} = 0;

        which will convert 0 to the HTTP date formatted for the
        currect system time. Note that because this expiration
        is web client driven, and because client system clocks may
        be set incorrectly, you should probably set 0 to be a large
        negative number like:

        $Response->{Expires} = 86400 * -400; # expires 400 days ago

        This will let the page to expire immediately for even clock set
        to a year behind!! ( probably a more frequent occurance that one might think )

        --Josh

        _________________________________________________________________
        Joshua Chamas Chamas Enterprises Inc.
        NodeWorks Founder Huntington Beach, CA USA
        http://www.nodeworks.com 1-714-625-4051

        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • John D. Leonard II
        All: I m tryin to get the error document facility working for 401 error (authorization failure.) My first try was to simply add the following code in the
        Message 3 of 7 , Mar 8, 2002
        • 0 Attachment
          All:

          I'm tryin to get the error document facility working for 401 error
          (authorization failure.) My first try was to simply add the following
          code in the Script_OnStart

          sub Script_OnStart{
          $Response->ErrorDocument('401',<<EOF);
          <html>
          <body>
          <h1>Nee-ner nee-ner nee-ner</h1>
          You can't get me!
          </body>
          </html>
          EOF
          }


          However, when I hit a protected page and fail out, the standard message
          is shown.

          Am I missing some configuration setting somewhere (perhaps in the
          httpd.conf?)

          Thanks,

          JL


          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Joshua Chamas
          ... I am not sure that this will work because the 401 auth layer will be executed prior to Script_OnStart, or the Apache::ASP handler even, so your code never
          Message 4 of 7 , Mar 8, 2002
          • 0 Attachment
            "John D. Leonard II" wrote:
            >
            > All:
            >
            > I'm tryin to get the error document facility working for 401 error
            > (authorization failure.) My first try was to simply add the following
            > code in the Script_OnStart
            >
            > sub Script_OnStart{
            > $Response->ErrorDocument('401',<<EOF);
            > <html>
            > <body>
            > <h1>Nee-ner nee-ner nee-ner</h1>
            > You can't get me!
            > </body>
            > </html>
            > EOF
            > }
            >
            > However, when I hit a protected page and fail out, the standard message
            > is shown.
            >

            I am not sure that this will work because the 401 auth layer will
            be executed prior to Script_OnStart, or the Apache::ASP handler even,
            so your code never gets a chance to run.

            For your purposes, you might do what you want better by using
            Apache->custom_response API directly in a early mod_perl request
            stage, or the Apache ErrorDocument config.

            --Josh

            _________________________________________________________________
            Joshua Chamas Chamas Enterprises Inc.
            NodeWorks Founder Huntington Beach, CA USA
            http://www.nodeworks.com 1-714-625-4051

            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          • John D. Leonard II
            ... Do you know if the Apache ErrorDocument code will process an ApacheASP document? I d like to use my existing ASP application to present the error
            Message 5 of 7 , Mar 8, 2002
            • 0 Attachment
              Josh:

              > For your purposes, you might do what you want better by using
              > Apache->custom_response API directly in a early mod_perl request
              > stage, or the Apache ErrorDocument config.

              Do you know if the Apache ErrorDocument code will process an ApacheASP
              document? I'd like to use my existing ASP application to present the
              error messages.

              JL


              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...
            • Joshua Chamas
              ... If ErrorDocument specifies a file name that would normally be executed as an ASP script, then yes, your script will work for it just fine. --Josh
              Message 6 of 7 , Mar 8, 2002
              • 0 Attachment
                "John D. Leonard II" wrote:
                >
                > Josh:
                >
                > > For your purposes, you might do what you want better by using
                > > Apache->custom_response API directly in a early mod_perl request
                > > stage, or the Apache ErrorDocument config.
                >
                > Do you know if the Apache ErrorDocument code will process an ApacheASP
                > document? I'd like to use my existing ASP application to present the
                > error messages.
                >

                If ErrorDocument specifies a file name that would normally be
                executed as an ASP script, then yes, your script will work for it
                just fine.

                --Josh
                _________________________________________________________________
                Joshua Chamas Chamas Enterprises Inc.
                NodeWorks Founder Huntington Beach, CA USA
                http://www.nodeworks.com 1-714-625-4051

                ---------------------------------------------------------------------
                To unsubscribe, e-mail: asp-unsubscribe@...
                For additional commands, e-mail: asp-help@...
              • Ellers
                ... In my work I used the following in the httpd.conf to handle missing document (404) requests. Presumable 401 would work identically? ErrorDocument 404
                Message 7 of 7 , Mar 8, 2002
                • 0 Attachment
                  At 12:45 PM -0800 8/3/02, Joshua Chamas wrote:
                  >"John D. Leonard II" wrote:
                  >>
                  > > I'm tryin to get the error document facility working for 401 error
                  > > (authorization failure.)
                  >...
                  > > However, when I hit a protected page and fail out, the standard message
                  >> is shown.
                  >>
                  >...
                  >For your purposes, you might do what you want better by using
                  >Apache->custom_response API directly in a early mod_perl request
                  >stage, or the Apache ErrorDocument config.

                  In my work I used the following in the httpd.conf to handle missing
                  document (404) requests. Presumable 401 would work identically?

                  ErrorDocument 404 /404.asp

                  Then in 404.asp you can put whatever you want.

                  HTH
                  Ellers

                  ---------------------------------------------------------------------
                  To unsubscribe, e-mail: asp-unsubscribe@...
                  For additional commands, e-mail: asp-help@...
                Your message has been successfully submitted and would be delivered to recipients shortly.