Fellow monks,

I have a rather obscure (to me) problem. I'm working on a prototype with mod_perl and am running into an issue with progogating path_info. Here's a general overview of the prototype:

A URL such as http://www.myserver.com/app/id should default to http://www.myserver.com/app/id/step_one. I have a fixup handler on app that handles this correctly (??? - in that step_one is added to path_info).

The HTML generated contains a real generic form action - "step_two."

Here's the issue, when invoked as http://www.myserver.com/app/id/step_one - the id is propogated and step_two is invoked properly (/app/id/step_two); however, when invoked as http://www.myserver.com/app/id, the id is not propogated and the action is incorrectly invoked (/app/step_two).

I'm not sure what to set in the fixup handler to properly propogate the id when modifying the path info. Below is the the handler.

sub handler { my $r = shift; my( $id, $step ) = (split( /\//, $r->path_info ))[1,2]; if( ! $step ) { $step = "step_one"; # Seems to have no bearing on $ENV{REQUEST_URI} my $ruri = $r->uri . "/" . $step; $r->uri( $ruri ); $r->subprocess_env( REQUEST_URI => $ruri ); $ENV{REQUEST_URI} = $ruri; # Modify path_info my $pinfo = $r->path_info . "/" . $step; $r->path_info( $pinfo ); $r->subprocess_env( PATH_INFO => $pinfo ); $ENV{PATH_INFO} = $pinfo; } ....

Of course, this is a problem with my not understanding how a relative url is properly resolved (and where in the apache lifecycle I can influence it). I also tried setting SCRIPT_URI, SCRIPT_NAME and SCRIPT_URL via subprocess_env and ENV mangling.

Any ideas?

-derby


In reply to mod_perl and propogating path_info by derby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.