You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@apache.org on 2001/05/10 08:28:45 UTC

cvs commit: jakarta-tomcat-4.0/connectors/include wa_request.h

pier        01/05/09 23:28:45

  Modified:    connectors/include wa_request.h
  Log:
  New request-handling functions and method.
  
  Revision  Changes    Path
  1.4       +67 -81    jakarta-tomcat-4.0/connectors/include/wa_request.h
  
  Index: wa_request.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/include/wa_request.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- wa_request.h	2001/04/25 17:04:17	1.3
  +++ wa_request.h	2001/05/10 06:28:43	1.4
  @@ -56,33 +56,37 @@
    * ========================================================================= */
   
   /**
  - * @package Request
  + * @package Request Handling
    * @author  Pier Fumagalli <ma...@eng.sun.com>
  - * @version $Id: wa_request.h,v 1.3 2001/04/25 17:04:17 pier Exp $
  + * @version $Id: wa_request.h,v 1.4 2001/05/10 06:28:43 pier Exp $
    */
   #ifndef _WA_REQUEST_H_
   #define _WA_REQUEST_H_
   
  -/* The host description data type. */
  -typedef struct wa_hostdata wa_hostdata;
  -
   /**
    * The host description structure.
    */
   struct wa_hostdata {
  -	/**
  -	 * The host name.
  -	 */
  -	char *host;
  -	/**
  -	 * The host address (as string so that we don't have to deal with
  -	 * IPv4/IPv6 differences).
  -	 */
  -	char *addr;
  -	/**
  -	 * The port number.
  -	 */
  -	int port;
  +    /** The host name. */
  +    char *host;
  +    /** The host address (as a string - no worries about IPv6) */
  +    char *addr;
  +    /** The port number. */
  +    int port;
  +};
  +
  +/**
  + * The webserver request handler callback structure.
  + */
  +struct wa_handler {
  +    void (*log)(wa_request *r, const char *file, const int line, char *msg);
  +    void (*setstatus)(wa_request *r, int status);
  +    void (*setctype)(wa_request *r, char *type);
  +    void (*setheader)(wa_request *r, char *name, char *value);
  +    void (*commit)(wa_request *r);
  +    void (*flush)(wa_request *r);
  +    int (*read)(wa_request *r, char *buf, int len);
  +    int (*write)(wa_request *r, char *buf, int len);
   };
   
   /**
  @@ -92,65 +96,36 @@
    * of one of the configured applications.
    */
   struct wa_request {
  -	/**
  -	 * The APR memory pool where this request is allocated.
  -	 */
  -	apr_pool_t *pool;
  -	/* The web-server specific callback data passed when the functions
  -	 * specified in the <code>wa_callback</code> structure given at
  -	 * initialization are accessed.
  -	 */
  -	void *data;
  -	/**
  -	 * The HTTP method (ex. GET, POST...).
  -	 */
  -	char *meth;
  -	/**
  -	 * The HTTP request URI (ex. /webapp/index.html).
  -	 */
  -	char *ruri;
  -	/**
  -	 * The URL-encoded list of HTTP query arguments from the request.
  -	 */
  +    /** The APR memory pool where this request is allocated. */
  +    apr_pool_t *pool;
  +    /** The request handler structure associated with this request. */
  +    wa_handler *hand;
  +    /** The web-server specific callback data.*/
  +    void *data;
  +    /** The server host data. */
  +    wa_hostdata *serv;
  +    /** The client host data. */
  +    wa_hostdata *clnt;
  +    /** The HTTP method (ex. GET, POST...). */
  +    char *meth;
  +    /** The HTTP request URI (ex. /webapp/index.html). */
  +    char *ruri;
  +    /** The URL-encoded list of HTTP query arguments from the request. */
       char *args;
  -    /**
  -     * The HTTP protocol name and version (ex. HTTP/1.0, HTTP/1.1...).
  -     */
  +    /** The HTTP protocol name and version (ex. HTTP/1.0, HTTP/1.1...). */
       char *prot;
  -	/**
  -	 * The HTTP request URL scheme (the part before ://, ex http, https).
  -	 */
  +    /** The HTTP request URL scheme (the part before ://, ex http, https). */
       char *schm;
  -    /**
  -     * The server host data.
  -     */
  -    wa_hostdata *serv;
  -	/**
  -	 * The client host data.
  -	 */
  -	wa_hostdata *clnt;
  -	/**
  -	 * The remote user name, if this request was authenticated by the web
  -	 * server, or <b>NULL</b>.
  -	 */
  -	char *user;
  -	/**
  -	 * The authentication method used by the web server to authenticate the
  -	 * remote user, or <b>NULL</b>.
  -	 */
  +    /** The remote user name or <b>NULL</b>. */
  +    char *user;
  +    /** The authentication method or <b>NULL</b>. */
       char *auth;
  -	/**
  -	 * The content length of this request.
  -	 */
  +    /** The content length of this request. */
       long clen;
  -	/**
  -	 * The number of bytes read out of this request body.
  -	 */
  +    /** The number of bytes read out of this request body. */
       long rlen;
  -	/**
  -	 * The current headers table.
  -	 */
  -	apr_table_t *hdrs;
  +    /** The current headers table. */
  +    apr_table_t *hdrs;
   };
   
   /**
  @@ -158,10 +133,11 @@
    *
    * @param r A pointer to where the newly allocated <code>wa_request</code>
    *          structure must be allocated.
  + * @param h The web-server specific handler for this request.
    * @param d The web-server specific data for this request.
    * @return An error message on faliure or <b>NULL</b>.
    */
  -const char *WA_AllocRequest(wa_request **r, void *d);
  +const char *wa_ralloc(wa_request **r, wa_handler *h, void *d);
   
   /**
    * Clean up and free the memory used by a request structure.
  @@ -169,26 +145,36 @@
    * @param r The request structure to destroy.
    * @return An error message on faliure or <b>NULL</b>.
    */
  -const char *WA_FreeRequest(wa_request *r);
  +const char *wa_rfree(wa_request *r);
   
   /**
  - * Invoke a request in a web application.
  + * Report an HTTP error to the client.
    *
    * @param r The WebApp Library request structure.
  - * @param a The application to which this request needs to be forwarded.
  + * @param s The HTTP response status number.
  + * @param fmt The message format string (printf style).
  + * @param ... The parameters to the format string.
    * @return The HTTP result code of this operation.
    */
  -int WA_InvokeRequest(wa_request *r, wa_application *a);
  +int wa_rerror(wa_request *r, int s, const char *fmt, ...);
   
   /**
  - * Report the set up of a list of web applications to the client thru an
  - * HTTP request.
  + * Invoke a request in a web application.
    *
    * @param r The WebApp Library request structure.
  - * @param a A <b>NULL</b> terminated list of applications for which a
  - *          description should be generated.
  + * @param a The application to which this request needs to be forwarded.
    * @return The HTTP result code of this operation.
    */
  -int WA_InfoRequest(wa_request *r, wa_application **a);
  +int wa_rinvoke(wa_request *r, wa_application *a);
  +
  +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_rsetctype(wa_request *r, char *type);
  +void wa_rsetheader(wa_request *r, char *name, char *value);
  +void wa_rcommit(wa_request *r);
  +void wa_rflush(wa_request *r);
  +int wa_rread(wa_request *r, char *buf, int len);
  +int wa_rwrite(wa_request *r, char *buf, int len);
  +int wa_rprintf(wa_request *r, const char *fmt, ...);
   
   #endif /* ifndef _WA_REQUEST_H_ */