cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c wa_request.c

2002-05-10 Thread jfclere

jfclere 02/05/10 08:30:17

  Modified:webapp/apache-1.3 mod_webapp.c
   webapp/apache-2.0 mod_webapp.c
   webapp/include wa_request.h
   webapp/lib pr_warp.c wa_request.c
  Log:
  Add modification of status line.
  
  Revision  ChangesPath
  1.34  +10 -1 jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c
  
  Index: mod_webapp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_webapp.c  3 May 2002 13:30:25 -   1.33
  +++ mod_webapp.c  10 May 2002 15:30:17 -  1.34
  @@ -57,7 +57,7 @@
   
   /**
* @author  Pier Fumagalli 
  - * @version $Id: mod_webapp.c,v 1.33 2002/05/03 13:30:25 pier Exp $
  + * @version $Id: mod_webapp.c,v 1.34 2002/05/10 15:30:17 jfclere Exp $
*/
   
   #include 
  @@ -297,6 +297,14 @@
   
   req->status=status;
   }
  +/* Set the HTTP status of the response. */
  +void wam_handler_setstatusline(wa_request *r, char * status) {
  +request_rec *req=(request_rec *)r->data;
  +
  +if (status !=NULL && status[0]!='\0')
  +req->status_line=apr_pstrdup(req->pool,status);
  +}
  +
   
   /* Set the MIME Content-Type of the response. */
   void wam_handler_setctype(wa_request *r, char *type) {
  @@ -374,6 +382,7 @@
   static wa_handler wam_handler = {
   wam_handler_log,
   wam_handler_setstatus,
  +wam_handler_setstatusline,
   wam_handler_setctype,
   wam_handler_setheader,
   wam_handler_commit,
  
  
  
  1.10  +11 -1 jakarta-tomcat-connectors/webapp/apache-2.0/mod_webapp.c
  
  Index: mod_webapp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/apache-2.0/mod_webapp.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_webapp.c  3 May 2002 13:30:25 -   1.9
  +++ mod_webapp.c  10 May 2002 15:30:17 -  1.10
  @@ -57,7 +57,7 @@
   
   /**
* @author  Pier Fumagalli 
  - * @version $Id: mod_webapp.c,v 1.9 2002/05/03 13:30:25 pier Exp $
  + * @version $Id: mod_webapp.c,v 1.10 2002/05/10 15:30:17 jfclere Exp $
*/
   
   #include 
  @@ -300,6 +300,15 @@
   req->status=status;
   }
   
  +/* Set the HTTP status of the response. */
  +void wam_handler_setstatusline(wa_request *r, char * status) {
  +request_rec *req=(request_rec *)r->data;
  +
  +if (status !=NULL && status[0]!='\0')
  +req->status_line=apr_pstrdup(req->pool,status);
  +}
  +
  +
   /* Set the MIME Content-Type of the response. */
   static void wam_handler_setctype(wa_request *r, char *type) {
   request_rec *req=(request_rec *)r->data;
  @@ -381,6 +390,7 @@
   static wa_handler wam_handler = {
   wam_handler_log,
   wam_handler_setstatus,
  +wam_handler_setstatusline,
   wam_handler_setctype,
   wam_handler_setheader,
   wam_handler_commit,
  
  
  
  1.11  +3 -1  jakarta-tomcat-connectors/webapp/include/wa_request.h
  
  Index: wa_request.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/include/wa_request.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- wa_request.h  1 Nov 2001 22:20:51 -   1.10
  +++ wa_request.h  10 May 2002 15:30:17 -  1.11
  @@ -58,7 +58,7 @@
   /**
* @package Request Handling
* @author  Pier Fumagalli 
  - * @version $Id: wa_request.h,v 1.10 2001/11/01 22:20:51 pier Exp $
  + * @version $Id: wa_request.h,v 1.11 2002/05/10 15:30:17 jfclere Exp $
*/
   #ifndef _WA_REQUEST_H_
   #define _WA_REQUEST_H_
  @@ -95,6 +95,7 @@
   struct wa_handler {
   void (*log)(wa_request *r, const char *file, const int line, char *msg);
   void (*setstatus)(wa_request *r, int status);
  +void (*setstatusline)(wa_request *r, char *status);
   void (*setctype)(wa_request *r, char *type);
   void (*setheader)(wa_request *r, char *name, char *value);
   void (*commit)(wa_request *r);
  @@ -188,6 +189,7 @@
   
   void wa_rlog(wa_request *r, const char *f, const int l, const char *fmt, ...);
   void wa_rsetstatus(wa_request *r, int status);
  +void wa_rsetstatusline(wa_request *r, char *status);
   void wa_rsetctype(wa_request *r, char *type);
   void wa_rsetheader(wa_request *r, char *name, char *value);
   void wa_rcommit(wa_request *r);
  
  
  
  1.22  +2 -1  jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- p

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-10-22 Thread jfclere

jfclere 01/10/22 15:00:04

  Modified:webapp/lib pr_warp.c
  Log:
  Change ssl_cert to cert otherwise it even does not compile!
  
  Revision  ChangesPath
  1.18  +3 -3  jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- pr_warp.c 2001/10/22 21:44:21 1.17
  +++ pr_warp.c 2001/10/22 22:00:04 1.18
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.17 2001/10/22 21:44:21 jfclere Exp $ */
  +/* @version $Id: pr_warp.c,v 1.18 2001/10/22 22:00:04 jfclere Exp $ */
   #include "pr_warp.h"
   
   /* Initialize this provider. */
  @@ -431,12 +431,12 @@
   case TYPE_ASK_SSL_CLIENT: {
   wa_log(WA_MARK,"TYPE_ASK_SSL_CLIENT");
   /* Request for client certificate */
  -if (r->ssld->ssl_cert==NULL) {
  +if (r->ssld->cert==NULL) {
   pack->type=TYPE_REP_SSL_NO;
   pack->size=0;
   } else {
   pack->type=TYPE_REP_SSL_CERT;
  -p_write_string(pack,r->ssld->ssl_cert);
  +p_write_string(pack,r->ssld->cert);
   }
   wa_debug(WA_MARK,"CC bytes: (Sent=%d)",pack->size);
   if (n_send(conf->sock,pack)!=wa_true) {
  
  
  



cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-10-22 Thread jfclere

jfclere 01/10/22 14:44:21

  Modified:webapp/apache-1.3 mod_webapp.c
   webapp/java Constants.java.in Makefile.in WarpConnector.java
WarpRequest.java
   webapp/lib pr_warp.c
  Added:   webapp/java WarpCertificates.java
  Log:
  Add logic for Client Certificate (Add Constantes for the rest of SSL support).
  Also fix the ServerSocketFactory (due to changes in TC4.0).
  
  Revision  ChangesPath
  1.25  +4 -1  jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c
  
  Index: mod_webapp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_webapp.c  2001/10/09 10:41:25 1.24
  +++ mod_webapp.c  2001/10/22 21:44:21 1.25
  @@ -57,7 +57,7 @@
   
   /**
* @author  Pier Fumagalli 
  - * @version $Id: mod_webapp.c,v 1.24 2001/10/09 10:41:25 jfclere Exp $
  + * @version $Id: mod_webapp.c,v 1.25 2001/10/22 21:44:21 jfclere Exp $
*/
   
   #include 
  @@ -462,6 +462,9 @@
   req->clen=0;
   req->ctyp="\0";
   req->rlen=0;
  +req->ssld=(wa_ssldata *) apr_palloc(r->pool,sizeof(wa_ssldata));
  +req->ssld->ssl = (char *)ap_table_get(
  +r->subprocess_env,"SSL_CLIENT_CERT");
   
   /* Copy headers into webapp request structure */
   if (r->headers_in!=NULL) {
  
  
  
  1.12  +44 -0 jakarta-tomcat-connectors/webapp/java/Constants.java.in
  
  Index: Constants.java.in
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/Constants.java.in,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Constants.java.in 2001/08/09 20:02:15 1.11
  +++ Constants.java.in 2001/10/22 21:44:21 1.12
  @@ -363,4 +363,48 @@
* No payload.
*/
   public static final int TYPE_CBK_DONE=0x42;
  +
  +/**
  + * ASK_SSL: The WARP server (Tomcat) asks the WARP client to
  + * transfer the basic SSL information (cypher, keysize and session).
  + * 
  + * No payload.
  + */
  +public static final int TYPE_ASK_SSL=0x43;
  +
  +/**
  + * ASK_SSL_CLIENT: The WARP server (Tomcat) asks the WARP server to
  + * transfer the client certificate.
  + * (just the first element of the chain and the webserver should request
  + * for it to the browser if possible).
  + * 
  + * No payload.
  + */
  +public static final int TYPE_ASK_SSL_CLIENT=0x44;
  +
  +/**
  + * REP_SSL_CERT: The client certificate (remote peer).
  + * 
  + * Payload description:
  + * [string] The client certificate. (PEM format).
  + */
  +public static final int TYPE_REP_SSL_CERT=0x52;
  + 
  +/**
  + * REP_SSL: SSL information between 
  + * 
  + * Payload description:
  + * [string] The cipher_suite.
  + * [string] The ssl session. (That is not in the spec's).
  + * [ushort] size of the algorithm (56-128).
  + */
  +public static final int TYPE_REP_SSL=0x53;
  + 
  +/**
  + * REP_SSL_NO: Request SSL information is not available.
  + * 
  + * No payload.
  + */
  +public static final int TYPE_REP_SSL_NO=0x5F;
   }
  +
  
  
  
  1.4   +2 -1  jakarta-tomcat-connectors/webapp/java/Makefile.in
  
  Index: Makefile.in
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/Makefile.in,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile.in   2001/09/17 05:04:02 1.3
  +++ Makefile.in   2001/10/22 21:44:21 1.4
  @@ -56,7 +56,7 @@
   # = #
   
   # @author  Pier Fumagalli 
  -# @version $Id: Makefile.in,v 1.3 2001/09/17 05:04:02 pier Exp $
  +# @version $Id: Makefile.in,v 1.4 2001/10/22 21:44:21 jfclere Exp $
   
   include @TGTDIR@/Makedefs
   
  @@ -70,6 +70,7 @@
WarpRequest.java \
WarpRequestHandler.java \
WarpResponse.java \
  + WarpCertificates.java
   
   ARCHIVE = warp.jar
   
  
  
  
  1.24  +1 -1  jakarta-tomcat-connectors/webapp/java/WarpConnector.java
  
  Index: WarpConnector.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/WarpConnector.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- WarpConnector.java2001/10/19 19:16:43 1.23
  +++ WarpConnector.java2001/10/22 21:44:21 1.24
  @@ -74,7 +74,7 @@
   import org.apache.catalina.Response;
   import org.apache.catalina.Service;
   import org.apache.catalina.net.DefaultServerSocketFactory;
  -import 

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-09-16 Thread pier

pier01/09/16 22:05:30

  Modified:webapp/lib pr_warp.c
  Log:
  Removed packet dumping from C.
  
  Revision  ChangesPath
  1.15  +5 -2  jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- pr_warp.c 2001/09/17 03:09:56 1.14
  +++ pr_warp.c 2001/09/17 05:05:30 1.15
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.14 2001/09/17 03:09:56 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.15 2001/09/17 05:05:30 pier Exp $ */
   #include "pr_warp.h"
   
   /* Initialize this provider. */
  @@ -397,7 +397,7 @@
   wa_rwrite(r,pack->buff,pack->size);
   wa_rflush(r);
   pack->buff[pack->size]='\0';
  -wa_debug(WA_MARK,"=== %s",pack->buff);
  +wa_debug(WA_MARK,"Response body bytes: %d",pack->size);
   break;
   }
   case TYPE_RES_DONE: {
  @@ -409,7 +409,9 @@
   int size=-1;
   p_read_ushort(pack,&size);
   p_reset(pack);
  +wa_debug(WA_MARK,"Request body bytes: (Req=%d)",size);
   size=wa_rread(r,pack->buff,size);
  +wa_debug(WA_MARK,"Request body bytes: (Got=%d)",size);
   if (size==0) {
   pack->type=TYPE_CBK_DONE;
   } else if (size>0) {
  @@ -419,6 +421,7 @@
   pack->type=TYPE_ERROR;
   p_write_string(pack,"Transfer interrupted");
   }
  +wa_debug(WA_MARK,"Request body bytes: (Sent=%d)",pack->size);
   if (n_send(conf->sock,pack)!=wa_true) {
   n_disconnect(conn);
   return(wa_rerror(WA_MARK,r,500,"Communitcation interrupted"));
  
  
  



cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-09-16 Thread pier

pier01/09/16 20:09:56

  Modified:webapp/lib pr_warp.c
  Log:
  Fix for Bug 2997:
  When Tomcat is restarted, now the WebApp module automatically
  reconnects thru WARP.
  Previously the first request sent to Apache will come up with
  an error saying "Communitcation interrupted", but depending on
  the number of active processes, that might have taken quite a
  while (every process had to reconnect).
  Now if the first packet doesn't go thru, we try once to re-
  establish connection with Tomcat, so the "Communication
  interrupted" message doesn't pop up anymore.
  
  Revision  ChangesPath
  1.14  +22 -2 jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- pr_warp.c 2001/08/09 20:03:43 1.13
  +++ pr_warp.c 2001/09/17 03:09:56 1.14
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.13 2001/08/09 20:03:43 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.14 2001/09/17 03:09:56 pier Exp $ */
   #include "pr_warp.h"
   
   /* Initialize this provider. */
  @@ -250,7 +250,27 @@
   p_write_string(pack,r->prot);
   if (n_send(conf->sock,pack)!=wa_true) {
   n_disconnect(conn);
  -return(wa_rerror(WA_MARK,r,500,"Communitcation interrupted"));
  +if (n_connect(conn)==wa_true) {
  +wa_debug(WA_MARK,"Connection \"%s\" reopened",conn->name);
  +if (c_configure(conn)==wa_true) {
  +wa_debug(WA_MARK,"Connection \"%s\" reconfigured",conn->name);
  +} else {
  +wa_log(WA_MARK,"Cannot reconfigure connection %s",conn->name);
  +return(wa_rerror(WA_MARK,r,500,
  + "Cannot reconfigure connection \"%s\"",
  + conn->name));
  +}
  +if (n_send(conf->sock,pack)!=wa_true) {
  +  return(wa_rerror(WA_MARK,r,500,
  + "Communitcation broken while reconnecting"));
  +} else {
  +wa_debug(WA_MARK,"Re-Req. %s %s %s",r->meth,r->ruri,r->prot);
  +}
  +} else {
  +wa_log(WA_MARK,"Cannot open connection %s",conn->name);
  +return(wa_rerror(WA_MARK,r,500,"Cannot open connection %s",
  + conn->name));
  +}
   } else {
   wa_debug(WA_MARK,"Req. %s %s %s",r->meth,r->ruri,r->prot);
   }
  
  
  



cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-08-09 Thread pier

pier01/08/09 13:03:43

  Modified:webapp/lib pr_warp.c
  Log:
  The HTTP version doesn't need to be passed over WARP.
  
  Revision  ChangesPath
  1.13  +2 -4  jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- pr_warp.c 2001/07/25 22:32:05 1.12
  +++ pr_warp.c 2001/08/09 20:03:43 1.13
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.12 2001/07/25 22:32:05 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.13 2001/08/09 20:03:43 pier Exp $ */
   #include "pr_warp.h"
   
   /* Initialize this provider. */
  @@ -350,12 +350,10 @@
   }
   switch (pack->type) {
   case TYPE_RES_STATUS: {
  -char *prot=NULL;
   char *mesg=NULL;
  -p_read_string(pack,&prot);
   p_read_ushort(pack,&status);
   p_read_string(pack,&mesg);
  -wa_debug(WA_MARK,"=== %s %d %s",prot,status,mesg);
  +wa_debug(WA_MARK,"=== %d %s",status,mesg);
   wa_rsetstatus(r,status);
   break;
   }
  
  
  



cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c pr_warp.h pr_warp_network.c wa_config.c

2001-07-25 Thread pier

pier01/07/25 15:32:05

  Modified:webapp/java WarpPacket.java WarpRequest.java
WarpRequestHandler.java
   webapp/lib pr_warp.c pr_warp.h pr_warp_network.c wa_config.c
  Log:
  Fixing bug 1245/2777: POST data not transmitted correctly over WARP.
  
  Revision  ChangesPath
  1.14  +1 -1  jakarta-tomcat-connectors/webapp/java/WarpPacket.java
  
  Index: WarpPacket.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/WarpPacket.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WarpPacket.java   2001/07/25 01:30:46 1.13
  +++ WarpPacket.java   2001/07/25 22:32:05 1.14
  @@ -66,7 +66,7 @@
   protected int size=0;
   
   /* Pointer to the last byte read in the buffer */
  -private int pointer=0;
  +protected int pointer=0;
   /* Type of this packet */
   private int type=-1;
   /* Maximum value for a 16 bit unsigned value (0x0 +1) */
  
  
  
  1.9   +92 -0 jakarta-tomcat-connectors/webapp/java/WarpRequest.java
  
  Index: WarpRequest.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/WarpRequest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WarpRequest.java  2001/07/25 01:30:46 1.8
  +++ WarpRequest.java  2001/07/25 22:32:05 1.9
  @@ -56,15 +56,25 @@
* = */
   package org.apache.catalina.connector.warp;
   
  +import java.io.*;
  +
   import org.apache.catalina.Context;
   import org.apache.catalina.Host;
   import org.apache.catalina.connector.HttpRequestBase;
   
   public class WarpRequest extends HttpRequestBase {
  +/** The local stream */
  +private Stream localstream;
  +
  +/** The connection to which we are associated */
  +private WarpConnection connection;
  +
   private Host host=null;
   
   public WarpRequest() {
   super();
  +this.localstream=new Stream(this);
  +this.setStream(this.localstream);
   }
   
   public void setHost(Host host) {
  @@ -73,5 +83,87 @@
   
   public Host getHost() {
   return(this.host);
  +}
  +
  +/**
  + * Recycle this WarpResponse instance.
  + */
  +public void recycle() {
  +// Recycle our parent
  +super.recycle();
  +// Recycle the stream
  +this.localstream.recycle();
  +// Tell the parent that a stream is already in use.
  +this.setStream(localstream);
  +}
  +
  +/**
  + * Associate this WarpResponse instance with a specific
  + * WarpConnection instance.
  + */
  +public void setConnection(WarpConnection connection) {
  +this.connection=connection;
  +}
  +
  +/**
  + * Return the WarpConnection associated this instance of
  + * WarpResponse.
  + */
  +public WarpConnection getConnection() {
  +return(this.connection);
  +}
  +
  +protected class Stream extends InputStream {
  +
  +/** The response associated with this stream instance. */
  +private WarpRequest request=null;
  +/** The packet used by this stream instance. */
  +private WarpPacket packet=null;
  +/** Wether close() was called or not. */
  +private boolean closed=false;
  +
  +protected Stream(WarpRequest request) {
  +super();
  +this.request=request;
  +this.packet=new WarpPacket();
  +this.packet.setType(Constants.TYPE_CBK_DATA);
  +}
  +
  +public int read()
  +throws IOException {
  +if (closed) throw new IOException("Stream closed");
  +
  +if (packet.getType()==Constants.TYPE_CBK_DONE) return(-1);
  +
  +if (packet.getType()!=Constants.TYPE_CBK_DATA)
  +throw new IOException("Invalid WARP packet type for body");
  +
  +if (this.packet.pointersock,pack)!=wa_true) {
  +n_disconnect(conn);
  +return(wa_rerror(WA_MARK,r,500,"Communitcation interrupted"));
  +}
   break;
   }
   case TYPE_ERROR: {
  
  
  
  1.6   +5 -1  jakarta-tomcat-connectors/webapp/lib/pr_warp.h
  
  Index: pr_warp.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- pr_warp.h 2001/07/25 03:30:42 1.5
  +++ pr_warp.h 2001/07/25 22:32:05 1.6
  @@ -54,7 +54,7 @@
*   *
* ===

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c pr_warp.h

2001-07-24 Thread pier

pier01/07/24 20:30:42

  Modified:webapp/apache-1.3 mod_webapp.c
   webapp/java Constants.java.in WarpRequestHandler.java
   webapp/lib pr_warp.c pr_warp.h
  Log:
  Fix for Bug 2775 part 1: Client/Server address/port informations not
  transmitted over WARP.
  
  Revision  ChangesPath
  1.21  +5 -3  jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c
  
  Index: mod_webapp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/apache-1.3/mod_webapp.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mod_webapp.c  2001/07/19 23:55:01 1.20
  +++ mod_webapp.c  2001/07/25 03:30:42 1.21
  @@ -57,7 +57,7 @@
   
   /**
* @author  Pier Fumagalli 
  - * @version $Id: mod_webapp.c,v 1.20 2001/07/19 23:55:01 pier Exp $
  + * @version $Id: mod_webapp.c,v 1.21 2001/07/25 03:30:42 pier Exp $
*/
   
   #include 
  @@ -435,8 +435,10 @@
  data (from the connection */
   stmp=(char *)r->hostname;
   ctmp=(char *)ap_get_remote_host(con,r->per_dir_config, REMOTE_HOST);
  -req->serv->host=apr_pstrdup(req->pool,stmp);
  -req->clnt->host=apr_pstrdup(req->pool,ctmp);
  +if (stmp==NULL) req->serv->host="";
  +else req->serv->host=apr_pstrdup(req->pool,stmp);
  +if (ctmp==NULL) req->clnt->host="";
  +else req->clnt->host=apr_pstrdup(req->pool,ctmp);
   req->serv->addr=apr_pstrdup(req->pool,con->local_ip);
   req->clnt->addr=apr_pstrdup(req->pool,con->remote_ip);
   req->serv->port=ntohs(con->local_addr.sin_port);
  
  
  
  1.5   +2 -0  jakarta-tomcat-connectors/webapp/java/Constants.java.in
  
  Index: Constants.java.in
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/Constants.java.in,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Constants.java.in 2001/07/19 23:46:30 1.4
  +++ Constants.java.in 2001/07/25 03:30:42 1.5
  @@ -154,6 +154,8 @@
   public static final int TYPE_REQ_SCHEME=0x12;
   public static final int TYPE_REQ_AUTH=0x13;
   public static final int TYPE_REQ_HEADER=0x14;
  +public static final int TYPE_REQ_SERVER=0x15;
  +public static final int TYPE_REQ_CLIENT=0x16;
   public static final int TYPE_REQ_PROCEED=0x1f;
   
   public static final int TYPE_RES_STATUS=0x20;
  
  
  
  1.12  +25 -1 jakarta-tomcat-connectors/webapp/java/WarpRequestHandler.java
  
  Index: WarpRequestHandler.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/java/WarpRequestHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WarpRequestHandler.java   2001/07/25 01:30:47 1.11
  +++ WarpRequestHandler.java   2001/07/25 03:30:42 1.12
  @@ -140,7 +140,7 @@
   case Constants.TYPE_REQ_SCHEME: {
   String schm=packet.readString();
   if (Constants.DEBUG)
  -logger.debug("Request schere="+schm);
  +logger.debug("Request scheme="+schm);
   request.setScheme(schm);
   break;
   }
  @@ -161,6 +161,30 @@
   if (Constants.DEBUG)
   logger.debug("Request header "+hnam+": "+hval);
   request.addHeader(hnam,hval);
  +break;
  +}
  +
  +case Constants.TYPE_REQ_SERVER: {
  +String host=packet.readString();
  +String addr=packet.readString();
  +int port=packet.readUnsignedShort();
  +if (Constants.DEBUG)
  +logger.debug("Server detail "+host+":"+port+
  + " ("+addr+")");
  +request.setServerName(host);
  +request.setServerPort(port);
  +break;
  +}
  +
  +case Constants.TYPE_REQ_CLIENT: {
  +String host=packet.readString();
  +String addr=packet.readString();
  +int port=packet.readUnsignedShort();
  +if (Constants.DEBUG)
  +logger.debug("Client detail "+host+":"+port+
  + " ("+addr+")");
  +request.setRemoteHost(host);
  +request.setRemoteAddr(addr);
   break;
   }
   
  
  
  
  1.11  +33 -1 jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-07-19 Thread pier

pier01/07/19 16:53:41

  Modified:webapp/lib pr_warp.c
  Log:
  Readded request handling.
  
  Revision  ChangesPath
  1.10  +182 -4jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- pr_warp.c 2001/07/18 19:19:26 1.9
  +++ pr_warp.c 2001/07/19 23:53:41 1.10
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.9 2001/07/18 19:19:26 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.10 2001/07/19 23:53:41 pier Exp $ */
   #include "pr_warp.h"
   
   /* Initialize this provider. */
  @@ -73,8 +73,11 @@
   wa_debug(WA_MARK,"Opening connection \"%s\"",curr->name);
   if (n_connect(curr)==wa_true) {
   wa_debug(WA_MARK,"Connection \"%s\" opened",curr->name);
  -if (n_configure(curr)==wa_true)
  +if (c_configure(curr)==wa_true) {
   wa_debug(WA_MARK,"Connection \"%s\" configured",curr->name);
  +} else {
  +wa_log(WA_MARK,"Cannot configure connection \"%s\"",curr->name);
  +}
   } else wa_log(WA_MARK,"Cannot open connection \"%s\"",curr->name);
   elem=elem->next;
   }
  @@ -185,9 +188,184 @@
   return(apr_psprintf(pool,"Application ID: %d",(int)(appl->conf)));
   }
   
  +/* Transmit headers */
  +static int headers(void *d, const char *n, const char *v) {
  +warp_header *data=(warp_header *)d;
  +wa_connection *conn=data->conn;
  +warp_config *conf=(warp_config *)conn->conf;
  +warp_packet *pack=data->pack;
  +
  +pack->type=TYPE_REQ_HEADER;
  +p_write_string(pack,(char *)n);
  +p_write_string(pack,(char *)v);
  +if (n_send(conf->sock,pack)!=wa_true) {
  +data->fail=wa_true;
  +return(FALSE);
  +}
  +wa_debug(WA_MARK,"Req. header %s: %s",n,v);
  +return(TRUE);
  +}
  +
   /* Handle a connection from the web server. */
  -static int warp_handle(wa_request *r, wa_application *a) {
  -return(wa_rerror(WA_MARK,r,500,"Not yet implemented"));
  +static int warp_handle(wa_request *r, wa_application *appl) {
  +warp_header *h=(warp_header *)apr_palloc(r->pool,sizeof(warp_header));
  +wa_connection *conn=appl->conn;
  +warp_config *conf=(warp_config *)conn->conf;
  +warp_packet *pack=p_create(r->pool);
  +int status=0;
  +
  +// Check packet
  +if (pack==NULL)
  +return(wa_rerror(WA_MARK,r,500,"Cannot create WARP packet"));
  +
  +// Check application
  +if (((int)(appl->conf))==-1)
  +return(wa_rerror(WA_MARK,r,404,"Application not deployed"));
  +
  +// Attempt to reconnect if disconnected
  +if (conf->sock==NULL) {
  +if (n_connect(conn)==wa_true) {
  +wa_debug(WA_MARK,"Connection \"%s\" opened",conn->name);
  +if (c_configure(conn)==wa_true) {
  +wa_debug(WA_MARK,"Connection \"%s\" configured",conn->name);
  +} else {
  +wa_log(WA_MARK,"Cannot configure connection %s",conn->name);
  +return(wa_rerror(WA_MARK,r,500,
  + "Cannot configure connection \"%s\"",
  + conn->name));
  +}
  +} else {
  +wa_log(WA_MARK,"Cannot open connection %s",conn->name);
  +return(wa_rerror(WA_MARK,r,500,"Cannot open connection %s",
  + conn->name));
  +}
  +}
  +
  +// Let's do it
  +pack->type=TYPE_REQ_INIT;
  +p_write_int(pack,(int)(appl->conf));
  +p_write_string(pack,r->meth);
  +p_write_string(pack,r->ruri);
  +p_write_string(pack,r->args);
  +p_write_string(pack,r->prot);
  +if (n_send(conf->sock,pack)!=wa_true) {
  +n_disconnect(conn);
  +return(wa_rerror(WA_MARK,r,500,"Communitcation interrupted"));
  +} else {
  +wa_debug(WA_MARK,"Req. %s %s %s",r->meth,r->ruri,r->prot);
  +}
  +
  +p_reset(pack);
  +pack->type=TYPE_REQ_CONTENT;
  +p_write_string(pack,r->ctyp);
  +p_write_int(pack,r->clen);
  +if (n_send(conf->sock,pack)!=wa_true) {
  +n_disconnect(conn);
  +return(wa_rerror(WA_MARK,r,500,"Communitcation interrupted"));
  +} else {
  +wa_debug(WA_MARK,"Req. content typ=%s len=%d",r->ctyp,r->clen);
  +}
  +
  +if (r->schm!=NULL) {
  +p_reset(pack);
  +pack->type=TYPE_REQ_SCHEME;
  +p_write_string(pack,r->schm);
  +if (n_send(conf->sock,pack)!=wa_true) {
  +n_disconnect(conn);
  +return(wa_rerror(WA_MARK,r,500,"Communitcation interrupt

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-07-18 Thread pier

pier01/07/18 12:19:26

  Modified:webapp/lib pr_warp.c
  Log:
  Whops... Symbols for the WARP configurations are static.
  
  Revision  ChangesPath
  1.9   +5 -10 jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- pr_warp.c 2001/07/18 19:12:38 1.8
  +++ pr_warp.c 2001/07/18 19:19:26 1.9
  @@ -54,18 +54,9 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.8 2001/07/18 19:12:38 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.9 2001/07/18 19:19:26 pier Exp $ */
   #include "pr_warp.h"
   
  -/* The list of all configured connections */
  -static wa_chain *warp_connections=NULL;
  -/* The list of all deployed connections */
  -static wa_chain *warp_applications=NULL;
  -
  -/* * */
  -/* WEBAPP LIBRARY PROVIDER FUNCTIONS */
  -/* * */
  -
   /* Initialize this provider. */
   static const char *warp_init(void) {
   wa_debug(WA_MARK,"WARP provider initialized");
  @@ -199,6 +190,10 @@
   return(wa_rerror(WA_MARK,r,500,"Not yet implemented"));
   }
   
  +/* The list of all configured connections */
  +wa_chain *warp_connections=NULL;
  +/* The list of all deployed connections */
  +wa_chain *warp_applications=NULL;
   /* The warp provider structure */
   wa_provider wa_provider_warp = {
   "warp",
  
  
  



cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c pr_warp.h pr_warp_config.c pr_warp_network.c pr_warp_packet.c

2001-07-18 Thread pier

pier01/07/18 12:12:38

  Modified:webapp/lib pr_warp.c pr_warp.h pr_warp_config.c
pr_warp_network.c pr_warp_packet.c
  Log:
  Where the hack that "2" came from?
  
  Revision  ChangesPath
  1.8   +2 -2  jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- pr_warp.c 2001/07/18 19:08:35 1.7
  +++ pr_warp.c 2001/07/18 19:12:38 1.8
  @@ -37,7 +37,7 @@
*   *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -2 * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  + * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
* DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
* DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.7 2001/07/18 19:08:35 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.8 2001/07/18 19:12:38 pier Exp $ */
   #include "pr_warp.h"
   
   /* The list of all configured connections */
  
  
  
  1.2   +2 -2  jakarta-tomcat-connectors/webapp/lib/pr_warp.h
  
  Index: pr_warp.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pr_warp.h 2001/07/18 19:08:35 1.1
  +++ pr_warp.h 2001/07/18 19:12:38 1.2
  @@ -37,7 +37,7 @@
*   *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -2 * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  + * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
* DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
* DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.h,v 1.1 2001/07/18 19:08:35 pier Exp $ */
  +/* @version $Id: pr_warp.h,v 1.2 2001/07/18 19:12:38 pier Exp $ */
   #ifndef _PR_WARP_H_
   #define _PR_WARP_H_
   
  
  
  
  1.2   +3 -3  jakarta-tomcat-connectors/webapp/lib/pr_warp_config.c
  
  Index: pr_warp_config.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp_config.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pr_warp_config.c  2001/07/18 19:08:35 1.1
  +++ pr_warp_config.c  2001/07/18 19:12:38 1.2
  @@ -37,7 +37,7 @@
*   *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  -2 * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  + * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
* DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
* DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  @@ -54,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp_config.c,v 1.1 2001/07/18 19:08:35 pier Exp $ */
  +/* @version $Id: pr_warp_config.c,v 1.2 2001/07/18 19:12:38 pier Exp $ */
   #include "pr_warp.h"
   
   wa_boolean n_check(wa_connection *conn, warp_packet *pack) {
  @@ -72,7 +72,7 @@
   wa_log(WA_MARK,"Invalid WARP packet %d (WELCOME)",pack->type);
   return(wa_false);
   }
  -
  +
   if (p_read_ushort(pack,&maj)!=wa_true) {
   wa_log(WA_MARK,"Cannot read major version");
   return(wa_false);

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c wa_request.c

2001-07-15 Thread pier

pier01/07/15 01:39:58

  Modified:webapp/lib pr_warp.c wa_request.c
  Log:
  Modified WARP provider to avoid storing WARP HOST IDs (redundant) and new
  configuration scheme.
  
  Revision  ChangesPath
  1.6   +332 -73   jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- pr_warp.c 2001/07/13 02:19:44 1.5
  +++ pr_warp.c 2001/07/15 08:39:58 1.6
  @@ -37,8 +37,7 @@
*   *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  - * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  - * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  +2 * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
* DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
* DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  @@ -55,7 +54,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.5 2001/07/13 02:19:44 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.6 2001/07/15 08:39:58 pier Exp $ */
   #include 
   
   /* * */
  @@ -63,83 +62,350 @@
   /* * */
   
   /* The WARP connection configuration structure */
  -typedef struct warp_cconfig {
  +typedef struct warp_config {
   apr_sockaddr_t *addr;
   apr_socket_t *sock;
  -wa_boolean disc;
  -} warp_cconfig;
  +int serv;
  +} warp_config;
   
  -/* The WARP application configuration structure */
  -typedef struct warp_aconfig {
  -int host;
  -int appl;
  -wa_boolean depl;
  -} warp_aconfig;
  +/* The WARP packet structure */
  +typedef struct warp_packet {
  +apr_pool_t *pool;
  +int type;
  +int size;
  +int curr;
  +char buff[65536];
  +} warp_packet;
  +
  +/* WARP definitions */
  +#define VERS_MAJOR 0
  +#define VERS_MINOR 9
  +
  +#define TYPE_INVALID -1
  +#define TYPE_ERROR   0x00
  +#define TYPE_FATAL   0xff
  +
  +#define TYPE_CONF_WELCOME 0x01
  +#define TYPE_CONF_DEPLOY  0x02
  +#define TYPE_CONF_APPLIC  0x03
  +#define TYPE_CONF_DONE0x04
   
  +
   /* The list of all configured connections */
   static wa_chain *warp_connections=NULL;
  +/* The list of all deployed connections */
  +static wa_chain *warp_applications=NULL;
   /* This provider */
   wa_provider wa_provider_warp;
   
   /* * */
  +/* PACKET FUNCTIONS  */
  +/* * */
  +static void p_reset(warp_packet *pack) {
  +pack->type=TYPE_INVALID;
  +pack->type=TYPE_INVALID;
  +pack->size=0;
  +pack->curr=0;
  +pack->buff[0]='\0';
  +}
  +
  +static warp_packet *p_create(apr_pool_t *pool) {
  +warp_packet *pack=NULL;
  +
  +if (pool==NULL) return(NULL);
  +pack=(warp_packet *)apr_palloc(pool,sizeof(warp_packet));
  +pack->pool=pool;
  +p_reset(pack);
  +return(pack);
  +}
  +
  +static wa_boolean p_read_ushort(warp_packet *pack, int *x) {
  +int k=0;
  +
  +if ((pack->curr+2)>=pack->size) return(wa_false);
  +k=(pack->buff[pack->curr++]&0x0ff)<<8;
  +k=k|(pack->buff[pack->curr++]&0x0ff);
  +*x=k;
  +return(wa_true);
  +}
  +
  +static wa_boolean p_read_int(warp_packet *pack, int *x) {
  +int k=0;
  +
  +if ((pack->curr+2)>=pack->size) return(wa_false);
  +k=(pack->buff[pack->curr++]&0x0ff)<<24;
  +k=k|((pack->buff[pack->curr++]&0x0ff)<<16);
  +k=k|((pack->buff[pack->curr++]&0x0ff)<<8);
  +k=k|(pack->buff[pack->curr++]&0x0ff);
  +*x=k;
  +return(wa_true);
  +}
  +
  +static wa_boolean p_read_string(warp_packet *pack, char **x) {
  +int len=0;
  +
  +if (p_read_ushort(pack,&len)==wa_false) {
  +*x=NULL;
  +return(wa_false);
  +}
  +if ((pack->curr+len)>=pack->size) {
  +*x=NULL;
  +return(wa_false);
  +}
  +
  +*x=(char *)apr_palloc(pack->pool,(len+1)*sizeof(char));
  +if (*x==NULL) return(wa_false);
  +
  +apr_cpystrn(*x,&pack->buff[pack->curr],len);
  +pack->curr+=len;
  +return(wa_true);
  +}
  +
  +static wa_boolean p_write_ushort(warp_packet *pack, 

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-07-12 Thread pier

pier01/07/12 19:19:48

  Modified:webapp/lib pr_warp.c
  Log:
  Reenabling connection handling.
  
  Revision  ChangesPath
  1.5   +15 -1 jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- pr_warp.c 2001/07/09 22:11:21 1.4
  +++ pr_warp.c 2001/07/13 02:19:44 1.5
  @@ -55,7 +55,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.4 2001/07/09 22:11:21 pier Exp $ */
  +/* @version $Id: pr_warp.c,v 1.5 2001/07/13 02:19:44 pier Exp $ */
   #include 
   
   /* * */
  @@ -154,6 +154,19 @@
   
   /* Notify this provider of its imminent startup. */
   static void warp_startup(void) {
  +wa_chain *elem=warp_connections;
  +wa_boolean ret=FALSE;
  +
  +/* Open all connections having deployed applications */
  +while (elem!=NULL) {
  +wa_connection *curr=(wa_connection *)elem->curr;
  +wa_debug(WA_MARK,"Opening connection \"%s\"",curr->name);
  +if (n_connect(curr)==TRUE) {
  +wa_debug(WA_MARK,"Connection \"%s\" opened",curr->name);
  +} else wa_log(WA_MARK,"Cannot open connection \"%s\"",curr->name);
  +elem=elem->next;
  +}
  +
   wa_debug(WA_MARK,"WARP provider started");
   }
   
  @@ -189,6 +202,7 @@
   
   /* Done */
   conf->sock=NULL;
  +conf->disc=TRUE;
   conn->conf=conf;
   return(NULL);
   }
  
  
  



cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c

2001-07-09 Thread pier

pier01/07/09 15:11:23

  Modified:webapp/lib pr_warp.c
  Log:
  Disabling WARP functionality until a couple of bugs have been fixed. (Just
  in case someone relies on CVS checkouts)
  
  Revision  ChangesPath
  1.4   +5 -512jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- pr_warp.c 2001/06/07 09:40:32 1.3
  +++ pr_warp.c 2001/07/09 22:11:21 1.4
  @@ -55,45 +55,10 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.3 2001/06/07 09:40:32 jfclere Exp $ */
  +/* @version $Id: pr_warp.c,v 1.4 2001/07/09 22:11:21 pier Exp $ */
   #include 
   
   /* * */
  -/* WARP CONSTANTS */
  -/* * */
  -
  -/* Look in WarpConstants.java for a description of these definitions. */
  -#define RID_CONNECTION  0x0
  -#define RID_DISCONNECT  0x0
  -
  -#define TYP_CONINIT_HST 0x0
  -#define TYP_CONINIT_HID 0x1
  -#define TYP_CONINIT_APP 0x2
  -#define TYP_CONINIT_AID 0x3
  -#define TYP_CONINIT_REQ 0x4
  -#define TYP_CONINIT_RID 0x5
  -#define TYP_CONINIT_ERR 0xF
  -
  -#define TYP_REQINIT_MET 0x00010
  -#define TYP_REQINIT_URI 0x00011
  -#define TYP_REQINIT_ARG 0x00012
  -#define TYP_REQINIT_PRO 0x00013
  -#define TYP_REQINIT_HDR 0x00014
  -#define TYP_REQINIT_VAR 0x00015
  -#define TYP_REQINIT_RUN 0x0001D
  -#define TYP_REQINIT_ERR 0x0001E
  -#define TYP_REQINIT_ACK 0x0001F
  -
  -#define TYP_REQUEST_STA 0x00020
  -#define TYP_REQUEST_HDR 0x00021
  -#define TYP_REQUEST_CMT 0x00022
  -#define TYP_REQUEST_DAT 0x00023
  -#define TYP_REQUEST_ERR 0x0002E
  -#define TYP_REQUEST_ACK 0x0002F
  -
  -#define MAXPAYLOAD 65536
  -
  -/* * */
   /* STRUCTURES AND FUNCTIONS DECLARATION  */
   /* * */
   
  @@ -111,79 +76,12 @@
   wa_boolean depl;
   } warp_aconfig;
   
  -typedef struct warp_packet {
  -apr_pool_t *pool; /* The APR memory pool where this packet is allocated */
  -int type;   /* The packet type signature */
  -int size;   /* The size of the buffer (used by read) */
  -int bpos;   /* The current position in the buffer */
  -char *buff; /* The payload buffer */
  -} warp_packet;
  -
   /* The list of all configured connections */
   static wa_chain *warp_connections=NULL;
   /* This provider */
   wa_provider wa_provider_warp;
   
   /* * */
  -/* WARP PACKET FUNCTIONS */
  -/* * */
  -static void p_reset(warp_packet *pack) {
  -pack->type=0;
  -pack->bpos=0;
  -pack->size=0;
  -}
  -
  -static warp_packet *p_create(apr_pool_t *pool) {
  -warp_packet *pack=apr_palloc(pool,sizeof(warp_packet));
  -pack->buff=apr_palloc(pool,MAXPAYLOAD*sizeof(char));
  -pack->pool=pool;
  -p_reset(pack);
  -return(pack);
  -}
  -
  -static wa_boolean p_wshort(warp_packet *p, int k) {
  -if ((p->bpos+2)>MAXPAYLOAD) return(FALSE);
  -p->buff[p->bpos++]=(char)((k>>8)&0x0ff);
  -p->buff[p->bpos++]=(char)(k&0x0ff);
  -return(TRUE);
  -}
  -
  -static wa_boolean p_wstring(warp_packet *p, char *s) {
  -int l=0;
  -int x=0;
  -
  -if (s==NULL) return(p_wshort(p,0));
  -
  -/* Evaluate string length */
  -l=strlen(s);
  -/* Store string length */
  -if (!p_wshort(p,strlen(s))) return(FALSE);
  -/* Check if we have room in the buffer and copy the string */
  -if ((p->bpos+l)>MAXPAYLOAD) return(FALSE);
  -for(x=0; xbuff[p->bpos++]=s[x];
  -return(TRUE);
  -}
  -
  -static int p_rshort(warp_packet *p) {
  -int k=0;
  -int x=0;
  -
  -/* Store the two bytes */
  -x=p->bpos;
  -k=((p->buff[p->bpos++]<<8)&0x0ff00);
  -k=((k|(p->buff[p->bpos++]&0x0ff))&0x0);
  -return(k);
  -}
  -
  -static char *p_rstring(warp_packet *p) {
  -int k=p_rshort(p);
  -char *ret=apr_pstrndup(p->pool,p->buff+p->bpos,k);
  -p->bpos+=k;
  -return(ret);
  -}
  -
  -
  -/* * */
   /* NETWORK FUNCTIONS */
   /* *

cvs commit: jakarta-tomcat-connectors/webapp/lib pr_warp.c wa_main.c wa_request.c

2001-06-09 Thread jfclere

jfclere 01/06/07 02:40:37

  Modified:webapp/include wa.h
   webapp/lib pr_warp.c wa_main.c wa_request.c
  Log:
  Arrange C++ comments that offened my compilers.
  
  Revision  ChangesPath
  1.9   +2 -2  jakarta-tomcat-connectors/webapp/include/wa.h
  
  Index: wa.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/include/wa.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- wa.h  2001/05/12 02:31:48 1.8
  +++ wa.h  2001/06/07 09:40:27 1.9
  @@ -57,7 +57,7 @@
   
   /**
* @author  Pier Fumagalli 
  - * @version $Id: wa.h,v 1.8 2001/05/12 02:31:48 jon Exp $
  + * @version $Id: wa.h,v 1.9 2001/06/07 09:40:27 jfclere Exp $
*/
   #ifndef _WA_H_
   #define _WA_H_
  @@ -100,7 +100,7 @@
   /* All declared providers */
   extern wa_provider wa_provider_info;
   extern wa_provider wa_provider_warp;
  -//extern wa_provider wa_provider_jni;
  +/*extern wa_provider wa_provider_jni;*/
   
   /* WebApp Library includes */
   #include 
  
  
  
  1.3   +5 -5  jakarta-tomcat-connectors/webapp/lib/pr_warp.c
  
  Index: pr_warp.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/pr_warp.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- pr_warp.c 2001/05/12 02:31:48 1.2
  +++ pr_warp.c 2001/06/07 09:40:32 1.3
  @@ -55,7 +55,7 @@
*   *
* = */
   
  -/* @version $Id: pr_warp.c,v 1.2 2001/05/12 02:31:48 jon Exp $ */
  +/* @version $Id: pr_warp.c,v 1.3 2001/06/07 09:40:32 jfclere Exp $ */
   #include 
   
   /* * */
  @@ -154,11 +154,11 @@
   
   if (s==NULL) return(p_wshort(p,0));
   
  -// Evaluate string length
  +/* Evaluate string length */
   l=strlen(s);
  -// Store string length
  +/* Store string length */
   if (!p_wshort(p,strlen(s))) return(FALSE);
  -// Check if we have room in the buffer and copy the string
  +/* Check if we have room in the buffer and copy the string */
   if ((p->bpos+l)>MAXPAYLOAD) return(FALSE);
   for(x=0; xbuff[p->bpos++]=s[x];
   return(TRUE);
  @@ -168,7 +168,7 @@
   int k=0;
   int x=0;
   
  -// Store the two bytes
  +/* Store the two bytes */
   x=p->bpos;
   k=((p->buff[p->bpos++]<<8)&0x0ff00);
   k=((k|(p->buff[p->bpos++]&0x0ff))&0x0);
  
  
  
  1.6   +2 -2  jakarta-tomcat-connectors/webapp/lib/wa_main.c
  
  Index: wa_main.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/wa_main.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- wa_main.c 2001/05/10 21:12:32 1.5
  +++ wa_main.c 2001/06/07 09:40:33 1.6
  @@ -55,7 +55,7 @@
*   *
* = */
   
  -/* @version $Id: wa_main.c,v 1.5 2001/05/10 21:12:32 pier Exp $ */
  +/* @version $Id: wa_main.c,v 1.6 2001/06/07 09:40:33 jfclere Exp $ */
   #include 
   
   /* The current APR memory pool. */
  @@ -66,7 +66,7 @@
   wa_provider *wa_providers[] = {
   &wa_provider_info,
   &wa_provider_warp,
  -//&wa_provider_jni,
  +/*&wa_provider_jni,*/
   NULL,
   };
   
  
  
  
  1.10  +2 -2  jakarta-tomcat-connectors/webapp/lib/wa_request.c
  
  Index: wa_request.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/lib/wa_request.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- wa_request.c  2001/05/10 21:12:33 1.9
  +++ wa_request.c  2001/06/07 09:40:33 1.10
  @@ -55,7 +55,7 @@
*   *
* = */
   
  -/* @version $Id: wa_request.c,v 1.9 2001/05/10 21:12:33 pier Exp $ */
  +/* @version $Id: wa_request.c,v 1.10 2001/06/07 09:40:33 jfclere Exp $ */
   #include 
   
   /* Allocate a new request structure. */
  @@ -191,7 +191,7 @@
   /* Invoke a request in a web application. */
   int wa_rinvoke(wa_request *r, wa_application *a) {
   return(a->conn->prov->handle(r,a));
  -//return(wa_rerror(r,500,"This is being fixed"));
  +/*return(wa_rerror(r,500,"This is being fixed"));*/
   }
   
   void wa_rlog(wa_request *r, const char *f, const int l, const char *fmt, ...) {