httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: cvs commit: apache-2.0/src/main http_core.c
Date Tue, 10 Oct 2000 03:09:57 GMT
rbb@covalent.net writes:

> -1  That is wrong.  The code to look for LF is 100% correct.  The part
> that was the ugly hack was the duplicated ASCII_LF macro.

No way...  

Look at this code...

    rv = apr_recv(csock, buff, &length);

 suppose we just read 100 bytes of header and 8092 bytes of
 posted data into our 8192-byte buffer

 rv is APR_SUCCESS, length is 8192

    if (rv == APR_SUCCESS) {
        if (length > 0) {
            templen = length - 1;

 the next line looks for LF in the posted data, which is
 bogosity

            while (buff[templen] != ASCII_LF) {

 the next line tells apr_recv to read up to 8192 bytes into the
 storage beyond our buffer; more bogosity

                rv = apr_recv(csock, buff + templen + 1, &length);
                templen += length;
            }
                 

If this code is really supposed to look for LF, what the heck is the
code in http_filter() for?  That code seems perfectly capable of
finding the end of a header line.  In addition, it even knows when it
is valid to think in terms of header lines (excusing the possibility
of chunked encoding for the moment).

core_input_filter() doesn't know the difference between header and
body.  As such, it can't look for LF.

> 
> Ryan
> 
> On 10 Oct 2000 trawick@locus.apache.org wrote:
> 
> > trawick     00/10/09 19:10:42
> > 
> >   Modified:    src/main http_core.c
> >   Log:
> >   core_input_filter():
> >     remove old code which looked for LF
> >     return apr_status_t value instead of length
> >   
> >   Revision  Changes    Path
> >   1.158     +4 -16     apache-2.0/src/main/http_core.c
> >   
> >   Index: http_core.c
> >   ===================================================================
> >   RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
> >   retrieving revision 1.157
> >   retrieving revision 1.158
> >   diff -u -r1.157 -r1.158
> >   --- http_core.c	2000/10/09 23:11:21	1.157
> >   +++ http_core.c	2000/10/10 02:10:42	1.158
> >   @@ -3305,12 +3305,8 @@
> >    
> >    static int core_input_filter(ap_filter_t *f, ap_bucket_brigade *b)
> >    {
> >   -/* XXX this needs to be moved to a common header file, but this is an ugly
> >   - * hack just for today.
> >   - */
> >   -#define ASCII_LF '\012'
> >        char *buff;
> >   -    apr_ssize_t length = HUGE_STRING_LEN, templen = 0;
> >   +    apr_ssize_t length = HUGE_STRING_LEN;
> >        apr_socket_t *csock = NULL;
> >        apr_status_t rv;
> >        ap_bucket *e;
> >   @@ -3322,17 +3318,11 @@
> >        rv = apr_recv(csock, buff, &length);
> >        if (rv == APR_SUCCESS) {
> >            if (length > 0) {
> >   -            templen = length - 1;
> >   -            while (buff[templen] != ASCII_LF) {
> >   -                rv = apr_recv(csock, buff + templen + 1, &length);
> >   -                templen += length;
> >   -            }
> >   -                 
> >                /* This should probably be a pool bucket, but using a transient is

> >                 * actually okay here too.  We know the pool we are using will always

> >                 * be available as long as the connection is open.
> >                 */
> >   -            e = ap_bucket_create_transient(buff, templen + 1);
> >   +            e = ap_bucket_create_transient(buff, length);
> >                AP_BRIGADE_INSERT_TAIL(b, e);
> >            }
> >            else {
> >   @@ -3342,11 +3332,9 @@
> >            }
> >        }
> >        else {
> >   -        /* XXX need to trigger error processing */
> >   -        /* leave the brigade empty for now; return error code
> >   -         * in the future */
> >   +        return rv;
> >        }
> >   -    return templen;
> >   +    return APR_SUCCESS;
> >    }
> >    /* Default filter.  This filter should almost always be used.  Its only job
> >     * is to send the headers if they haven't already been sent, and then send
> >   
> >   
> >   
> > 
> 
> 
> _______________________________________________________________________________
> Ryan Bloom                        	rbb@apache.org
> 406 29th St.
> San Francisco, CA 94131
> -------------------------------------------------------------------------------
> 
> 
> 

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message