httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <>
Subject Re: $apr->upload broken?
Date Sat, 19 Jul 2003 14:53:03 GMT
Jamie Krasnoo <> writes:


> [Sat Jul 19 00:58:50 2003] [error] [client] Can't use an
> undefined value as a HASH reference at
> /home/tekton/src/httpd-apreq-2/glue/perl/t/response/TestApReq/
> line 27.
> I looked in the test code to see if I could do something about it and I
> think I'm over my head on it. Any quick fixes? 

line 27 is here:

        my ($upload) = values %{$req->upload};

What *should* happen is that $req->upload winds up calling
apreq_uploads() in src/apreq_params.c, which 

  (1) parses the entire POST,
  (2) returns a table of uploads (apreq_param_t with nonempty bb's).

The XS for $req->upload wraps the resulting table into an APR::Table
object, which references a tied hash.  The only way for $req->upload
to be 'undef' here is for step (1) to fail.  What I recommend doing
is adding some apreq_log(APREQ_DEBUG 0, req->env, "...") debug
statements to apreq_uploads() (in particular, I'd pay close attention 
to the value of req->cfg->read_ahead).  If that value turns out to be
garbage, which has happened to me in the past, see if something like 
this will pass (don't forget to recompile libapreq - % make - before 
running the tests):

  APREQ_DECLARE(apr_table_t *) apreq_uploads(apr_pool_t *pool,
                                             const apreq_request_t *req)
      apr_table_t *t;
      apr_status_t s;
      do s = apreq_env_read(req->env, APR_BLOCK_READ, 64 * 1024);
      while (s == APR_INCOMPLETE);

      if (req->body == NULL)
          return NULL;

      t = apr_table_make(pool, APREQ_NELTS);
      /* XXX needs appropriate copy/merge callbacks */
      apr_table_do(upload_push, t, req->body, NULL);
      return t;

> I also noticed APR::Brigade being used. I don't think I enabled
> bucketeer. Does that need to be enabled?


Joe Schaefer

View raw message