httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject [apreq-2] introduction: apreq_value_t & derived structures
Date Thu, 08 May 2003 17:44:21 GMT
Here's what apreq_value_t looks like:

  typedef struct apreq_value_t {
    const char          *name;
    apr_status_t         status;
    apr_size_t           size;
    char                 data[1];
  } apreq_value_t;

These things are really just C-strings with lots of metacrap 
in front of them.  When "values" are constructed, the value's name,
status, & size are filled in, and the actual data (string) is 
copied to data[]  (the resulting data array is always nul-terminated:
v->data[v->size] == 0).

Cookies & params add even more metacrap by putting an apreq_value_t 
(NOT A POINTER!) at the bottom of their definitions:

  typedef struct apreq_cookie_t {
    apreq_cookie_version_t version;
    char           *path;
    char           *domain;
    char           *port;
    unsigned        secure;
    char           *comment;
    char           *commentURL;
    union {
        apr_int64_t   max_age; 
        const char   *expires; 
    } time;

    apreq_value_t   v;

  } apreq_cookie_t;

  typedef struct apreq_param_t {
    enum { ASCII, UTF_8, UTF_16, ISO_LATIN_1 } charset;
    char                *language;
    apreq_table_t       *info;
    apr_bucket_brigade  *bb;

    apreq_value_t        v;

  } apreq_param_t;


The cookie struct is fairly straightforward; for params, the 
charset/language attributes are currently unused and may go away.
The "info" attribute is where the mfd parser puts the per-part 
header info.  For file uploads, the mfd parser copies the incoming 
buckets into "bb".  If an upload hook were added to the mfd parser, 
the parser would run the incoming buckets through the hook (which is 
really acting as a filter) before adding them to "bb".

Any comments/questions so far?
-- 
Joe Schaefer


Mime
View raw message