Thanks,

I'll use the

return 'https' if uc($self->https()) eq 'ON';

approach.


At 5:06 PM -0700 10/2/03, Stas Bekman wrote:
Matisse Enzer wrote:



-------------8<---------- Start Bug Report ------------8<---------- 1. Problem Description:

I tried:
   my $scheme = APR::URI->parse($r->pool, $r->uri)->scheme;

and it didn't seem to work. My server is on port 9000 but I got nothing in $scheme.

Ai, my bad, sorry about that. I *should* have tested that.


I don't think you can get the request's scheme, because the server doesn't know it. it's only used by the client. The server gets only the request URI.

You can get the scheme only if you know the whole thing, e.g.:

APR::URI->parse($r->pool, "http://localhost:9000/foo/bar";)->scheme;

You can check what's the currently used protocol with $r->protocol, but it'll be the same with http:// and https://. CGI.pm does:

sub protocol {
    local($^W)=0;
    my $self = shift;
    return 'https' if uc($self->https()) eq 'ON';
    return 'https' if $self->server_port == 443;
    my $prot = $self->server_protocol;
    my($protocol,$version) = split('/',$prot);
    return "\L$protocol\E";
}

so you can either use CGI.pm or copy it away.

__________________________________________________________________
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


--
------------------------------------------
Matisse Enzer
Doodlelab Inc.
415-925-5294 ext. 212 (office)
415-225-6703 (mobile)

Reply via email to