httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Kukuchka <chr...@sequoiagroup.com>
Subject Re: ap_rwrite
Date Thu, 29 May 2008 20:52:48 GMT
Mike O'Leary wrote:
> I was just wondering if the ap_rwrite call could return some value less than the
> number of bytes requested to be written.  I wanted to know if I need to put
> a loop around all of my ap_rwrite calls to verify that all the data is
> sent.
Mike,

In answer to your question, yes, a loop is in order.  Something like this:

while (n_bytes > 0)
    {
      int n = (ap_rwrite (data, n_bytes, r));
      if (n < 0)
	{
	  /* error writing to client */
	}
      n_bytes -= n;
      data += n;
    }

Further, keep in mind if you are writing an Apache 2 module, you should *not* be writing directly
to the client.  Also, there may be a more specific mailing list available for questions regarding
the ap* utilities.

Chris Kukuchka
Sequoia Group, Inc.




Mime
View raw message