You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@worldgate.com> on 1998/02/16 05:21:21 UTC

how the heck do you set content-length on printenv?

I'm trying to make a printenv-like Apache module. 

I want it to be able to do persistent HTTP/1.0 connections, so I need a
content-length.

One of the things in the output is content-length.

Grrrrrrrr!

Yea, yea, pad with spaces.  It just ends up being lame.  Aha.  Guess I can
zero-pad instead.  That's legal isn't it?

Why am I doing this?  Because I think that is what webbench uses for
dynamic content and I am trying to convince ZiffDavis to include an Apache
module in the API test.  Don't know if they will or not, but just in
case...



Re: how the heck do you set content-length on printenv?

Posted by Dirk-Willem van Gulik <di...@jrc.it>.
> That isn't the real problem.  I have a decent bound on the size of output,
> but since I have to include the content-length in that output and the size
> of the output depends on the content-length...

Hmm, HTTP headers are not part of the content length me thinks. (And yes,
IIS is creative here, but sticking to the spec might me more fun; and
easier to program :-)
 
DW.



Re: how the heck do you set content-length on printenv?

Posted by Marc Slemko <ma...@worldgate.com>.
On Sun, 15 Feb 1998, Dean Gaudet wrote:

> On Mon, 16 Feb 1998, Marc Slemko wrote:
> 
> > On Sun, 15 Feb 1998, Dean Gaudet wrote:
> > 
> > > Just allocate a chunk of memory and write into it until you know how big
> > > it is.  If your preallocation is too small just allocate more, and more
> > > and more. 
> > 
> > That isn't the real problem.  I have a decent bound on the size of output,
> > but since I have to include the content-length in that output and the size
> > of the output depends on the content-length...
> 
> Huh?  The http headers aren't considered part of the content-length... 

Nono, my _body_ has it in.  ie. it is similar to printenv output.  Yes,
that is what ZD uses for their dynamic content test.  Dumb, but...

Now, they probably don't use persistent connections for that anyway since
most servers / modules won't do it but...

Of course, if they don't use persistent connections then you are hurting
yourself by adding a content-length bceause it adds more bytes of overhead
that aren't counted.  :(


Re: how the heck do you set content-length on printenv?

Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 16 Feb 1998, Marc Slemko wrote:

> On Sun, 15 Feb 1998, Dean Gaudet wrote:
> 
> > Just allocate a chunk of memory and write into it until you know how big
> > it is.  If your preallocation is too small just allocate more, and more
> > and more. 
> 
> That isn't the real problem.  I have a decent bound on the size of output,
> but since I have to include the content-length in that output and the size
> of the output depends on the content-length...

Huh?  The http headers aren't considered part of the content-length... 

Dean



Re: how the heck do you set content-length on printenv?

Posted by Marc Slemko <ma...@worldgate.com>.
On Sun, 15 Feb 1998, Dean Gaudet wrote:

> Just allocate a chunk of memory and write into it until you know how big
> it is.  If your preallocation is too small just allocate more, and more
> and more. 

That isn't the real problem.  I have a decent bound on the size of output,
but since I have to include the content-length in that output and the size
of the output depends on the content-length...

Yes, it is easy enough to just say that it will only be x big, then
calculate it before you output the content-length (since I can put it at
the end), it is just annoying.

Well, not as annoying as looking at how many times the environment table
is gone through to add the env variables then print them, but... I haven't
optimized that yet.  

> 
> Dean
> 
> On Sun, 15 Feb 1998, Marc Slemko wrote:
> 
> > I'm trying to make a printenv-like Apache module. 
> > 
> > I want it to be able to do persistent HTTP/1.0 connections, so I need a
> > content-length.
> > 
> > One of the things in the output is content-length.
> > 
> > Grrrrrrrr!
> > 
> > Yea, yea, pad with spaces.  It just ends up being lame.  Aha.  Guess I can
> > zero-pad instead.  That's legal isn't it?
> > 
> > Why am I doing this?  Because I think that is what webbench uses for
> > dynamic content and I am trying to convince ZiffDavis to include an Apache
> > module in the API test.  Don't know if they will or not, but just in
> > case...
> > 
> > 
> > 
> 


Re: how the heck do you set content-length on printenv?

Posted by Dean Gaudet <dg...@arctic.org>.
Just allocate a chunk of memory and write into it until you know how big
it is.  If your preallocation is too small just allocate more, and more
and more. 

Dean

On Sun, 15 Feb 1998, Marc Slemko wrote:

> I'm trying to make a printenv-like Apache module. 
> 
> I want it to be able to do persistent HTTP/1.0 connections, so I need a
> content-length.
> 
> One of the things in the output is content-length.
> 
> Grrrrrrrr!
> 
> Yea, yea, pad with spaces.  It just ends up being lame.  Aha.  Guess I can
> zero-pad instead.  That's legal isn't it?
> 
> Why am I doing this?  Because I think that is what webbench uses for
> dynamic content and I am trying to convince ZiffDavis to include an Apache
> module in the API test.  Don't know if they will or not, but just in
> case...
> 
> 
>