sessions and redirecting in opera

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rik

    #31
    Re: sessions and redirecting in opera

    On Mon, 13 Aug 2007 00:24:18 +0200, amygdala <noreply@norepl y.comwrote:
    Rik wrote:
    >On Fri, 10 Aug 2007 20:07:03 +0200, amygdala <noreply@norepl y.com>
    >wrote:
    >>>
    >>Could it be that Opera needs some kind of body content after a
    >>redirection
    >>header? Or could it perhaps be that Opera indeed thinks that it
    >>should redirect back to the login page again, since it is redirected
    >>to a page, that redirected to the login page in the first place. lol
    >>
    >Possiblity 1:
    >Opera -Tools -preferences -Advanced -Network -Enable
    >Automatic Redirection.
    >>
    >It's enabled by default, but can be disabled for whatever purpose.
    >All the more reason why a header redirect should be accompanied by
    >some information one is redirected, and a script should die()/exit()
    >after that.
    >Possibility 2:
    >Opera get's the redirect, but still has the page with the same URL in
    >cache, so decides to use that one. Set some header and/or html
    >information these pages should not be cached.
    >>
    >Possibility 3:
    >The script isn't terminated after the first header-redirect,
    >continues to run, and effectively changes the redirect by a second
    >header() call. Putting an echo directly after it will force the
    >headers to be sent, so they cannot be replaced anymore, resulting in
    >the first one being the only one, and thus the one obeyed by the
    >browser. Another example why one should die()/exit() after a redirect..
    >>
    ><?php
    >//this will offcourse end in /second.html
    >header('Locati on: /first.html');
    >header('Locati on: /second.html');
    >>>
    >>
    ><?php
    >//this will end in /first.html
    >header('Locati on: /first.html');
    >flush();
    >header('Locati on: /second.html');
    >
    This thing still has me puzzled. What I did is the following:
    >
    My SessionHandler class has the following method:
    >
    public function redirect( $url )
    {
    session_write_c lose();
    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-store, no-cache, must-revalidate' );
    header( 'Cache-Control: post-check=0, pre-check=0', false );
    header( 'Pragma: no-cache' );
    header( 'HTTP/1.0 302 Moved Temporarily' );
    header( 'Location: ' . $url );
    // this part between the comments is important
    echo 'You\'re being redirected to ' . $url . ' .
    Click <a href="' . $url. '">here</aif it doesn\'t work';
    // end important part
    exit(); // exit doesn't really make a difference for Opera
    }
    >
    Since I have now included the exit() statement I am sure that this is the
    last thing done by the application when redirecting. Also, I have added
    cache control headers and the likes. But still in Opera the problem
    persists
    if I leave out the echo part you see above between the comments.
    >
    So, from my experience it seems as if Opera wants some body content for
    the
    redirect to work and revalidate the url I landed on before I had to log
    in.
    Can you set this up somewhere accessable? I'm curious what happens if I
    try it in Opera here. Never gave me problems before.
    --
    Rik Wasmus

    Comment

    • amygdala

      #32
      Re: sessions and redirecting in opera

      Rik wrote:
      On Mon, 13 Aug 2007 00:24:18 +0200, amygdala <noreply@norepl y.com>
      wrote:
      >Rik wrote:
      >>On Fri, 10 Aug 2007 20:07:03 +0200, amygdala <noreply@norepl y.com>
      >>wrote:
      >>>>
      >>>Could it be that Opera needs some kind of body content after a
      >>>redirectio n
      >>>header? Or could it perhaps be that Opera indeed thinks that it
      >>>should redirect back to the login page again, since it is
      >>>redirected to a page, that redirected to the login page in the
      >>>first place. lol
      >>>
      >>Possiblity 1:
      >>Opera -Tools -preferences -Advanced -Network -Enable
      >>Automatic Redirection.
      >>>
      >>It's enabled by default, but can be disabled for whatever purpose.
      >>All the more reason why a header redirect should be accompanied by
      >>some information one is redirected, and a script should die()/exit()
      >>after that.
      >>Possibility 2:
      >>Opera get's the redirect, but still has the page with the same URL
      >>in cache, so decides to use that one. Set some header and/or html
      >>information these pages should not be cached.
      >>>
      >>Possibility 3:
      >>The script isn't terminated after the first header-redirect,
      >>continues to run, and effectively changes the redirect by a second
      >>header() call. Putting an echo directly after it will force the
      >>headers to be sent, so they cannot be replaced anymore, resulting in
      >>the first one being the only one, and thus the one obeyed by the
      >>browser. Another example why one should die()/exit() after a
      >>redirect. <?php
      >>//this will offcourse end in /second.html
      >>header('Locat ion: /first.html');
      >>header('Locat ion: /second.html');
      >>>>
      >>>
      >><?php
      >>//this will end in /first.html
      >>header('Locat ion: /first.html');
      >>flush();
      >>header('Locat ion: /second.html');
      >>
      >This thing still has me puzzled. What I did is the following:
      >>
      >My SessionHandler class has the following method:
      >>
      > public function redirect( $url )
      > {
      > session_write_c lose();
      > 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-store, no-cache, must-revalidate' );
      > header( 'Cache-Control: post-check=0, pre-check=0', false );
      > header( 'Pragma: no-cache' );
      > header( 'HTTP/1.0 302 Moved Temporarily' );
      > header( 'Location: ' . $url );
      > // this part between the comments is important
      > echo 'You\'re being redirected to ' . $url . ' .
      > Click <a href="' . $url. '">here</aif it doesn\'t work';
      > // end important part
      > exit(); // exit doesn't really make a difference for Opera
      > }
      >>
      >Since I have now included the exit() statement I am sure that this
      >is the last thing done by the application when redirecting. Also, I
      >have added cache control headers and the likes. But still in Opera
      >the problem persists
      >if I leave out the echo part you see above between the comments.
      >>
      >So, from my experience it seems as if Opera wants some body content
      >for the
      >redirect to work and revalidate the url I landed on before I had to
      >log in.
      >
      Can you set this up somewhere accessable? I'm curious what happens if
      I try it in Opera here. Never gave me problems before.
      Hi Rik,

      I've set up little example (without the echo part in the redirect method)
      which you should be able to access temporarily through:



      (Please let me know if you are not able to access it.)

      If all goes well, this will automatically redirect you to the login page.
      From there on use:

      username: demo
      password: demodemo (yes, 8 chars)

      In my Opera version (9.02) this brings up the login page again, instead of
      redirecting me to



      When I manually go to the above url after logging in, I do get to see a
      var_dump as intended.

      Bedankt alvast! (Thank you in advance)


      Comment

      • amygdala

        #33
        Re: sessions and redirecting in opera

        amygdala wrote:
        Rik wrote:
        >On Mon, 13 Aug 2007 00:24:18 +0200, amygdala <noreply@norepl y.com>
        >>>
        >>My SessionHandler class has the following method:
        >>>
        >> public function redirect( $url )
        >> {
        >> session_write_c lose();
        >> 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-store, no-cache, must-revalidate' );
        >> header( 'Cache-Control: post-check=0, pre-check=0', false );
        >> header( 'Pragma: no-cache' );
        >> header( 'HTTP/1.0 302 Moved Temporarily' );
        >> header( 'Location: ' . $url );
        >> // this part between the comments is important
        >> echo 'You\'re being redirected to ' . $url . ' .
        >> Click <a href="' . $url. '">here</aif it doesn\'t work';
        >> // end important part
        >> exit(); // exit doesn't really make a difference for Opera
        >> }
        >>>
        >>Since I have now included the exit() statement I am sure that this
        >>is the last thing done by the application when redirecting. Also, I
        >>have added cache control headers and the likes. But still in Opera
        >>the problem persists
        >>if I leave out the echo part you see above between the comments.
        >>>
        >>So, from my experience it seems as if Opera wants some body content
        >>for the
        >>redirect to work and revalidate the url I landed on before I had to
        >>log in.
        >>
        >Can you set this up somewhere accessable? I'm curious what happens if
        >I try it in Opera here. Never gave me problems before.
        >
        Hi Rik,
        >
        I've set up little example (without the echo part in the redirect
        method) which you should be able to access temporarily through:
        >

        >
        (Please let me know if you are not able to access it.)
        >
        If all goes well, this will automatically redirect you to the login
        page. From there on use:
        >
        username: demo
        password: demodemo (yes, 8 chars)
        >
        In my Opera version (9.02) this brings up the login page again,
        instead of redirecting me to
        >

        >
        When I manually go to the above url after logging in, I do get to see
        a var_dump as intended.
        >
        Bedankt alvast! (Thank you in advance)
        Alright, this is strange:

        When I access my own example through a proxy (using the above url) it works
        as intended. Come to think of it, I do recall reading somewhere that Opera
        sometimes has problems with cookies when developing on a localhost server.

        Are you aware of any such thing?


        Comment

        • Rik

          #34
          Re: sessions and redirecting in opera

          On Mon, 13 Aug 2007 11:53:58 +0200, amygdala <noreply@norepl y.comwrote:
          >>This thing still has me puzzled. What I did is the following:
          >>>
          >>My SessionHandler class has the following method:
          >>>
          >> public function redirect( $url )
          >> {
          >> session_write_c lose();
          >> 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-store, no-cache, must-revalidate' );
          >> header( 'Cache-Control: post-check=0, pre-check=0', false );
          >> header( 'Pragma: no-cache' );
          >> header( 'HTTP/1.0 302 Moved Temporarily' );
          >> header( 'Location: ' . $url );
          >> // this part between the comments is important
          >> echo 'You\'re being redirected to ' . $url . ' .
          >> Click <a href="' . $url. '">here</aif it doesn\'t work';
          >> // end important part
          >> exit(); // exit doesn't really make a difference for Opera
          >> }
          >>>
          >>Since I have now included the exit() statement I am sure that this
          >>is the last thing done by the application when redirecting. Also, I
          >>have added cache control headers and the likes. But still in Opera
          >>the problem persists
          >>if I leave out the echo part you see above between the comments.
          >>
          >Can you set this up somewhere accessable? I'm curious what happens if
          >I try it in Opera here. Never gave me problems before.
          >
          I've set up little example (without the echo part in the redirect method)
          which you should be able to access temporarily through:
          >

          >
          (Please let me know if you are not able to access it.)
          HTTP/1.x 302 Moved Temporarily
          ....
          Set-Cookie: PHPSESSID=jhikt dcd4efk720iqahh hquokhm24ill; path=/
          Set-Cookie: PHPSESSID=upgdi hd7gbiqnen492ad vkiu0c0piv4v; path=/
          Location: http://127.0.0.1/user/login/
          ....

          I haven't set up your site on my local box, so no, it's not working :).
          If all goes well, this will automatically redirect you to the login page.
          OK, on another domain perhaps, so that might get some freaky results in
          cookies/sessions. When I manually go to
          http://amygdala.kicks-ass.net/user/login/ I can see the form, and when
          logging in I'm again redirected to 127.0.0.1 (/profile/view/), which is
          offcourse not found. So, manually going to
          http://amygdala.kicks-ass.net/profile/view/, I get redirected without a
          hitch to http://amygdala.kicks-ass.net/profile/view/demo, and I see a
          var_dump of a User object, seems OK to me.

          Redirecting seems fine here (Opera 9.23), only to the wrong domain... I
          offcourse continuously get the 'page not found' for the 127.0.0.1
          redirects, but I am redirected nonetheless. What if you use the
          $_SERVER['HTTP_HOST'] in the url to which you redirect?
          Bedankt alvast! (Thank you in advance)
          Geen probleem :-)
          --
          Rik Wasmus

          Comment

          • Rik

            #35
            Re: sessions and redirecting in opera

            On Mon, 13 Aug 2007 12:04:54 +0200, amygdala <noreply@norepl y.comwrote:
            Alright, this is strange:
            >
            When I access my own example through a proxy (using the above url) it
            works
            as intended. Come to think of it, I do recall reading somewhere that
            Opera
            sometimes has problems with cookies when developing on a localhost
            server.
            >
            Are you aware of any such thing?
            Only domain conflicts if they aren't set properly :P
            --
            Rik Wasmus

            Comment

            • amygdala

              #36
              Re: sessions and redirecting in opera

              Jerry Stuckle wrote:
              amygdala wrote:
              >"Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
              >news:xqKdnb9U2 fBnMyLbnZ2dnUVZ _uLinZ2d@comcas t.com...
              >>amygdala wrote:
              >>>Rik wrote:
              >>>>On Fri, 10 Aug 2007 20:07:03 +0200, amygdala <noreply@norepl y.com>
              >>>>wrote:
              >>>>>Could it be that Opera needs some kind of body content after a
              >>>>>redirectio n
              >>>>>header? Or could it perhaps be that Opera indeed thinks that it
              >>>>>should redirect back to the login page again, since it is
              >>>>>redirect ed to a page, that redirected to the login page in the
              >>>>>first place. lol
              >>>>Possiblit y 1:
              >>>>Opera -Tools -preferences -Advanced -Network -Enable
              >>>>Automatic Redirection.
              >>>>>
              >>>>It's enabled by default, but can be disabled for whatever purpose.
              >>>>All the more reason why a header redirect should be accompanied by
              >>>>some information one is redirected, and a script should
              >>>>die()/exit() after that.
              >>>>Possibili ty 2:
              >>>>Opera get's the redirect, but still has the page with the same
              >>>>URL in cache, so decides to use that one. Set some header and/or
              >>>>html information these pages should not be cached.
              >>>>>
              >>>>Possibili ty 3:
              >>>>The script isn't terminated after the first header-redirect,
              >>>>continues to run, and effectively changes the redirect by a second
              >>>>header() call. Putting an echo directly after it will force the
              >>>>headers to be sent, so they cannot be replaced anymore, resulting
              >>>>in the first one being the only one, and thus the one obeyed by
              >>>>the browser. Another example why one should die()/exit() after a
              >>>>redirect. <?php
              >>>>//this will offcourse end in /second.html
              >>>>header('Loc ation: /first.html');
              >>>>header('Loc ation: /second.html');
              >>>><?php
              >>>>//this will end in /first.html
              >>>>header('Loc ation: /first.html');
              >>>>flush();
              >>>>header('Loc ation: /second.html');
              >>>This thing still has me puzzled. What I did is the following:
              >>>>
              >>>My SessionHandler class has the following method:
              >>>>
              >>> public function redirect( $url )
              >>> {
              >>> session_write_c lose();
              >>> 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-store, no-cache, must-revalidate'
              >>> ); header( 'Cache-Control: post-check=0, pre-check=0', false );
              >>> header( 'Pragma: no-cache' );
              >>> header( 'HTTP/1.0 302 Moved Temporarily' );
              >>> header( 'Location: ' . $url );
              >>> // this part between the comments is important
              >>> echo 'You\'re being redirected to ' . $url . ' .
              >>> Click <a href="' . $url. '">here</aif it doesn\'t work';
              >>> // end important part
              >>> exit(); // exit doesn't really make a difference for Opera
              >>> }
              >>>>
              >>>Since I have now included the exit() statement I am sure that this
              >>>is the last thing done by the application when redirecting. Also,
              >>>I have added cache control headers and the likes. But still in
              >>>Opera the problem persists if I leave out the echo part you see
              >>>above between the comments. So, from my experience it seems as if Opera
              >>>wants some body
              >>>content for the redirect to work and revalidate the url I landed
              >>>on before I had to log in.
              >>>>
              >>>Does anyone have any other clue as to what might be going on here?
              >>>>
              >>>Thanks.
              >>Why are you sending a message they will never see, anyway? Normally a
              >>redirect header has NO text associated with it.
              >>>
              >>If you have your header set up appropriately, they will be
              >>redirected. All the message might do is screw things up for the
              >>browser.
              >>
              >PS.: Correct me if I'm wrong, but are my headers not set up properly?
              >>
              >>
              >
              Well, I don't see why you have the session_write_c lose() - the session
              will be closed during exit() processing, anyway.
              >
              I also don't see why you have all of the cache control stuff. It's
              completely unnecessary in this case.
              >
              Keep it simple - the 302 moved and location should be all you need.
              I would think so to, but if you have read the entire thread you would see
              that I am having trouble with getting it to work as expected in Opera. So I
              thought I'ld use every option at my disposal to make sure the redirect and
              the session saving works as expected.

              But now, it looks like the Opera problem only exists when accessing the
              application local on localhost. (See my reply to Rik)


              Comment

              • amygdala

                #37
                Re: sessions and redirecting in opera

                Rik wrote:
                On Mon, 13 Aug 2007 11:53:58 +0200, amygdala <noreply@norepl y.com>
                wrote:
                >>>This thing still has me puzzled. What I did is the following:
                >>>>
                >>>My SessionHandler class has the following method:
                >>>>
                >>> public function redirect( $url )
                >>> {
                >>> session_write_c lose();
                >>> 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-store, no-cache, must-revalidate'
                >>> ); header( 'Cache-Control: post-check=0, pre-check=0', false );
                >>> header( 'Pragma: no-cache' );
                >>> header( 'HTTP/1.0 302 Moved Temporarily' );
                >>> header( 'Location: ' . $url );
                >>> // this part between the comments is important
                >>> echo 'You\'re being redirected to ' . $url . ' .
                >>> Click <a href="' . $url. '">here</aif it doesn\'t work';
                >>> // end important part
                >>> exit(); // exit doesn't really make a difference for Opera
                >>> }
                >>>>
                >>>Since I have now included the exit() statement I am sure that this
                >>>is the last thing done by the application when redirecting. Also, I
                >>>have added cache control headers and the likes. But still in Opera
                >>>the problem persists
                >>>if I leave out the echo part you see above between the comments.
                >>>
                >>Can you set this up somewhere accessable? I'm curious what happens
                >>if I try it in Opera here. Never gave me problems before.
                >>
                >I've set up little example (without the echo part in the redirect
                >method) which you should be able to access temporarily through:
                >>
                >http://amygdala.kicks-ass.net/profile/
                >>
                >(Please let me know if you are not able to access it.)
                >
                HTTP/1.x 302 Moved Temporarily
                ...
                Set-Cookie: PHPSESSID=jhikt dcd4efk720iqahh hquokhm24ill; path=/
                Set-Cookie: PHPSESSID=upgdi hd7gbiqnen492ad vkiu0c0piv4v; path=/
                Location: http://127.0.0.1/user/login/
                ...
                >
                I haven't set up your site on my local box, so no, it's not working
                :).
                Errrr, sorry about that Rik, forgot to change

                define( 'ROOT_PATH', 'http://' . $_SERVER['SERVER_NAME'] );

                to

                define( 'ROOT_PATH', 'http://amygdala.kicks-ass.net' );
                >If all goes well, this will automatically redirect you to the login
                >page.
                >
                OK, on another domain perhaps, so that might get some freaky results
                in cookies/sessions. When I manually go to
                http://amygdala.kicks-ass.net/user/login/ I can see the form, and when
                logging in I'm again redirected to 127.0.0.1 (/profile/view/), which
                is offcourse not found. So, manually going to
                http://amygdala.kicks-ass.net/profile/view/, I get redirected without
                a hitch to http://amygdala.kicks-ass.net/profile/view/demo, and I see
                a var_dump of a User object, seems OK to me.
                But then this should be OK indeed.
                Redirecting seems fine here (Opera 9.23), only to the wrong domain...
                I offcourse continuously get the 'page not found' for the 127.0.0.1
                redirects, but I am redirected nonetheless. What if you use the
                $_SERVER['HTTP_HOST'] in the url to which you redirect?
                >
                >Bedankt alvast! (Thank you in advance)
                >
                Geen probleem :-)
                Thanks again!


                Comment

                • Rik

                  #38
                  Re: sessions and redirecting in opera

                  On Mon, 13 Aug 2007 12:33:20 +0200, amygdala <noreply@norepl y.comwrote:
                  Rik wrote:
                  >>I've set up little example (without the echo part in the redirect
                  >>method) which you should be able to access temporarily through:
                  >>>
                  >>http://amygdala.kicks-ass.net/profile/
                  >>>
                  >>(Please let me know if you are not able to access it.)
                  >>
                  >HTTP/1.x 302 Moved Temporarily
                  >...
                  >Set-Cookie: PHPSESSID=jhikt dcd4efk720iqahh hquokhm24ill; path=/
                  >Set-Cookie: PHPSESSID=upgdi hd7gbiqnen492ad vkiu0c0piv4v; path=/
                  >Location: http://127.0.0.1/user/login/
                  >...
                  >>
                  >I haven't set up your site on my local box, so no, it's not working
                  >:).
                  >
                  Errrr, sorry about that Rik, forgot to change
                  >
                  define( 'ROOT_PATH', 'http://' . $_SERVER['SERVER_NAME'] );
                  >
                  to
                  >
                  define( 'ROOT_PATH', 'http://amygdala.kicks-ass.net' );
                  Ah, and everything works like a charm :P (allthough the double set-cookie
                  PHPSESSID should be taken care of).

                  So, possibly a server/domain issue somewhere when developing locally,
                  works OK on the net though.
                  --
                  Rik Wasmus

                  Comment

                  • amygdala

                    #39
                    Re: sessions and redirecting in opera

                    Rik wrote:
                    On Mon, 13 Aug 2007 12:04:54 +0200, amygdala <noreply@norepl y.com>
                    wrote:
                    >Alright, this is strange:
                    >>
                    >When I access my own example through a proxy (using the above url) it
                    >works
                    >as intended. Come to think of it, I do recall reading somewhere that
                    >Opera
                    >sometimes has problems with cookies when developing on a localhost
                    >server.
                    >>
                    >Are you aware of any such thing?
                    >
                    Only domain conflicts if they aren't set properly :P
                    Hehe, no this should not be the cause of this, since I just set up this
                    temporarily subdomain (through DynDNS.com) pointing to my local webserver
                    today. Usually I only develop locally, through 127.0.0.1.

                    But anyway, thanks for the help Rik.


                    Comment

                    • amygdala

                      #40
                      Re: sessions and redirecting in opera

                      Rik wrote:
                      On Mon, 13 Aug 2007 12:33:20 +0200, amygdala <noreply@norepl y.com>
                      wrote:
                      >Rik wrote:
                      >>>I've set up little example (without the echo part in the redirect
                      >>>method) which you should be able to access temporarily through:
                      >>>>
                      >>>http://amygdala.kicks-ass.net/profile/
                      >>>>
                      >>>(Please let me know if you are not able to access it.)
                      >>>
                      >>HTTP/1.x 302 Moved Temporarily
                      >>...
                      >>Set-Cookie: PHPSESSID=jhikt dcd4efk720iqahh hquokhm24ill; path=/
                      >>Set-Cookie: PHPSESSID=upgdi hd7gbiqnen492ad vkiu0c0piv4v; path=/
                      >>Location: http://127.0.0.1/user/login/
                      >>...
                      >>>
                      >>I haven't set up your site on my local box, so no, it's not working
                      >>:).
                      >>
                      >Errrr, sorry about that Rik, forgot to change
                      >>
                      >define( 'ROOT_PATH', 'http://' . $_SERVER['SERVER_NAME'] );
                      >>
                      >to
                      >>
                      >define( 'ROOT_PATH', 'http://amygdala.kicks-ass.net' );
                      >
                      Ah, and everything works like a charm :P (allthough the double
                      set-cookie PHPSESSID should be taken care of).
                      Well, this double Set-Cookie should indeed not be happening. Although I do
                      use session_regener ate_id() (paranoid mode ;) on every request. But I don't
                      suspect that that causes two set-cookie's in one response.

                      What kind of tool are you using to analyse/view this information if you
                      don't mind telling me? Is there any HTTPLiveHeader thingy for Opera I am not
                      aware of?

                      Thanks in advance
                      So, possibly a server/domain issue somewhere when developing locally,
                      works OK on the net though.
                      Looks like that is the case, yes.


                      Comment

                      • Jerry Stuckle

                        #41
                        Re: sessions and redirecting in opera

                        amygdala wrote:
                        Jerry Stuckle wrote:
                        >amygdala wrote:
                        >>"Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                        >>news:xqKdnb9U 2fBnMyLbnZ2dnUV Z_uLinZ2d@comca st.com...
                        >>>amygdala wrote:
                        >>>>Rik wrote:
                        >>>>>On Fri, 10 Aug 2007 20:07:03 +0200, amygdala <noreply@norepl y.com>
                        >>>>>wrote:
                        >>>>>>Could it be that Opera needs some kind of body content after a
                        >>>>>>redirecti on
                        >>>>>>header? Or could it perhaps be that Opera indeed thinks that it
                        >>>>>>should redirect back to the login page again, since it is
                        >>>>>>redirecte d to a page, that redirected to the login page in the
                        >>>>>>first place. lol
                        >>>>>Possibli ty 1:
                        >>>>>Opera -Tools -preferences -Advanced -Network -Enable
                        >>>>>Automati c Redirection.
                        >>>>>>
                        >>>>>It's enabled by default, but can be disabled for whatever purpose.
                        >>>>>All the more reason why a header redirect should be accompanied by
                        >>>>>some information one is redirected, and a script should
                        >>>>>die()/exit() after that.
                        >>>>>Possibilit y 2:
                        >>>>>Opera get's the redirect, but still has the page with the same
                        >>>>>URL in cache, so decides to use that one. Set some header and/or
                        >>>>>html information these pages should not be cached.
                        >>>>>>
                        >>>>>Possibilit y 3:
                        >>>>>The script isn't terminated after the first header-redirect,
                        >>>>>continue s to run, and effectively changes the redirect by a second
                        >>>>>header() call. Putting an echo directly after it will force the
                        >>>>>headers to be sent, so they cannot be replaced anymore, resulting
                        >>>>>in the first one being the only one, and thus the one obeyed by
                        >>>>>the browser. Another example why one should die()/exit() after a
                        >>>>>redirect . <?php
                        >>>>>//this will offcourse end in /second.html
                        >>>>>header('Lo cation: /first.html');
                        >>>>>header('Lo cation: /second.html');
                        >>>>><?php
                        >>>>>//this will end in /first.html
                        >>>>>header('Lo cation: /first.html');
                        >>>>>flush();
                        >>>>>header('Lo cation: /second.html');
                        >>>>This thing still has me puzzled. What I did is the following:
                        >>>>>
                        >>>>My SessionHandler class has the following method:
                        >>>>>
                        >>>> public function redirect( $url )
                        >>>> {
                        >>>> session_write_c lose();
                        >>>> 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-store, no-cache, must-revalidate'
                        >>>> ); header( 'Cache-Control: post-check=0, pre-check=0', false );
                        >>>> header( 'Pragma: no-cache' );
                        >>>> header( 'HTTP/1.0 302 Moved Temporarily' );
                        >>>> header( 'Location: ' . $url );
                        >>>> // this part between the comments is important
                        >>>> echo 'You\'re being redirected to ' . $url . ' .
                        >>>> Click <a href="' . $url. '">here</aif it doesn\'t work';
                        >>>> // end important part
                        >>>> exit(); // exit doesn't really make a difference for Opera
                        >>>> }
                        >>>>>
                        >>>>Since I have now included the exit() statement I am sure that this
                        >>>>is the last thing done by the application when redirecting. Also,
                        >>>>I have added cache control headers and the likes. But still in
                        >>>>Opera the problem persists if I leave out the echo part you see
                        >>>>above between the comments. So, from my experience it seems as if Opera
                        >>>>wants some body
                        >>>>content for the redirect to work and revalidate the url I landed
                        >>>>on before I had to log in.
                        >>>>>
                        >>>>Does anyone have any other clue as to what might be going on here?
                        >>>>>
                        >>>>Thanks.
                        >>>Why are you sending a message they will never see, anyway? Normally a
                        >>>redirect header has NO text associated with it.
                        >>>>
                        >>>If you have your header set up appropriately, they will be
                        >>>redirected . All the message might do is screw things up for the
                        >>>browser.
                        >>PS.: Correct me if I'm wrong, but are my headers not set up properly?
                        >>>
                        >>>
                        >Well, I don't see why you have the session_write_c lose() - the session
                        >will be closed during exit() processing, anyway.
                        >>
                        >I also don't see why you have all of the cache control stuff. It's
                        >completely unnecessary in this case.
                        >>
                        >Keep it simple - the 302 moved and location should be all you need.
                        >
                        I would think so to, but if you have read the entire thread you would see
                        that I am having trouble with getting it to work as expected in Opera. So I
                        thought I'ld use every option at my disposal to make sure the redirect and
                        the session saving works as expected.
                        >
                        But now, it looks like the Opera problem only exists when accessing the
                        application local on localhost. (See my reply to Rik)
                        >
                        >
                        Yes, I did read the entire thread. That's why I said it. Don't use
                        options just because they're there. Use them because there is a need
                        for them.

                        For instance - the cache control would have no effect on them, and using
                        them just complicates matters.

                        --
                        =============== ===
                        Remove the "x" from my email address
                        Jerry Stuckle
                        JDS Computer Training Corp.
                        jstucklex@attgl obal.net
                        =============== ===

                        Comment

                        • amygdala

                          #42
                          Re: sessions and redirecting in opera

                          Jerry Stuckle wrote:
                          amygdala wrote:
                          >Jerry Stuckle wrote:
                          >>amygdala wrote:
                          >>>"Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                          >>>news:xqKdnb9 U2fBnMyLbnZ2dnU VZ_uLinZ2d@comc ast.com...
                          >>>>amygdala wrote:
                          >>>>>Rik wrote:
                          >>>>>>On Fri, 10 Aug 2007 20:07:03 +0200, amygdala
                          >>>>>><noreply@ noreply.comwrot e:
                          >>>>>>>Could it be that Opera needs some kind of body content after a
                          >>>>>>>redirect ion
                          >>>>>>>header ? Or could it perhaps be that Opera indeed thinks that it
                          >>>>>>>should redirect back to the login page again, since it is
                          >>>>>>>redirect ed to a page, that redirected to the login page in the
                          >>>>>>>first place. lol
                          >>>>>>Possiblit y 1:
                          >>>>>>Opera -Tools -preferences -Advanced -Network -Enable
                          >>>>>>Automat ic Redirection.
                          >>>>>>>
                          >>>>>>It's enabled by default, but can be disabled for whatever
                          >>>>>>purpose . All the more reason why a header redirect should be
                          >>>>>>accompani ed by some information one is redirected, and a script
                          >>>>>>should die()/exit() after that.
                          >>>>>>Possibili ty 2:
                          >>>>>>Opera get's the redirect, but still has the page with the same
                          >>>>>>URL in cache, so decides to use that one. Set some header and/or
                          >>>>>>html information these pages should not be cached.
                          >>>>>>>
                          >>>>>>Possibili ty 3:
                          >>>>>>The script isn't terminated after the first header-redirect,
                          >>>>>>continu es to run, and effectively changes the redirect by a
                          >>>>>>second header() call. Putting an echo directly after it will
                          >>>>>>force the headers to be sent, so they cannot be replaced
                          >>>>>>anymore , resulting in the first one being the only one, and
                          >>>>>>thus the one obeyed by the browser. Another example why one
                          >>>>>>should die()/exit() after a redirect. <?php
                          >>>>>>//this will offcourse end in /second.html
                          >>>>>>header('L ocation: /first.html');
                          >>>>>>header('L ocation: /second.html');
                          >>>>>><?php
                          >>>>>>//this will end in /first.html
                          >>>>>>header('L ocation: /first.html');
                          >>>>>>flush() ;
                          >>>>>>header('L ocation: /second.html');
                          >>>>>This thing still has me puzzled. What I did is the following:
                          >>>>>>
                          >>>>>My SessionHandler class has the following method:
                          >>>>>>
                          >>>>> public function redirect( $url )
                          >>>>> {
                          >>>>> session_write_c lose();
                          >>>>> 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-store, no-cache, must-revalidate'
                          >>>>> ); header( 'Cache-Control: post-check=0, pre-check=0', false );
                          >>>>> header( 'Pragma: no-cache' );
                          >>>>> header( 'HTTP/1.0 302 Moved Temporarily' );
                          >>>>> header( 'Location: ' . $url );
                          >>>>> // this part between the comments is important
                          >>>>> echo 'You\'re being redirected to ' . $url . ' .
                          >>>>> Click <a href="' . $url. '">here</aif it doesn\'t work';
                          >>>>> // end important part
                          >>>>> exit(); // exit doesn't really make a difference for Opera
                          >>>>> }
                          >>>>>>
                          >>>>>Since I have now included the exit() statement I am sure that
                          >>>>>this is the last thing done by the application when redirecting.
                          >>>>>Also,
                          >>>>>I have added cache control headers and the likes. But still in
                          >>>>>Opera the problem persists if I leave out the echo part you see
                          >>>>>above between the comments. So, from my experience it seems as
                          >>>>>if Opera wants some body
                          >>>>>content for the redirect to work and revalidate the url I landed
                          >>>>>on before I had to log in.
                          >>>>>>
                          >>>>>Does anyone have any other clue as to what might be going on
                          >>>>>here? Thanks.
                          >>>>Why are you sending a message they will never see, anyway?
                          >>>>Normally a redirect header has NO text associated with it.
                          >>>>>
                          >>>>If you have your header set up appropriately, they will be
                          >>>>redirecte d. All the message might do is screw things up for the
                          >>>>browser.
                          >>>PS.: Correct me if I'm wrong, but are my headers not set up
                          >>>properly?
                          >>Well, I don't see why you have the session_write_c lose() - the
                          >>session will be closed during exit() processing, anyway.
                          >>>
                          >>I also don't see why you have all of the cache control stuff. It's
                          >>completely unnecessary in this case.
                          >>>
                          >>Keep it simple - the 302 moved and location should be all you need.
                          >>
                          >I would think so to, but if you have read the entire thread you
                          >would see that I am having trouble with getting it to work as
                          >expected in Opera. So I thought I'ld use every option at my disposal
                          >to make sure the redirect and the session saving works as expected.
                          >>
                          >But now, it looks like the Opera problem only exists when accessing
                          >the application local on localhost. (See my reply to Rik)
                          >>
                          >>
                          >
                          Yes, I did read the entire thread. That's why I said it. Don't use
                          options just because they're there. Use them because there is a need
                          for them.
                          I don't use them because they are there, I use them because every other
                          option in my mind was exhausted, so I thought I'ld give it a try and one by
                          one remove a header to see where the problem would arise in Opera. But I
                          started off putting them all in there for debugging purposes.

                          session_write_c lose(): because with Opera I was getting multiple session
                          entries in my DB. And I know this doesn't make sense logically (I can tell
                          client processes from server processes) and I know an exit() statement
                          should suffice, yada yada yada.

                          Cache-Control and other cache headers: because I thought Opera might somehow
                          not revalidate the initial redirected url.

                          But to tell you the truth, I don't see how any cache headers could harm:

                          header( 'HTTP/1.0 302 Moved Temporarily' );
                          header( 'Location: ' . $url );



                          Comment

                          Working...