apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apr/network_io/unix sendrecv.c
Date Sat, 17 Feb 2001 01:07:08 GMT
On Fri, Feb 16, 2001 at 09:34:09PM -0000, trawick@apache.org wrote:
>...
>   +    /* HP-UX can only send one header iovec and one footer iovec; try to
>   +     * only allocate storage to combine input iovecs when we really have to
>   +     */
>...
>   +        /* XXX:  BUHHH? wow, what a memory leak! */
>   +        headerbuf = hdtrarray[0].iov_base = apr_palloc(sock->cntxt, headerlen);

Use a subpool. Create if/when you need to do this apr_palloc() (or the one
for the trailers). Toss on exit from the function (watch out for early exit).

>...
>        do {
>   +        if (nbytes) {       /* any bytes to send from the file? */
>   +            rc = sendfile(sock->socketdes,      /* socket  */
>   +                          file->filedes,        /* file descriptor to send */
>   +                          *offset,              /* where in the file to start */
>   +                          nbytes,               /* number of bytes to send from file
*/
>   +                          hdtrarray,            /* Headers/footers */
>   +                          flags);               /* undefined, set to 0 */
>   +        }
>   +        else {              /* we can't call sendfile() for trailers only */
>   +            rc = write(sock->socketdes, hdtrarray[1].iov_base, hdtrarray[1].iov_len);
>   +        }
>   +    } while (rc == -1 && errno == EINTR);

If nbytes==0, then where/how are the headers sent? I just see the trailers.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message