httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: ap_read() and APR_EOF (Was: Re: cvs commit: apache-2.0/src/main http_protocol.c)
Date Mon, 08 Nov 1999 12:30:36 GMT

> >It appears that OS/2's APR code uses APR_EOF in ap_read and ap_write,
> >while Unix's does not. 

The reason Unix doesn't return APR_EOF when it hits the end of the file
while reading, is that APR_EOF was introduced long after ap_read was
written.  This is a mistake, that would have been corrected in time.

I think I saw one commit that removed APR_EOF from the OS/2 ap_read
function.  I really disagree with this.  I would like to see OS/2 put
APR_EOF back in, and I would like to see Unix, Windows, and beos put it
in.  This is simply an oversight that was introduced because a lot of the
APR status codes were introduced as they were needed.  I could only forsee
so much when designing this.

I like the idea of having APR return error codes, and status codes.  The
utlimate status is APR_SUCCESS, everything is great and working.  But that
isn't the only status that programmers care about.  APR_EOF is an
important bit of information to have, and I would like to see it used.

Just my opinion, but I would like to see this re-visited.


> It only returns APR_EOF in the case where 0 bytes were read which I feel is
> the correct behaviour. The status code should tell you WHY you got 0 bytes
> back. Returning 'success' when you failed to read any data makes no sense to
> me.
> >One standard should be chosen.
> Absolutely, and it should be documented somewhere.
> >I'm not a big fan of APR_EOF in these cases because it makes checking
> >for "success" more complicated. 
> What's wrong with (status == APR_SUCCESS) ?
> The way I've done it you can be sure that 
> if status == APR_SUCCESS then nbytes > 0
> BTW, I'm only talking about ap_read(). ap_write() never returns APR_EOF, I
> don't know where you got that one.....
> -- 
>  ______________________________________________________________________________
>  |  Brian Havard                 |  "He is not the messiah!                   |
>  |  |  He's a very naughty boy!" - Life of Brian |
>  ------------------------------------------------------------------------------

Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message