apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Wells" <awe...@cd-crafters.com>
Subject RE: mod_include_post...the saga continues
Date Fri, 27 Aug 2004 14:43:19 GMT
Nick had recommend that I use the request_config field to store the pointer
to the bucket brigade copy.

I have done so, but when I go to retrieve the brigade and try to get it's
length, I get some nasty segmentation faults.  Also, I have removed any
other code from my module that uses r->request_config, so it should be
untouched as far as I can see.

My question is, Is the bucket brigade or buckets in my "copy" being cleaned
up to soon?

Here is my code in my InputFilter module:

		apr_bucket_brigade *bbcopy;
		bbcopy = apr_brigade_create(f->c->pool, f->c->bucket_alloc);
		apr_bucket *e;                                                  \
    		for (e = APR_BRIGADE_FIRST(bb);
		     e != APR_BRIGADE_SENTINEL(bb);    \
		     e = APR_BUCKET_NEXT(e))                                    \
    		{                                                               \
	        apr_bucket *c;                                              \
        	  apr_bucket_copy(e, &c);                                     \
        	  APR_BRIGADE_INSERT_TAIL(bbcopy, c);
\
		}                                                               \
		apr_table_set(r->notes, "bbcopy", "moose");
            ap_set_module_config(r->request_config, &include_module,
bbcopy);
		// This checks to make sure it works
		bbcopy = ap_get_module_config(r->request_config, &include_module);
	      apr_brigade_length(bbcopy, 1, &len);
		ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "brigade length: %i", len);

Here is my code in my OutputFilter module:

	apr_bucket_brigade *bbcopy;
	bbcopy = ap_get_module_config(r->request_config, &include_module);
	apr_off_t len;
      apr_brigade_length(bbcopy, 1, &len);
	ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "brigade length: %i",
len);*/

Any suggestions on what I should do differently???

Thanks,
Anthony

-----Original Message-----
From: Bojan Smojver [mailto:bojan@rexursive.com]
Sent: Friday, August 27, 2004 1:33 AM
To: Anthony Wells
Cc: joe+gmane@sunstarsys.com; APREQ List; apache-modules@covalent.net
Subject: Re: mod_include_post...the saga continues


You should use apr_table_setn() function, because the bucket brigade may
have
zero bytes within itself, which will then not get copied. Naturally, force
the
cast of the pointer into (const char *) and you should be good.

Quoting Anthony Wells <awells@cd-crafters.com>:

> Great news!!!
>
> I'm almost finished with this project, or so do I believe.
>
> Currently, I have a duplicate of the bucket brigade that has the POST data
> that was parsed in the apreq filter.  However, I'm not sure where to stuff
> this bucket brigade so I can access it later in the mod_include output
> filter.
>
> I've tried stuffing it in r->notes using
> 	apr_table_set(r->notes, "bbcopy", bbcopy);
>
> but that doesn't work, well because it expects a (const char *).
>
> Any ideas where I can stuff it and pull it out later.
>
> Thanks in advance,
> Anthony
>
>


--
Bojan


Mime
View raw message