httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike O'Leary" <molear...@gmail.com>
Subject Re: ap_rwrite
Date Thu, 29 May 2008 21:02:56 GMT
Chris,

Thanks for the info.  I assume that ap_rwrite is writing directly to the
client which you mention is bad.  What is the preferred method and why is
the ap_rwrite not preferred?  Pardon me, I'm a newb.

Thanks,
Mike

On Thu, May 29, 2008 at 4:52 PM, Chris Kukuchka <chrisk@sequoiagroup.com>
wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message