hi all...

        I found the below discussion in the archives...  while Doug's
suggestion helps fill in some of the missing uri info, I still am having
trouble isolating $uri->user and $uri->password, and $uri->hostinfo in a
PerlTransHandler...

that is, given: http://foo:[EMAIL PROTECTED] I can't seem to get at the
user/pass combo, either by parsing hostinfo myself or using the user() and
password() methods.  All hooks are enabled - is there something else I
should be looking for?

PerlTransHandler snippet:

use Apache::URI;
use strict;

sub handler {

  my $r                 = shift;
  my $log               = $r->server->log;

  my $uri               = Apache::URI->parse($r);
  my $user              = $uri->user;
  my $pass              = $uri->password;
  my $hostinfo          = $uri->hostinfo;

  $log->info("user: $user password: $pass hostinfo: $hostinfo");
}

both $user and $pass are blank, while $hostinfo contains www.baz.com. Any
ideas why user:pass are not part of the request object?

--Geoff





Subject:      Re: Apache::URI
Author:       Doug MacEachern <[EMAIL PROTECTED]>
Date:         Thu, 23 Sep 1999 12:49:07 -0700 (PDT)

On Thu, 23 Sep 1999, Clinton Gormley wrote:
> 
> For a URL like this : 
> https://www.domain.com:443/exec/cellar

Apache only sees /exec/cellar in the uri, unless it's a proxy request.
you can build the complete URI, see chapter 9, also on www.modperl.com:

If the URI argument is omitted, the I<parse()> method will construct a
fully qualified URI from B<$r> object, including the scheme, hostname,
port, path and query string.  Example:

 my $self_uri = Apache::URI->parse($r);

-Doug

Subject:      Apache::URI
Author:       Clinton Gormley <[EMAIL PROTECTED]>
Date:         Thu, 23 Sep 1999 19:38:16 +0100

What am I doing wrong here?

       use Apache::URI();
        my $uri = $r->parsed_uri;
        warn "Fragment ".$uri->fragment;
        warn "hostinfo ".$uri->hostinfo;
        warn "path_info ".$uri->path_info;
        warn "port ".$uri->port;
        warn "rpath ".$uri->rpath;
        warn "scheme ".$uri->scheme;
        warn "user ".$uri->user;
        warn "unparse ".$uri->unparse;

For a URL like this : 
https://www.domain.com:443/exec/cellar

gives me this :

Fragment  at /apache/lib/perl/Apache/Exec.pm line 67.
hostinfo  at /apache/lib/perl/Apache/Exec.pm line 68.
path_info /cellar at /apache/lib/perl/Apache/Exec.pm line 69.
port  at /apache/lib/perl/Apache/Exec.pm line 70.
rpath /exec at /apache/lib/perl/Apache/Exec.pm line 71.
scheme  at /apache/lib/perl/Apache/Exec.pm line 72.
user  at /apache/lib/perl/Apache/Exec.pm line 73.
unparse /exec/cellar at /apache/lib/perl/Apache/Exec.pm line 74.

So it leaves out scheme, hostinfo and port.  Why?  Any ideas?

Thanks

Clint

Reply via email to