tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amund Elstad <Amund.Els...@ergo.no>
Subject RE: cvs commit: jakarta-tomcat-connectors/jk/native2/server/apach e2 mod_jk2.c
Date Mon, 23 Sep 2002 05:57:10 GMT
What's so bad about requiring the user to specify a port for all mappings
with a virtual host in workers2.properties ? You may be able to support one
default port (80 or 443), but not both without adding additional config
options in worker2.properties - or am I wrong ?

Although r->server->port may be 0, ap_get_server_port(r) may AFAIK not.

It is probably not a good idea to use req->hostname by default either,
because it is supplied by the client. For example (with req->hostname) to
have mod_jk2 serve:

        http://localhost/context/blah
and     http://127.0.0.1/context/blah

you will need to add a lot of extra configuration to workers2.properties (I
don't think the alias option works yet so duplication is needed).

Using req->server->server_hostname or ap_get_server_name(req) is IMO better.
ap_get_server_name(req) defaults to request->server->server_hostname but can
be configured (USE_CANONICAL_NAME) to return request->hostname or even do a
reverse
dns-lookup of the connection address.

So why not:

Index: mod_jk2.c
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.
c,v
retrieving revision 1.52
diff -u -r1.52 mod_jk2.c
--- mod_jk2.c	22 Sep 2002 09:35:46 -0000	1.52
+++ mod_jk2.c	22 Sep 2002 19:46:07 -0000
@@ -679,8 +679,10 @@
     */
     
     uriEnv = workerEnv->uriMap->mapUri(env, workerEnv->uriMap,
-                r->server->is_virtual ? r->hostname : NULL,
-                r->uri );
+                r->server->is_virtual ? 
+                    apr_psprintf(r->pool,"%s:%d", 
+                        ap_get_server_name(r),
+                        ap_get_server_port(r)) : NULL, r->uri );
 
     if( uriEnv== NULL || uriEnv->workerName == NULL) {
         workerEnv->globalEnv->releaseEnv( workerEnv->globalEnv, env );

-----Original Message-----
From: Ignacio J. Ortega [mailto:nacho@siapi.es]
Sent: 22. september 2002 20:07
To: 'Tomcat Developers List'; 'jakarta-tomcat-connectors-cvs@apache.org'
Subject: RE: cvs commit:
jakarta-tomcat-connectors/jk/native2/server/apach e2 mod_jk2.c


I agree that my patch is buggy in the case of a request coming from 80
or 443, but if we want to support port bases V hosting, we need to pass
it down, if not 

[uri:www.something.com:8080/somecontext]

Definitely will not work (this not works now i.e).. so to pass the port
as part of the hostname is needed when port is different from 80 and
443..

FOr the other 2 the is_virtual and the changes inside the mapper..

The initial idea was to do what isapi_redirector from jk does right now,
in jk i_r.dll there are 2 types of mappings:

1) globals ( for all VS and Default ) and 
2) particular ( for a concrete VS or Default )

This needs to do 2 passes for the mapper, one for the particular
mappings with host+port ( if not 80 or 443 ) as vhost, and if none found
other for the Global mappings with NULL as vhost.. that is what isapi
does..

For the mapper, i was trying to need only one pass in the mapper, but
after looking at the code, it was buggy, as VS request from a registered
vhost, never will be mapped to anything outside of that vhost, so it's
need to do the two passes..

So my grandtotal for my first commits after months is 2 bugs in 2
commits, nice startup, thanks Mladen.. ;)

Saludos ,
Ignacio J. Ortega


> -----Mensaje original-----
> De: mturk@apache.org [mailto:mturk@apache.org]
> Enviado el: 22 de septiembre de 2002 11:36
> Para: jakarta-tomcat-connectors-cvs@apache.org
> Asunto: cvs commit: 
> jakarta-tomcat-connectors/jk/native2/server/apache2
> mod_jk2.c
> 
> 
> mturk       2002/09/22 02:35:46
> 
>   Modified:    jk/native2/server/apache2 mod_jk2.c
>   Log:
>   Cannot use the hostname:server_port cause the port is 0 for all
>   host:80 requests. Also is_virtual is used for separating default and
>   virtual hosts. In case of default server host the hostname provided
>   to uriMap _MUST_ be NULL to be able to map the default uri:/
>   
>   Revision  Changes    Path
>   1.52      +2 -2      
> jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c
>   
>   Index: mod_jk2.c
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/
> mod_jk2.c,v
>   retrieving revision 1.51
>   retrieving revision 1.52
>   diff -u -r1.51 -r1.52
>   --- mod_jk2.c	22 Sep 2002 02:50:42 -0000	1.51
>   +++ mod_jk2.c	22 Sep 2002 09:35:46 -0000	1.52
>   @@ -679,7 +679,7 @@
>        */
>        
>        uriEnv = workerEnv->uriMap->mapUri(env, workerEnv->uriMap,
>   -                
> apr_psprintf(r->pool,"%s:%d",r->hostname,r->server->port),
>   +                r->server->is_virtual ? r->hostname : NULL,
>                    r->uri );
>    
>        if( uriEnv== NULL || uriEnv->workerName == NULL) {
>   
>   
>   
> 
> --
> To unsubscribe, e-mail:   
<mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message