httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_core.c
Date Tue, 03 Oct 2000 21:56:46 GMT
trawick     00/10/03 14:56:46

  Modified:    src/main http_core.c
  Log:
  Change core_input_filter() so that it returns an empty brigade upon
  FIN/EOF or error.  This meshes with what getline() looks for.  It isn't
  perfect, but it avoids some nasty loops consuming all available storage
  on http/1.1 connections.  In keepalive state, we call getline to read the
  next request...  getline() calls core_input_filter() (indirectly)...
  core_input_filter() calls apr_recv() which returns APR_SUCCESS/0 bytes
  to signal FIN/EOF.  But core_input_filter() returned a bucket with length
  zero to getline(), so getline() called core_input_filter() again.
  
  Revision  Changes    Path
  1.139     +21 -7     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.138
  retrieving revision 1.139
  diff -u -r1.138 -r1.139
  --- http_core.c	2000/10/02 19:52:37	1.138
  +++ http_core.c	2000/10/03 21:56:43	1.139
  @@ -3251,19 +3251,33 @@
       char *buff;
       apr_size_t length = HUGE_STRING_LEN;
       apr_socket_t *csock = NULL;
  +    apr_status_t rv;
       ap_bucket *e;
   
       /* As soon as we have pool buckets, this should become a palloc. */
       buff = apr_palloc(f->c->pool, HUGE_STRING_LEN);
       ap_bpop_socket(&csock, f->c->client);
   
  -    if (apr_recv(csock, buff, &length) == APR_SUCCESS) {
  -        /* 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, length);
  -        AP_BRIGADE_INSERT_TAIL(b, e); 
  +    rv = apr_recv(csock, buff, &length);
  +    if (rv == APR_SUCCESS) {
  +        if (length > 0) {
  +            /* 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, length);
  +            AP_BRIGADE_INSERT_TAIL(b, e);
  +        }
  +        else {
  +            /* XXX need to trigger EOS/EOF processing;
  +             * for now, return empty brigade because that is what
  +             * getline() looks for */
  +        }
  +    }
  +    else {
  +        /* XXX need to trigger error processing */
  +        /* leave the brigade empty for now; return error code
  +         * in the future */
       }
       return length;
   } 
  
  
  

Mime
View raw message