Thanks.  How do I call construct_uri?

Neither

        my $uri = APR::URI->parse($r->pool,
$r->construct_url($r->pool, $r->uri, $r));
       $uri .= "r2=1";
        $r->headers_out->set(Location => $uri .
"&r2=1");
        return Apache::REDIRECT;


nor

        my $uri = APR::URI->parse($r->pool,
$r->construct_url);
       $uri .= "r2=1";
        $r->headers_out->set(Location => $uri .
"&r2=1");
        return Apache::REDIRECT;

works.

Thanks Stas for all your patience and help!



--- Stas Bekman <[EMAIL PROTECTED]> wrote:
> Tofu Optimist wrote:
> > Hi folks --
> > 
> > I'm using MP2, and I am trying to avoid loading
> CGI
> > for 2 reasons: 
> > 
> > (1) To save memory. 
> > 
> > (2) When I do load CGI, it fails at the "require
> > Apache" (line 161), and I'd prefer not to edit CGI
> on
> > my server.  Uck.
> > 
> > Given I'm not loading CGI, how can I determine
> > self_url() in MP2?
> > 
> > I tried something like this
> > <code>
> >         my $self_uri = APR::URI->parse($r->pool,
> > $r->uri)->unparse;
> >         $r->headers_out->set(Location => $self_uri
> .
> > "&r2=1");
> >         return Apache::REDIRECT;
> > </code>
> > but this gives me a partial URL, not the full
> > expansion.
> 
> $r->construct_url;
> 
>  From the C docs:
> 
> /* Used for constructing self-referencing URLs, and
> things like SERVER_PORT,
>   * and SERVER_NAME.
>   */
> /**
>   * build a fully qualified URL from the uri and
> information in the request rec
>   * @param p The pool to allocate the URL from
>   * @param uri The path to the requested file
>   * @param r The current request
>   * @return A fully qualified URL
>   * @deffunc char *ap_construct_url(apr_pool_t *p,
> const char *uri, 
> request_rec *r)
>   */
> AP_DECLARE(char *) ap_construct_url(apr_pool_t *p,
> const char *uri, 
> request_rec *r);
> 
>
__________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another
> mod_perl Hacker
> http://stason.org/     mod_perl Guide --->
> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org
> http://apacheweek.com
> http://modperlbook.org http://apache.org  
> http://ticketmaster.com
> 
> 
> 
> -- 
> Reporting bugs: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to