tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test httpd_wrap.h httpd_wrap.c
Date Sun, 01 Aug 2004 13:22:19 GMT
mturk       2004/08/01 06:22:19

  Modified:    ajp/ajplib/test httpd_wrap.h httpd_wrap.c
  Log:
  Added few more compat functions, like ap_create_conn_config, etc...
  
  Revision  Changes    Path
  1.9       +48 -4     jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.h
  
  Index: httpd_wrap.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- httpd_wrap.h	30 Jul 2004 10:20:00 -0000	1.8
  +++ httpd_wrap.h	1 Aug 2004 13:22:19 -0000	1.9
  @@ -31,6 +31,13 @@
   #define AP_DECLARE(type)            type
   #define AP_DECLARE_NONSTD(type)     type
   #define AP_DECLARE_DATA
  +/**
  + * @internal
  + * modules should not used functions marked AP_CORE_DECLARE
  + */
  +#ifndef AP_CORE_DECLARE
  +# define AP_CORE_DECLARE	AP_DECLARE
  +#endif 
   
   /** The default string lengths */
   #define MAX_STRING_LEN HUGE_STRING_LEN
  @@ -131,6 +138,10 @@
                                       ((x) == HTTP_SERVICE_UNAVAILABLE) || \
                       ((x) == HTTP_NOT_IMPLEMENTED))
                       
  +/* Maximum number of dynamically loaded modules */
  +#ifndef DYNAMIC_MODULE_LIMIT
  +#define DYNAMIC_MODULE_LIMIT 64
  +#endif
   /* Default administrator's address */
   #define DEFAULT_ADMIN "[no address given]"
   /* The timeout for waiting for messages */
  @@ -238,6 +249,14 @@
    * The method mask bit to shift for anding with a bitmask.
    */
   #define AP_METHOD_BIT ((apr_int64_t)1)
  +
  +/*
  + * This is a convenience macro to ease with checking a mask
  + * against a method name.
  + */
  +#define AP_METHOD_CHECK_ALLOWED(mask, methname) \
  +    ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
  +
   /** @} */
   
   /** default HTTP Server protocol */
  @@ -270,7 +289,8 @@
   typedef struct request_rec  request_rec;
   typedef struct conn_rec     conn_rec;
   typedef struct server_rec   server_rec;
  -
  +typedef struct ap_conf_vector_t ap_conf_vector_t;
  + 
   
   /* fake structure definitions */
   /** A structure that represents one process */
  @@ -382,10 +402,9 @@
       /** A struct containing the components of URI */
       apr_uri_t parsed_uri;
       /** Options set in config files, etc. */
  -    void *per_dir_config;
  +    struct ap_conf_vector_t *per_dir_config;
       /** Notes on *this* request */
  -    void *request_config;
  -         
  +    struct ap_conf_vector_t *request_config;         
   };
   
   /** Structure to store things which are per connection */
  @@ -414,6 +433,8 @@
       char *local_host;
        /** ID of this connection; unique at any point in time */
       long id;
  +    /** Notes on *this* connection */
  +    struct ap_conf_vector_t *conn_config;
       /** send note from one module to another, must remain valid for all
        *  requests on this conn */
       apr_table_t *notes; 
  @@ -703,6 +724,29 @@
    * for the AddOutputFilterByType directive to work correctly.
    */
   AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct);
  +
  +/**
  + * Setup the config vector for a request_rec
  + * @param p The pool to allocate the config vector from
  + * @return The config vector
  + */
  +AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_request_config(apr_pool_t *p);
  +
  +/* For http_connection.c... */
  +/**
  + * Setup the config vector for a connection_rec
  + * @param p The pool to allocate the config vector from
  + * @return The config vector
  + */
  +AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_conn_config(apr_pool_t *p);
  +
  +/**
  + * Get the method number associated with the given string, assumed to
  + * contain an HTTP method.  Returns M_INVALID if not recognized.
  + * @param method A string containing a valid HTTP method
  + * @return The method number
  + */
  +AP_DECLARE(int) ap_method_number_of(const char *method);
   
   /**
    * create the request_rec structure from fake client connection 
  
  
  
  1.12      +39 -2     jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.c
  
  Index: httpd_wrap.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/httpd_wrap.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- httpd_wrap.c	30 Jul 2004 10:20:00 -0000	1.11
  +++ httpd_wrap.c	1 Aug 2004 13:22:19 -0000	1.12
  @@ -232,6 +232,7 @@
   
       c->sbh = sbh;
   
  +    c->conn_config = ap_create_conn_config(ptrans);
       /* Got a connection structure, so initialize what fields we can
        * (the rest are zeroed out by pcalloc).
        */
  @@ -501,6 +502,41 @@
       /* NOTREACHED */
   }
   
  +/* Get the method number associated with the given string, assumed to
  + * contain an HTTP method.  Returns M_INVALID if not recognized.
  + *
  + * This is the first step toward placing method names in a configurable
  + * list.  Hopefully it (and other routines) can eventually be moved to
  + * something like a mod_http_methods.c, complete with config stuff.
  + */
  +AP_DECLARE(int) ap_method_number_of(const char *method)
  +{
  +    apr_size_t len = strlen(method);
  +    int which = lookup_builtin_method(method, len);
  +
  +    if (which != UNKNOWN_METHOD)
  +        return which;
  +
  +    return M_INVALID;
  +}
  +
  +static ap_conf_vector_t *create_empty_config(apr_pool_t *p)
  +{
  +    void *conf_vector = apr_pcalloc(p, sizeof(void *) *
  +                                    (DYNAMIC_MODULE_LIMIT));
  +    return conf_vector;
  +}
  +
  +AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_request_config(apr_pool_t *p)
  +{
  +    return create_empty_config(p);
  +}
  +
  +AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_conn_config(apr_pool_t *p)
  +{
  +    return create_empty_config(p);
  +}
  +
   AP_DECLARE(apr_status_t) ap_wrap_make_request(request_rec *r, const char *url,
                                                 const char *method,
                                                 const char *content_type,
  @@ -524,6 +560,7 @@
       r->method = method;
       r->protocol = AP_SERVER_PROTOCOL;
       r->proto_num = HTTP_VERSION(1, 1);
  +    r->request_config  = ap_create_request_config(r->pool);
   
       if ((rc = apr_uri_parse(r->pool, url, &r->parsed_uri)) != APR_SUCCESS) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, "error parsing uri");
  @@ -589,8 +626,8 @@
   AP_DECLARE(int) ap_should_client_block(request_rec *r)
   {
       /* First check if we have already read the request body */
  -
  -    if (r->read_length || r->remaining <= 0)
  +    /* Since we are not using chunked skip the readed checking */
  +    if (r->read_length)
           return 0;
       else
           return 1;
  
  
  

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


Mime
View raw message