You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Günter Knauf <ef...@gmx.net> on 2004/01/29 12:39:12 UTC

[PATCH] make mod_jk2 default port configurable

Hi all,
I've the problem that 8009 is already used on NetWare, so it would be nice if I could default to another port for that platform; I looked at the sources, and it looks if someone had already such an idea, but didnt finish....
found some defines in ./native2/common/jk_worker_ajp13.c which I moved to jk_global.h, then I replaced every 8009 with AJP13_DEF_PORT, and while on that I also replaced "127.0.0.1" with AJP13_DEF_HOST ...

complete patch can be found here (the list still removes my attachments):
http://www.gknw.com/test/native2_default_port.diff

Guenter.

=============================================================================
--- ./native2/include/jk_global.h.orig	Thu Nov 20 06:15:00 2003
+++ ./native2/include/jk_global.h		Thu Jan 29 02:45:42 2004
@@ -128,6 +128,16 @@
 #define JK_VERSION JK_MAKEVERSION(JK_VERMAJOR, JK_VERMINOR, JK_VERFIX, JK_VERBETA)
 
 
+#define AJP_DEF_RETRY_ATTEMPTS    (2)
+#define AJP13_PROTO 13
+
+#define AJP13_DEF_HOST "127.0.0.1"
+#ifdef NETWARE
+    #define AJP13_DEF_PORT 9009    /* default to 9009 since 8009 is used by OS */
+#else
+    #define AJP13_DEF_PORT 8009
+#endif
+
 #ifdef WIN32
     #include <windows.h>
     #include <winsock.h>

=============================================================================
--- ./native2/common/jk_channel_apr_socket.c.orig	Fri Oct 31 00:15:04 2003
+++ ./native2/common/jk_channel_apr_socket.c		Thu Jan 29 11:56:28 2004
@@ -70,8 +70,6 @@
 #include "jk_global.h"
 #include "jk_registry.h"
 
-#define DEFAULT_HOST "127.0.0.1"
-
 /** Information specific for the socket channel
  */
 struct jk_channel_apr_private {
@@ -179,7 +177,7 @@
         char *portIdx=strchr( localName, ':' );
 
         if( portIdx==NULL || portIdx[1]=='\0' ) {
-            socketInfo->port=8009;
+            socketInfo->port=AJP13_DEF_PORT;
         } else {
             portIdx++;
             socketInfo->port=atoi( portIdx );
@@ -196,10 +194,10 @@
     }
     
     if( socketInfo->port<=0 )
-        socketInfo->port=8009;
+        socketInfo->port=AJP13_DEF_PORT;
 
     if( socketInfo->host==NULL )
-        socketInfo->host=DEFAULT_HOST;
+        socketInfo->host=AJP13_DEF_HOST;
 
     rc=jk2_channel_apr_resolve( env, socketInfo->host, socketInfo->port, socketInfo );
     if( rc!= JK_OK ) {

=============================================================================
--- ./native2/common/jk_channel_socket.c.orig	Fri Oct 31 00:15:04 2003
+++ ./native2/common/jk_channel_socket.c		Thu Jan 29 02:43:48 2004
@@ -94,8 +94,6 @@
 #include "apr_general.h"
 #endif
 
-#define DEFAULT_HOST "127.0.0.1"
-
 /** Information specific for the socket channel
  */
 struct jk_channel_socket_private {
@@ -199,12 +197,12 @@
         char *localName=ch->mbean->localName;
         if( *localName=='\0' ) {
             /* Empty local part */
-            socketInfo->port=8009;
-            if( socketInfo->host==NULL) socketInfo->host=DEFAULT_HOST;
+            socketInfo->port=AJP13_DEF_PORT;
+            if( socketInfo->host==NULL) socketInfo->host=AJP13_DEF_HOST;
         } else {
             char *portIdx=strchr( localName, ':' );
             if( portIdx==NULL || portIdx[1]=='\0' ) {
-                socketInfo->port=8009;
+                socketInfo->port=AJP13_DEF_PORT;
             } else {
                 portIdx++;
                 socketInfo->port=atoi( portIdx );
@@ -224,11 +222,11 @@
     /* error if port= 40009 ( for example */
     /*
       if( socketInfo->port<=0 )
-        socketInfo->port=8009;
+        socketInfo->port=AJP13_DEF_PORT;
     */
     
     if( socketInfo->host==NULL )
-        socketInfo->host=DEFAULT_HOST;
+        socketInfo->host=AJP13_DEF_HOST;
     
     rc=jk2_channel_socket_resolve( env, socketInfo->host, socketInfo->port, &socketInfo->addr );
     if( rc!= JK_OK ) {

=============================================================================
--- ./native2/common/jk_worker_ajp13.c.orig	Fri Oct 31 00:15:04 2003
+++ ./native2/common/jk_worker_ajp13.c		Thu Jan 29 02:35:56 2004
@@ -75,12 +75,6 @@
 #include "jk_requtil.h"
 #include "jk_registry.h"
 
-#define AJP_DEF_RETRY_ATTEMPTS    (2)
-#define AJP13_PROTO 13
-
-#define AJP13_DEF_HOST  ("localhost")
-#define AJP13_DEF_PORT  (8009)
-
 /* -------------------- Impl -------------------- */
 static char *jk2_worker_ajp13_getAttributeInfo[]={ "lb_factor", "lb_value", "debug", "channel", "level",
                                                    "route", "routeRedirect", "errorState", "graceful", "groups", "disabled", 


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


Re: [PATCH] make mod_jk2 default port configurable

Posted by Günter Knauf <ef...@gmx.net>.
> Committed thanks.
thanks very much!!

Guenter.



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


Re: [PATCH] make mod_jk2 default port configurable

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Günter Knauf wrote:
> Hi all,
> I've the problem that 8009 is already used on NetWare, so it would be nice if I could default to another port for that platform; I looked at the sources, and it looks if someone had already such an idea, but didnt finish....
> found some defines in ./native2/common/jk_worker_ajp13.c which I moved to jk_global.h, then I replaced every 8009 with AJP13_DEF_PORT, and while on that I also replaced "127.0.0.1" with AJP13_DEF_HOST ...
> 
> complete patch can be found here (the list still removes my attachments):
> http://www.gknw.com/test/native2_default_port.diff

Committed thanks.

> 
> Guenter.
> 
> =============================================================================
> --- ./native2/include/jk_global.h.orig	Thu Nov 20 06:15:00 2003
> +++ ./native2/include/jk_global.h		Thu Jan 29 02:45:42 2004
> @@ -128,6 +128,16 @@
>  #define JK_VERSION JK_MAKEVERSION(JK_VERMAJOR, JK_VERMINOR, JK_VERFIX, JK_VERBETA)
>  
>  
> +#define AJP_DEF_RETRY_ATTEMPTS    (2)
> +#define AJP13_PROTO 13
> +
> +#define AJP13_DEF_HOST "127.0.0.1"
> +#ifdef NETWARE
> +    #define AJP13_DEF_PORT 9009    /* default to 9009 since 8009 is used by OS */
> +#else
> +    #define AJP13_DEF_PORT 8009
> +#endif
> +
>  #ifdef WIN32
>      #include <windows.h>
>      #include <winsock.h>
> 
> =============================================================================
> --- ./native2/common/jk_channel_apr_socket.c.orig	Fri Oct 31 00:15:04 2003
> +++ ./native2/common/jk_channel_apr_socket.c		Thu Jan 29 11:56:28 2004
> @@ -70,8 +70,6 @@
>  #include "jk_global.h"
>  #include "jk_registry.h"
>  
> -#define DEFAULT_HOST "127.0.0.1"
> -
>  /** Information specific for the socket channel
>   */
>  struct jk_channel_apr_private {
> @@ -179,7 +177,7 @@
>          char *portIdx=strchr( localName, ':' );
>  
>          if( portIdx==NULL || portIdx[1]=='\0' ) {
> -            socketInfo->port=8009;
> +            socketInfo->port=AJP13_DEF_PORT;
>          } else {
>              portIdx++;
>              socketInfo->port=atoi( portIdx );
> @@ -196,10 +194,10 @@
>      }
>      
>      if( socketInfo->port<=0 )
> -        socketInfo->port=8009;
> +        socketInfo->port=AJP13_DEF_PORT;
>  
>      if( socketInfo->host==NULL )
> -        socketInfo->host=DEFAULT_HOST;
> +        socketInfo->host=AJP13_DEF_HOST;
>  
>      rc=jk2_channel_apr_resolve( env, socketInfo->host, socketInfo->port, socketInfo );
>      if( rc!= JK_OK ) {
> 
> =============================================================================
> --- ./native2/common/jk_channel_socket.c.orig	Fri Oct 31 00:15:04 2003
> +++ ./native2/common/jk_channel_socket.c		Thu Jan 29 02:43:48 2004
> @@ -94,8 +94,6 @@
>  #include "apr_general.h"
>  #endif
>  
> -#define DEFAULT_HOST "127.0.0.1"
> -
>  /** Information specific for the socket channel
>   */
>  struct jk_channel_socket_private {
> @@ -199,12 +197,12 @@
>          char *localName=ch->mbean->localName;
>          if( *localName=='\0' ) {
>              /* Empty local part */
> -            socketInfo->port=8009;
> -            if( socketInfo->host==NULL) socketInfo->host=DEFAULT_HOST;
> +            socketInfo->port=AJP13_DEF_PORT;
> +            if( socketInfo->host==NULL) socketInfo->host=AJP13_DEF_HOST;
>          } else {
>              char *portIdx=strchr( localName, ':' );
>              if( portIdx==NULL || portIdx[1]=='\0' ) {
> -                socketInfo->port=8009;
> +                socketInfo->port=AJP13_DEF_PORT;
>              } else {
>                  portIdx++;
>                  socketInfo->port=atoi( portIdx );
> @@ -224,11 +222,11 @@
>      /* error if port= 40009 ( for example */
>      /*
>        if( socketInfo->port<=0 )
> -        socketInfo->port=8009;
> +        socketInfo->port=AJP13_DEF_PORT;
>      */
>      
>      if( socketInfo->host==NULL )
> -        socketInfo->host=DEFAULT_HOST;
> +        socketInfo->host=AJP13_DEF_HOST;
>      
>      rc=jk2_channel_socket_resolve( env, socketInfo->host, socketInfo->port, &socketInfo->addr );
>      if( rc!= JK_OK ) {
> 
> =============================================================================
> --- ./native2/common/jk_worker_ajp13.c.orig	Fri Oct 31 00:15:04 2003
> +++ ./native2/common/jk_worker_ajp13.c		Thu Jan 29 02:35:56 2004
> @@ -75,12 +75,6 @@
>  #include "jk_requtil.h"
>  #include "jk_registry.h"
>  
> -#define AJP_DEF_RETRY_ATTEMPTS    (2)
> -#define AJP13_PROTO 13
> -
> -#define AJP13_DEF_HOST  ("localhost")
> -#define AJP13_DEF_PORT  (8009)
> -
>  /* -------------------- Impl -------------------- */
>  static char *jk2_worker_ajp13_getAttributeInfo[]={ "lb_factor", "lb_value", "debug", "channel", "level",
>                                                     "route", "routeRedirect", "errorState", "graceful", "groups", "disabled", 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 
> 



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