You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Walter Truitt <wa...@alcatel.com> on 2004/03/29 23:59:38 UTC

Patches for apr and webapp module

For various reasons, I wanted to compile the webapp module.  I had
been using it with previous versions of apache.  I needed to upgrade
and found I had problems compiling various combinations of the apr and
webapp directories.

Since the webpage suggested checking the code out from CVS, I went
ahead and did that.  It seems that those sources may build, but don't
run.  Attached are some patches I have put together to be checked into
CVS by one of the developers of the jakarta-tomcat-connectors.

Patched files include:
webapp/lib/pr_warp_network.c
webapp/lib/pr_warp_socketpool.c
apr/network_io/unix/sockaddr.c

In the two files from webapp, I changed the function names to match
the names of the functions in the libapr-1.a library (apr_socket_recv,
apr_socket_send, apr_socket_create, apr_socket_connect, and
apr_socket_shutdown).  In the apr file, I added a function that had
previously been in the file sa_common.c (which no longer exists),
apr_socket_port_get.  This was a function that simply sets an integer
to the port number of the socket.

I would like to have these checked in so that at whatever point in the
future I go through this again, that the sources will run without
modification.

Also, I would recommend that whoever is in charge of the web pages,
update the webapp page to mention that you must specify the ServerName
directive in the httpd.conf file.

For informational purposes, I am running the apache 1.3.29 version
with tomcat 4.1.30 and CVS webapp and apr with these patches
successfully on a Redhat Linux 7.3 system.

 -walter


Re: Patches for apr and webapp module

Posted by Walter Truitt <wa...@alcatel.com>.
Oh, so the list does not accept attachments.  Bummer.  Here are the
patches inline.

This one is for webapp.  I will send the apr patch in a separate
message.

 -walter

*** webapp/lib/pr_warp_network.c.orig	Tue Feb 24 02:59:09 2004
--- webapp/lib/pr_warp_network.c	Mon Mar 29 10:29:52 2004
***************
*** 28,34 ****
      p_reset(pack);
      len=3;
      while(1) {
!         if (apr_recv(sock,&hdr[ptr],&len)!=APR_SUCCESS) {
              wa_debug(WA_MARK,"Cannot receive header");
              return(wa_false);
          }
--- 28,34 ----
      p_reset(pack);
      len=3;
      while(1) {
!         if (apr_socket_recv(sock,&hdr[ptr],&len)!=APR_SUCCESS) {
              wa_debug(WA_MARK,"Cannot receive header");
              return(wa_false);
          }
***************
*** 44,50 ****
          len=pack->size;
          ptr=0;
          while(1) {
!             if (apr_recv(sock,&pack->buff[ptr],&len)!=APR_SUCCESS) {
                  wa_debug(WA_MARK,"Cannot receive payload");
                  return(wa_false);
              }
--- 44,50 ----
          len=pack->size;
          ptr=0;
          while(1) {
!             if (apr_socket_recv(sock,&pack->buff[ptr],&len)!=APR_SUCCESS) {
                  wa_debug(WA_MARK,"Cannot receive payload");
                  return(wa_false);
              }
***************
*** 73,79 ****
  
      len=3;
      while(1) {
!         if (apr_send(sock,&hdr[ptr],&len)!=APR_SUCCESS) return(wa_false);
          ptr+=len;
          len=3-ptr;
          if (len==0) break;
--- 73,79 ----
  
      len=3;
      while(1) {
!         if (apr_socket_send(sock,&hdr[ptr],&len)!=APR_SUCCESS) return(wa_false);
          ptr+=len;
          len=3-ptr;
          if (len==0) break;
***************
*** 82,88 ****
      len=pack->size;
      ptr=0;
      while(1) {
!         if (apr_send(sock,&pack->buff[ptr],&len)!=APR_SUCCESS)
              return(wa_false);
          ptr+=len;
          len=pack->size-ptr;
--- 82,88 ----
      len=pack->size;
      ptr=0;
      while(1) {
!         if (apr_socket_send(sock,&pack->buff[ptr],&len)!=APR_SUCCESS)
              return(wa_false);
          ptr+=len;
          len=pack->size-ptr;
***************
*** 102,108 ****
      apr_status_t ret=APR_SUCCESS;
      apr_socket_t *sock=NULL;
  
!     ret=apr_socket_create(&sock,AF_INET,SOCK_STREAM,wa_pool);
      if (ret!=APR_SUCCESS) {
          sock=NULL;
          wa_log(WA_MARK,"Cannot create socket for conn. \"%s\"",conn->name);
--- 102,108 ----
      apr_status_t ret=APR_SUCCESS;
      apr_socket_t *sock=NULL;
  
!     ret=apr_socket_create(&sock,AF_INET,SOCK_STREAM,IPPROTO_TCP,wa_pool);
      if (ret!=APR_SUCCESS) {
          sock=NULL;
          wa_log(WA_MARK,"Cannot create socket for conn. \"%s\"",conn->name);
***************
*** 110,118 ****
      }
  
      /* Attempt to connect to the remote endpoint */
!     ret=apr_connect(sock, conf->addr);
      if (ret!=APR_SUCCESS) {
!         apr_shutdown(sock,APR_SHUTDOWN_READWRITE);
          sock=NULL;
          wa_log(WA_MARK,"Connection \"%s\" cannot connect",conn->name);
          return(sock);
--- 110,118 ----
      }
  
      /* Attempt to connect to the remote endpoint */
!     ret=apr_socket_connect(sock, conf->addr);
      if (ret!=APR_SUCCESS) {
!         apr_socket_shutdown(sock,APR_SHUTDOWN_READWRITE);
          sock=NULL;
          wa_log(WA_MARK,"Connection \"%s\" cannot connect",conn->name);
          return(sock);
***************
*** 138,144 ****
      if (sock==NULL) return;
  
      /* Shutdown and close the socket (ignoring errors) */
!     ret=apr_shutdown(sock,APR_SHUTDOWN_READWRITE);
      if (ret!=APR_SUCCESS)
          wa_log(WA_MARK,"Cannot shutdown \"%s\"",conn->name);
      ret=apr_socket_close(sock);
--- 138,144 ----
      if (sock==NULL) return;
  
      /* Shutdown and close the socket (ignoring errors) */
!     ret=apr_socket_shutdown(sock,APR_SHUTDOWN_READWRITE);
      if (ret!=APR_SUCCESS)
          wa_log(WA_MARK,"Cannot shutdown \"%s\"",conn->name);
      ret=apr_socket_close(sock);
*** webapp/lib/pr_warp_socketpool.c.orig	Tue Feb 24 02:59:09 2004
--- webapp/lib/pr_warp_socketpool.c	Mon Mar 29 14:07:15 2004
***************
*** 88,94 ****
          sock = (apr_socket_t*) elem->curr;
  
          if (sock != NULL) {
!             ret = apr_shutdown(sock, APR_SHUTDOWN_READWRITE);
              ret = apr_socket_close(sock);
          }
  
--- 88,94 ----
          sock = (apr_socket_t*) elem->curr;
  
          if (sock != NULL) {
!             ret = apr_socket_shutdown(sock, APR_SHUTDOWN_READWRITE);
              ret = apr_socket_close(sock);
          }
  


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


Re: Patches for apr and webapp module

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Walter Truitt wrote:
> For various reasons, I wanted to compile the webapp module.  I had
> been using it with previous versions of apache.  I needed to upgrade
> and found I had problems compiling various combinations of the apr and
> webapp directories.

The webapp module is depricated, try using mod_jk2.

> 
> Since the webpage suggested checking the code out from CVS, I went
> ahead and did that.  It seems that those sources may build, but don't
> run.  Attached are some patches I have put together to be checked into
> CVS by one of the developers of the jakarta-tomcat-connectors.
> 
> Patched files include:
> webapp/lib/pr_warp_network.c
> webapp/lib/pr_warp_socketpool.c
> apr/network_io/unix/sockaddr.c

-1  : Don't  patch apr but add a wa_sockaddr_port_get() in lib/pr_warp_network.c 
for example or patch the code where apr_sockaddr_port_get() is used.

> 
> In the two files from webapp, I changed the function names to match
> the names of the functions in the libapr-1.a library (apr_socket_recv,
> apr_socket_send, apr_socket_create, apr_socket_connect, and
> apr_socket_shutdown).  In the apr file, I added a function that had
> previously been in the file sa_common.c (which no longer exists),
> apr_socket_port_get.  This was a function that simply sets an integer
> to the port number of the socket.
> 
> I would like to have these checked in so that at whatever point in the
> future I go through this again, that the sources will run without
> modification.
> 
> Also, I would recommend that whoever is in charge of the web pages,
> update the webapp page to mention that you must specify the ServerName
> directive in the httpd.conf file.
> 
> For informational purposes, I am running the apache 1.3.29 version
> with tomcat 4.1.30 and CVS webapp and apr with these patches
> successfully on a Redhat Linux 7.3 system.
> 
>  -walter
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> 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


Re: Patches for apr and webapp module

Posted by Walter Truitt <wa...@alcatel.com>.
And for apr.

 -walter

*** apr/network_io/unix/sockaddr.c.orig	Thu Mar  4 10:17:25 2004
--- apr/network_io/unix/sockaddr.c	Mon Mar 29 15:02:06 2004
***************
*** 97,102 ****
--- 97,109 ----
      }
  }
  
+ APR_DECLARE(apr_status_t) apr_sockaddr_port_get(apr_port_t *port,
+                                        apr_sockaddr_t *sockaddr)
+ {
+     *port = sockaddr->port;
+     return APR_SUCCESS;
+ }
+ 
  APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr,
                                           apr_sockaddr_t *sockaddr)
  {

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