httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: cvs commit: httpd-2.0/modules/proxy proxy_http.c
Date Sat, 29 Sep 2001 21:19:38 GMT
On Sat, 29 Sep 2001, Graham Leggett wrote:

> > Should the pool used for an active FTP connection therefore also be
> > immortal?
>
> As I understand it the reference to the immortal bucket was because CRLF
> is a static string, and creating a 3 byte buffer for the string is a
> waste.

Almost, not quite.  The bucket type you use _must_ represent the actual
type of the data you put in it (not what type you want it to become).  If
you put in data that's been allocated from a pool (eg with psprintf or
pstrdup or pstrcat or whatever), then you use a pool bucket.  If you put
in a static string like "\r\n", you must use an immortal bucket.  Putting
it into a bucket type other than what it really is could cause bad things
to happen, like trying to free a const string for example.

So what you said above is correct up until the part about creating a 3
byte buffer, because pool_create does NOT create a buffer to copy its
argument into... it uses the original entity.  Remember, this a zero-copy
mentality.  =-)

(There is one exception to all this, which is heap_create with the copy
flag set, which actually copies the input string onto the heap and makes a
bucket around THAT.)

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Mime
View raw message