tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From G√ľnter Knauf <efl...@gmx.net>
Subject [PATCH] ./jk/native2/server/apache2/mod_jk2.c compile with Apache 2.1
Date Tue, 30 Sep 2003 11:55:19 GMT
Hi,
with Apache 2.1 and APR 1.0 seems that apu_compat.h is removed (see APR-util Changes); 
attached a patch which works for me with both APR 0.9.4 and APR 1.0.0

Guenter.

###########################################################################################
# Patches needed to compile mod_jk2 with APR 1.0                                         
#
###########################################################################################
--- .\native2\common\jk_channel_apr_socket.c.orig	Thu Apr 03 19:35:10 2003
+++ .\native2\common\jk_channel_apr_socket.c	Tue Sep 30 05:26:38 2003
@@ -77,6 +77,7 @@
 #include "apr_network_io.h"
 #include "apr_errno.h"
 #include "apr_general.h"
+#include "apr_version.h"
 
 
 #define DEFAULT_HOST "127.0.0.1"
@@ -223,7 +224,10 @@
     int connected = 0;
 
     while (remote_sa && !connected) {
-        if ((ret = apr_socket_create(&sock, remote_sa->family, SOCK_STREAM,
+        if ((ret = apr_socket_create(&sock, remote_sa->family, SOCK_STREAM, 
+#if (APR_MAJOR_VERSION > 0) 
+                                     APR_PROTO_TCP,
+#endif
                                      (apr_pool_t *)env->globalPool->_private))
                                     != APR_SUCCESS) {
             if (remote_sa->next) {
@@ -256,7 +260,7 @@
 
         /* make the connection out of the socket */
         do { 
-            ret = apr_connect(sock, remote_sa);
+            ret = apr_socket_connect(sock, remote_sa);
         } while (APR_STATUS_IS_EINTR(ret));
         
         /* if an error occurred, loop round and try again */
@@ -289,7 +293,7 @@
     /* enable the use of keep-alive packets on TCP connection */
     if(keepalive) {
         int set = 1;
-        if((ret = apr_setsocketopt(sock, APR_SO_KEEPALIVE, set)) != APR_SUCCESS ) {
+        if((ret = apr_socket_opt_set(sock, APR_SO_KEEPALIVE, set)) != APR_SUCCESS ) {
             apr_socket_close(sock);
             env->l->jkLog(env, env->l, JK_LOG_ERROR,
                           "channelApr.open() keepalive failed %d %s\n",
@@ -301,7 +305,7 @@
     /* Disable the Nagle algorithm if ndelay is set */
     if(ndelay) {
         int set = 1;
-        if((ret = apr_setsocketopt(sock, APR_TCP_NODELAY, set)) != APR_SUCCESS ) {
+        if((ret = apr_socket_opt_set(sock, APR_TCP_NODELAY, set)) != APR_SUCCESS ) {
             apr_socket_close(sock);
             env->l->jkLog(env, env->l, JK_LOG_ERROR,
                           "channelApr.open() nodelay failed %d %s\n",
@@ -378,7 +382,7 @@
     do {
         apr_size_t written = length;
 
-        stat = apr_send(sock, b, &written);
+        stat = apr_socket_send(sock, b, &written);
         if (stat!= APR_SUCCESS) {
             env->l->jkLog(env, env->l, JK_LOG_ERROR,
                 "jk2_channel_apr_send send failed %d %s\n",
@@ -420,7 +424,7 @@
     length = (apr_size_t)len;
     while (rdlen < len) {
 
-        stat =  apr_recv(sock, b + rdlen, &length);
+        stat =  apr_socket_recv(sock, b + rdlen, &length);
 
         if (stat == APR_EOF)
             return -1; /* socket closed. */

###########################################################################################
--- .\native2\server\apache2\jk_apache2.h.orig	Tue Feb 04 12:38:28 2003
+++ .\native2\server\apache2\jk_apache2.h	Tue Sep 30 05:18:54 2003
@@ -65,7 +65,6 @@
 #ifndef JK_APACHE2_H
 #define JK_APACHE2_H
 
-#include "apu_compat.h"
 #include "ap_config.h"
 #include "apr_lib.h"
 #include "apr_date.h"
@@ -91,6 +90,13 @@
 #include "jk_workerEnv.h"
 #include "jk_uriMap.h"
 #include "jk_requtil.h"
+
+/* changed with apr 1.0 */
+#include "apr_version.h"
+#if (APR_MAJOR_VERSION < 1) 
+#define apr_filepath_name_get apr_filename_of_pathname
+#define apr_pool_parent_get apr_pool_get_parent
+#endif
 
 extern module AP_MODULE_DECLARE_DATA jk2_module;
 

###########################################################################################
--- .\native2\server\apache2\jk_service_apache2.c.orig	Tue Feb 04 12:38:28 2003
+++ .\native2\server\apache2\jk_service_apache2.c	Tue Sep 30 05:20:00 2003
@@ -116,7 +116,7 @@
              * If the script gave us a Last-Modified header, we can't just
              * pass it on blindly because of restrictions on future values.
              */
-            ap_update_mtime(r, ap_parseHTTPdate(val));
+            ap_update_mtime(r, apr_date_parse_http(val));
             ap_set_last_modified(r);
         }
 
@@ -162,7 +162,7 @@
              * If the script gave us a Last-Modified header, we can't just
              * pass it on blindly because of restrictions on future values.
              */
-            ap_update_mtime(r, ap_parseHTTPdate(val));
+            ap_update_mtime(r, apr_date_parse_http(val));
             ap_set_last_modified(r);
             apr_table_set(r->headers_out, name, val);
         } else {     

###########################################################################################
--- .\native2\server\apache2\mod_jk2.c.orig	Wed Apr 16 00:46:30 2003
+++ .\native2\server\apache2\mod_jk2.c	Tue Sep 30 05:16:58 2003
@@ -242,9 +242,9 @@
     if (s->is_virtual && s->server_hostname != NULL &&
         (uriEnv->virtual==NULL  || !strchr(uriEnv->virtual, ':') ||
         uriEnv->port != s->port)) {
-        tmp_virtual  = (char *) ap_pcalloc(cmd->pool,
+        tmp_virtual  = (char *) apr_pcalloc(cmd->pool,
                         sizeof(char *) * (strlen(s->server_hostname) + 8 )) ;
-        tmp_full_url = (char *) ap_pcalloc(cmd->pool,
+        tmp_full_url = (char *) apr_pcalloc(cmd->pool,
                         sizeof(char *) * (strlen(s->server_hostname) +
                         strlen(uriEnv->uri)+8 )) ; 
         /* do not pass the hostname:0/ scheme */
@@ -310,7 +310,7 @@
     /* Original patch: a * sizeof( char * ) - that's weird, we only use a chars, not char*
        Maybe I wrote too much java...
     */
-    tmp = (char *) ap_pcalloc(p, a); 
+    tmp = (char *) apr_pcalloc(p, a); 
     sprintf(tmp, "%s-%d", path, dirCounter++);
     /* I changed the default to /, otherwise it complains */
 
@@ -538,7 +538,7 @@
     int i;
     
     for( i=0; i<10; i++ ) {
-        tmpPool=apr_pool_get_parent( gPool );
+        tmpPool=apr_pool_parent_get( gPool );
         if( tmpPool == NULL ) {
             /* fprintf(stderr, "XXX Found Root pool %#lx\n", gPool ); */
             break;
@@ -890,11 +890,11 @@
     if( uriEnv != NULL ) {
     
         /* First find just the name of the file, no directory */
-        r->filename = (char *)apr_filename_of_pathname(r->uri);
+        r->filename = (char *)apr_filepath_name_get(r->uri);
 
         /* Only if sub-request for a directory, most likely from mod_dir */
         if (r->main && r->main->filename &&
-            !*apr_filename_of_pathname(r->main->filename)){
+            !*apr_filepath_name_get(r->main->filename)){
 
             /* The filename from the main request will be set to what should
              * be picked up, aliases included. Tomcat will need to know about

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message