Apache::URI port() problem
Hello, It seems the method unparse() of Apache::URI does not take the port value into the result string. For example, I have: my $uri = Apache::URI->parse($r, $r->uri); $uri->scheme('http'); $uri->hostname($r->get_server_name); $uri->port(8080); $uri->query(scalar $r->args); If I call $uri->unparse(), the string returned does not have port 8080 in it. Can anyone shed some light? Thanks. Fred Xia
RE: Apache::URI port() problem
> Hello, > > It seems the method unparse() of Apache::URI does not take the port > value into the result string. For example, I have: > > my $uri = Apache::URI->parse($r, $r->uri); > $uri->scheme('http'); > $uri->hostname($r->get_server_name); > $uri->port(8080); > $uri->query(scalar $r->args); > > If I call $uri->unparse(), the string returned does not have port 8080 > in it. Can anyone shed some light? Thanks. > > Fred Xia Can you try this patch? Index: URI.xs === RCS file: /home/cvs/modperl/src/modules/perl/URI.xs,v retrieving revision 1.5 diff -b -u -u -r1.5 URI.xs --- URI.xs 1998/11/13 03:27:52 1.5 +++ URI.xs 2000/04/10 10:57:54 @@ -183,6 +183,9 @@ CODE: get_set_PVp(uri->uri.port_str,uri->pool); +if (items > 1) { +uri->uri.port = (int)SvIV(ST(1)); +} OUTPUT: RETVAL -- Eric
Re: Apache::URI port() problem
It works! Thanks so much! Fred Eric Cholet wrote: > > Hello, > > > > It seems the method unparse() of Apache::URI does not take the port > > value into the result string. For example, I have: > > > > my $uri = Apache::URI->parse($r, $r->uri); > > $uri->scheme('http'); > > $uri->hostname($r->get_server_name); > > $uri->port(8080); > > $uri->query(scalar $r->args); > > > > If I call $uri->unparse(), the string returned does not have port 8080 > > in it. Can anyone shed some light? Thanks. > > > > Fred Xia > > Can you try this patch? > > Index: URI.xs > === > RCS file: /home/cvs/modperl/src/modules/perl/URI.xs,v > retrieving revision 1.5 > diff -b -u -u -r1.5 URI.xs > --- URI.xs 1998/11/13 03:27:52 1.5 > +++ URI.xs 2000/04/10 10:57:54 > @@ -183,6 +183,9 @@ > > CODE: > get_set_PVp(uri->uri.port_str,uri->pool); > +if (items > 1) { > +uri->uri.port = (int)SvIV(ST(1)); > +} > > OUTPUT: > RETVAL > > -- > Eric >