Greetings,

I have a url:

http://localhost/

That displays a page that just has a login screen (takes a username
and a password).
When login is clicked the server then destroys that container, and
creates a container with a menu (with its menu root path set to "/").
It creates an item that is another container that has its own menu as
well (base root path for that menu is "/user/") that displays the user
information.

When the browser supports javascript, when a person logs in it then
automatically goes to the first menu item (which is the user page),
then that user page goes to its first menu item (this is all in one
request, you all certainly know how menu's work better then I do),
which then loads the user information (currently a blank page).

When the browser has javascript disabled (which will happen in the
place this will be used at times) it then causes an infinite redirect
causing the browser to abort with the standard "detected that the
server is redirecting the request for this address in a way that will
never complete." type error.  Upon debugging through the server, it
appears that at in webrenderer.c starting on line 693 (I am using the
latest git trunk as of about a week ago) is this section of code (nice
mix of tabs and space, looks really odd in my IDE :) ) is this:

  if (!app->environment().ajax()
      && (response.requestMethod() == "POST"
          || (app->internalPathIsChanged_
              && app->oldInternalPath_ != app->newInternalPath_)))
    session_.redirect(app->bookmarkUrl(app->newInternalPath_));

Well, the browser just so happens to not support ajax, so this if is
taken.  The request is GET, not POST, however the
internalPathIsChanged boolean is set to true, and oldInternalPath_
does not euqal newInternalPath_ since oldInternalPath_ == "/" and
newInternalPath_ == "/user/info/", and so it calls for a redirect.
The interesting bit is, oldInternalPath_ is *never* set to
newInternalPath_ in any of this redirect calls, and
internalPathIsChanged is *never* set to false because, guess what, the
code right underneath the above lines:

  std::string redirect = session_.getRedirect();

  if (!redirect.empty()) {
    std::cerr << "Redirect: " << redirect << std::endl;
    response.setRedirect(redirect);
    return;
  }

And the line that resets the internalPathIsChanged boolean to false as
at the very end of that function, many many many lines down.

Also, the oldInternalPath_ is only ever set, in the entire source, in
WApplication::setInternalPath, which is is never called during any of
the infinite redirect loops at any point time.

Thus it seems that there are two distinct issues that are contributing
to the infinite redirect.  I do not know which to fix, or even how to
fix them (still learning the Wt code).

Does anyone have any fixes?  Any work-arounds?  Anything?







 websession.c starting on line 1181 (I am using the latest git trunk
as of about a week ago) is this section of code (nice mix of tabs and
space, looks really odd in my IDE :) ):
          if (event.responseType == WebRenderer::Page) {
            if (!request.pathInfo().empty())
              app_->changeInternalPath(request.pathInfo());
            else {
              const std::string *hashE = request.getParameter("_");
              if (hashE)
                app_->changeInternalPath(*hashE);
            }

It end up following the else of the second level if so
app_->changeInternalPath(*hashE); (where hashE == "/user/info") ends
up getting called.  This

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to