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

Re: Apache2::Cookie confusing path and domain

Expand Messages
  • Philip M. Gollucci
    ... I found the problem but I m not sure where to implement the solution in the apreq-code base yet. Given this: my $cookie = APR::Request::Cookie- new($req,
    Message 1 of 25 , Jun 30, 2005
    • 0 Attachment
      Gokul P. Nair wrote:
      > --- "Philip M. Gollucci" <pgollucci@...> wrote:
      >>Crap I missed the missing name.
      >>
      >>Didn't try expires. Its probably a bug.
      >>
      >>If you're interested in fixing it, you'll want to
      >>look at
      >>glue/perl/APR/Request/Cookie.xs
      I found the problem but I'm not sure where to implement the solution in
      the apreq-code base yet.

      Given this:

      my $cookie = APR::Request::Cookie->new($req, name => "foo", value =>
      time(), path => '/cookie');

      print STDERR "$cookie\n";
      print STDERR Dumper $cookie;
      print STDERR "name: " . $cookie->name() . "\n";

      Prints:
      1120197880
      $VAR1 = bless( do{\(my $o = 163598384)}, 'APR::Request::Cookie' );
      name: foo


      the first line should have been

      foo=1120197880; path=/cookie;

      the "as_string()" method being called by "" overloading is apparently
      not the same one as the Apache2::Cookie. The APR::Request::Cookie only
      returns the value not the full stringification.




      --
      END
      ------------------------------------------------------------
      What doesn't kill us can only make us stronger.
      Nothing is impossible.

      Philip M. Gollucci (pgollucci@...) 301.254.5198
      Consultant / http://p6m7g8.net/Resume/resume.shtml
      Senior Developer / Liquidity Services, Inc.
      http://www.liquidityservicesinc.com
    • Gokul P. Nair
      ... Thats right, it says this in the documentation in CPAN: The double-quote interpolation operator maps to APR::Request::Cookie::value() So its supposed to
      Message 2 of 25 , Jul 1, 2005
      • 0 Attachment
        > the "as_string()" method being called by ""
        > overloading is apparently
        > not the same one as the Apache2::Cookie. The
        > APR::Request::Cookie only
        > returns the value not the full stringification.

        Thats right, it says this in the documentation in
        CPAN:
        "The double-quote interpolation operator maps to
        APR::Request::Cookie::value()"

        So its supposed to be returning just the value and not
        the entire cookie string, but I'm not sure what this
        would have to do with the "name" or "expires" tag not
        being set under the cookie?

        Thanks

        Gokul P. Nair

        --- "Philip M. Gollucci" <pgollucci@...> wrote:

        > Gokul P. Nair wrote:
        > > --- "Philip M. Gollucci" <pgollucci@...>
        > wrote:
        > >>Crap I missed the missing name.
        > >>
        > >>Didn't try expires. Its probably a bug.
        > >>
        > >>If you're interested in fixing it, you'll want to
        > >>look at
        > >>glue/perl/APR/Request/Cookie.xs
        > I found the problem but I'm not sure where to
        > implement the solution in
        > the apreq-code base yet.
        >
        > Given this:
        >
        > my $cookie = APR::Request::Cookie->new($req, name
        > => "foo", value =>
        > time(), path => '/cookie');
        >
        > print STDERR "$cookie\n";
        > print STDERR Dumper $cookie;
        > print STDERR "name: " . $cookie->name() .
        > "\n";
        >
        > Prints:
        > 1120197880
        > $VAR1 = bless( do{\(my $o = 163598384)},
        > 'APR::Request::Cookie' );
        > name: foo
        >
        >
        > the first line should have been
        >
        > foo=1120197880; path=/cookie;
        >
        > the "as_string()" method being called by ""
        > overloading is apparently
        > not the same one as the Apache2::Cookie. The
        > APR::Request::Cookie only
        > returns the value not the full stringification.
        >
        >
        >
        >
        > --
        > END
        >
        ------------------------------------------------------------
        > What doesn't kill us can only make us stronger.
        > Nothing is impossible.
        >
        > Philip M. Gollucci (pgollucci@...)
        > 301.254.5198
        > Consultant / http://p6m7g8.net/Resume/resume.shtml
        > Senior Developer / Liquidity Services, Inc.
        > http://www.liquidityservicesinc.com
        >




        __________________________________
        Discover Yahoo!
        Use Yahoo! to plan a weekend, have fun online and more. Check it out!
        http://discover.yahoo.com/
      • Gokul P. Nair
        also printf Set-Cookie: %s n , $cookie- as_string; displays the right values i.e. in my case Set-Cookie: foo=bar; path=/; expires=Sat, 02-Jul-2005 14:34:42
        Message 3 of 25 , Jul 1, 2005
        • 0 Attachment
          also
          printf "Set-Cookie: %s\n", $cookie->as_string;

          displays the right values i.e. in my case

          Set-Cookie: foo=bar; path=/; expires=Sat, 02-Jul-2005
          14:34:42 GMT

          Gokul P. Nair


          --- "Philip M. Gollucci" <pgollucci@...> wrote:

          > Gokul P. Nair wrote:
          > > --- "Philip M. Gollucci" <pgollucci@...>
          > wrote:
          > >>Crap I missed the missing name.
          > >>
          > >>Didn't try expires. Its probably a bug.
          > >>
          > >>If you're interested in fixing it, you'll want to
          > >>look at
          > >>glue/perl/APR/Request/Cookie.xs
          > I found the problem but I'm not sure where to
          > implement the solution in
          > the apreq-code base yet.
          >
          > Given this:
          >
          > my $cookie = APR::Request::Cookie->new($req, name
          > => "foo", value =>
          > time(), path => '/cookie');
          >
          > print STDERR "$cookie\n";
          > print STDERR Dumper $cookie;
          > print STDERR "name: " . $cookie->name() .
          > "\n";
          >
          > Prints:
          > 1120197880
          > $VAR1 = bless( do{\(my $o = 163598384)},
          > 'APR::Request::Cookie' );
          > name: foo
          >
          >
          > the first line should have been
          >
          > foo=1120197880; path=/cookie;
          >
          > the "as_string()" method being called by ""
          > overloading is apparently
          > not the same one as the Apache2::Cookie. The
          > APR::Request::Cookie only
          > returns the value not the full stringification.
          >
          >
          >
          >
          > --
          > END
          >
          ------------------------------------------------------------
          > What doesn't kill us can only make us stronger.
          > Nothing is impossible.
          >
          > Philip M. Gollucci (pgollucci@...)
          > 301.254.5198
          > Consultant / http://p6m7g8.net/Resume/resume.shtml
          > Senior Developer / Liquidity Services, Inc.
          > http://www.liquidityservicesinc.com
          >




          ____________________________________________________
          Yahoo! Sports
          Rekindle the Rivalries. Sign up for Fantasy Football
          http://football.fantasysports.yahoo.com
        • Philip M. Gollucci
          ... I agree. http://p6m7g8.net/cookie is update to the below: Seems to work for me. sub handler () { my $r = shift; my $req = $r- pool(); my $cookie =
          Message 4 of 25 , Jul 1, 2005
          • 0 Attachment
            Gokul P. Nair wrote:

            >also
            >printf "Set-Cookie: %s\n", $cookie->as_string;
            >
            >displays the right values i.e. in my case
            >
            >Set-Cookie: foo=bar; path=/; expires=Sat, 02-Jul-2005
            >14:34:42 GMT
            >
            >
            I agree.

            http://p6m7g8.net/cookie is update to the below:
            Seems to work for me.

            sub handler () {

            my $r = shift;
            my $req = $r->pool();

            my $cookie = APR::Request::Cookie->new($req, name => "foo",
            value => time(), path => '/cookie');

            $r->err_headers_out->add('Set-Cookie' => sprintf("%s",
            $cookie->as_string));

            $r->print("Content-Type: text/plain\n\n");
            $r->print("Testing....");
            printf "Set-Cookie: %s\n", $cookie->as_string;

            return Apache2::Const::OK;
            }


            --
            END
            ---------------------------------------------------------
            What doesn't kill us can only make us stronger.
            Nothing is impossible.

            Philip M. Gollucci (pgollucci@...) 301.254.5198
            Consultant / http://p6m7g8.net/Resume/resume.shtml
            Senior Developer / Liquidity Services, Inc.
            http://www.liquidityservicesinc.com
            http://www.liquidation.com
            http://www.uksurplus.com
            http://www.govliquidation.com
            http://www.gowholesale.com
          • Philip M. Gollucci
            ... http://marc.theaimsgroup.com/?l=apreq-dev&w=2&r=1&s=as_string&q=b You ll want to read these: 18. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies
            Message 5 of 25 , Jul 1, 2005
            • 0 Attachment
              Gokul P. Nair wrote:

              >>the "as_string()" method being called by ""
              >>overloading is apparently
              >>not the same one as the Apache2::Cookie. The
              >>APR::Request::Cookie only
              >>returns the value not the full stringification.
              >>
              >>
              >
              >Thats right, it says this in the documentation in
              >CPAN:
              >"The double-quote interpolation operator maps to
              >APR::Request::Cookie::value()"
              >
              >
              http://marc.theaimsgroup.com/?l=apreq-dev&w=2&r=1&s=as_string&q=b
              You'll want to read these:

              18. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111420593713351&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Joe Schaefer
              19. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111420527425190&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Bram
              20. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111420250532704&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Joe Schaefer
              21. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111420153519727&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Bram
              22. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111419549824225&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Joe Schaefer
              23. 2005-04-22 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111413763310734&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Joe Schaefer
              24. 2005-04-20 Re: Apache::Cookies vs CGI::Cookies <http://marc.theaimsgroup.com/?l=apreq-dev&m=111405159230934&w=2> apreq-dev <http://marc.theaimsgroup.com/?l=apreq-dev&w=2> Bram

              I knew I remembered reading that once you said it.

              --
              END
              ---------------------------------------------------------
              What doesn't kill us can only make us stronger.
              Nothing is impossible.

              Philip M. Gollucci (pgollucci@...) 301.254.5198
              Consultant / http://p6m7g8.net/Resume/resume.shtml
              Senior Developer / Liquidity Services, Inc.
              http://www.liquidityservicesinc.com
              http://www.liquidation.com
              http://www.uksurplus.com
              http://www.govliquidation.com
              http://www.gowholesale.com
            • Gokul P. Nair
              ... or the code below would suffice too. $r- headers_out- add( Set-Cookie = $cookie- as_string); Gokul P. Nair ... __________________________________ Discover
              Message 6 of 25 , Jul 1, 2005
              • 0 Attachment
                > $r->err_headers_out->add('Set-Cookie' =>
                > sprintf("%s",
                > $cookie->as_string));

                or the code below would suffice too.

                $r->headers_out->add('Set-Cookie'=>$cookie->as_string);

                Gokul P. Nair

                --- "Philip M. Gollucci" <pgollucci@...> wrote:

                > Gokul P. Nair wrote:
                >
                > >also
                > >printf "Set-Cookie: %s\n", $cookie->as_string;
                > >
                > >displays the right values i.e. in my case
                > >
                > >Set-Cookie: foo=bar; path=/; expires=Sat,
                > 02-Jul-2005
                > >14:34:42 GMT
                > >
                > >
                > I agree.
                >
                > http://p6m7g8.net/cookie is update to the below:
                > Seems to work for me.
                >
                > sub handler () {
                >
                > my $r = shift;
                > my $req = $r->pool();
                >
                > my $cookie = APR::Request::Cookie->new($req,
                > name => "foo",
                > value => time(), path => '/cookie');
                >
                > $r->err_headers_out->add('Set-Cookie' =>
                > sprintf("%s",
                > $cookie->as_string));
                >
                > $r->print("Content-Type: text/plain\n\n");
                > $r->print("Testing....");
                > printf "Set-Cookie: %s\n",
                > $cookie->as_string;
                >
                > return Apache2::Const::OK;
                > }
                >
                >
                > --
                > END
                >
                ---------------------------------------------------------
                > What doesn't kill us can only make us stronger.
                > Nothing is impossible.
                >
                > Philip M. Gollucci (pgollucci@...)
                > 301.254.5198
                > Consultant / http://p6m7g8.net/Resume/resume.shtml
                > Senior Developer / Liquidity Services, Inc.
                > http://www.liquidityservicesinc.com
                > http://www.liquidation.com
                > http://www.uksurplus.com
                > http://www.govliquidation.com
                > http://www.gowholesale.com
                >
                >
                >




                __________________________________
                Discover Yahoo!
                Get on-the-go sports scores, stock quotes, news and more. Check it out!
                http://discover.yahoo.com/mobile.html
              Your message has been successfully submitted and would be delivered to recipients shortly.