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 Re: [ANN] libapreq2-2.01-dev-rc1 release candidate #1
Date Tue, 04 Nov 2003 18:57:56 GMT
Vladimir Dudov <dudov@relexus.com> writes:

[...]

> >What do you mean by ignore- abort parsing, or keep "normal" params
> >separate from uploads?
> >
> >
> I don't want to allocate any memory for uploaded files. But other form
> parameters should be captured.

mod_apreq will automatically spool large uploads (>256KB by default) to
disk, but if you'd rather drop their contents entirely, probably the
simplest approach would be to write a parser hook that just destroys the
upload brigade.  The code (untested- the hook API is very new) would
look something like

  APREQ_DECLARE_HOOK(hfunc) {
    apr_brigade_destroy(bb);
  }

  ...and in your module...
      apreq_request_t *req = apreq_request(r, NULL);
      apreq_hook_t *hook = apreq_make_hook(r->pool, hfunc, NULL, NULL);

      if (req->parser)
        apreq_add_hook(req->parser, hook);
      else
        req->parser = apreq_parser(r, hook);



You'll still have an entry for the upload in the req->body table, but the 
associated apreq_param_t 's bucket brigade (which normally holds the upload's
contents) should be empty.

[...]

> >The parsed data is available though the apreq_request_t struct,
> >usually by calling apreq_param  (see apreq_params.h for more details).
> >
> >
> Do I call apreq_request(r, NULL) everytime I need (apreq_request_t*)

Yes, unless you're doing something really funky and want to use
a "private" apreq_request_t object (not the per-request struct 
you get with a NULL argument).

-- 
Joe Schaefer


Mime
View raw message