httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_core.c
Date Thu, 12 Oct 2000 18:01:37 GMT
rbb         00/10/12 11:01:37

  Modified:    src      CHANGES
               src/ap   ap_buckets_file.c
               src/include ap_buckets.h
               src/main http_core.c
  Log:
  Remove the offset field from ap_bucket type.  This is a file bucket
  specific value, and therefore it belongs in the ap_bucket_file type,
  which was also created with this commit.  ap_bucket needs to be as generic
  as possible to make it easily extensible, which means we have to keep
  the generic ap_bucket type very separate from ap_bucket_foo.
  
  Revision  Changes    Path
  1.270     +5 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.269
  retrieving revision 1.270
  diff -u -r1.269 -r1.270
  --- CHANGES	2000/10/12 16:35:36	1.269
  +++ CHANGES	2000/10/12 18:01:25	1.270
  @@ -1,4 +1,9 @@
   Changes with Apache 2.0a8
  +  *) Remove file bucket specific information from the ap_bucket type.
  +     This has been moved to a file_bucket specific type that hangs off
  +     the data pointer in the ap_bucket type.
  +     [Ryan Bloom]
  +
     *) Input filtering now has a third argument.  This is the amount of data
        to read from lower filters.  This argument can be -1, 0, or a positive
        number.  -1 means give me all the data you have, I'll deal with it and
  
  
  
  1.2       +19 -9     apache-2.0/src/ap/ap_buckets_file.c
  
  Index: ap_buckets_file.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_file.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ap_buckets_file.c	2000/09/21 16:26:55	1.1
  +++ ap_buckets_file.c	2000/10/12 18:01:28	1.2
  @@ -58,10 +58,11 @@
   #include <stdlib.h>
   
   /* XXX: We should obey the block flag */
  -static apr_status_t file_read(ap_bucket *a, const char **str,
  +static apr_status_t file_read(ap_bucket *e, const char **str,
   			      apr_ssize_t *len, int block)
   {
  -    apr_file_t *f = (apr_file_t *) a->data;
  +    ap_bucket_file *a = (ap_bucket_file *)e->data;
  +    apr_file_t *f = (apr_file_t *) a->fd;
       ap_bucket *b = NULL;
       char *buf;
       apr_status_t rv;
  @@ -69,11 +70,11 @@
       buf = malloc(IOBUFSIZE);
       *str = buf;
   
  -    if (a->length > IOBUFSIZE) {
  +    if (e->length > IOBUFSIZE) {
           *len = IOBUFSIZE;
       }
       else {
  -        *len = a->length;
  +        *len = e->length;
       }
   
       /* Handle offset ... */
  @@ -97,12 +98,12 @@
        * Change the current bucket to refer to what we read,
        * even if we read nothing because we hit EOF.
        */
  -    ap_bucket_make_heap(a, buf, *len, 0, NULL);  /* XXX: check for failure? */
  +    ap_bucket_make_heap(e, buf, *len, 0, NULL);  /* XXX: check for failure? */
   
       /* If we have more to read from the file, then create another bucket */
       if (*len > 0) {
  -        b = ap_bucket_create_file(f, 0, a->length);
  -	AP_BUCKET_INSERT_AFTER(a, b);
  +        b = ap_bucket_create_file(f, 0, e->length);
  +        AP_BUCKET_INSERT_AFTER(e, b);
       }
       return APR_SUCCESS;
   }
  @@ -110,10 +111,19 @@
   API_EXPORT(ap_bucket *) ap_bucket_make_file(ap_bucket *b, apr_file_t *fd,
                                               apr_off_t offset, apr_size_t len)
   {
  +    ap_bucket_file *f;
  +
  +    f = malloc(sizeof(*f));
  +    if (f == NULL) {
  +        return NULL;
  +    }
  + 
  +    f->fd = fd;
  +    f->offset = offset;
  +
       b->type = AP_BUCKET_FILE;
  -    b->data = fd;
  +    b->data = f;
       b->length = len;
  -    b->offset = offset;
       b->destroy = NULL;
       b->read = file_read;
       b->setaside = NULL;
  
  
  
  1.34      +12 -4     apache-2.0/src/include/ap_buckets.h
  
  Index: ap_buckets.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/ap_buckets.h,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ap_buckets.h	2000/10/10 22:12:20	1.33
  +++ ap_buckets.h	2000/10/12 18:01:29	1.34
  @@ -170,10 +170,6 @@
        */
       apr_off_t length;
   
  -    /** The file offset. Applicable for AP_BUCKET_FILE types only.
  -     */
  -    apr_off_t offset;
  -
       /** @tip all of these function pointers may be replaced by some
        *  other means for getting to the functions, like a an index into
        *  a table.  In any case, these functions will always be available.
  @@ -349,6 +345,18 @@
       ap_bucket_refcount  refcount;
       /** The mmap this sub_bucket refers to */
       apr_mmap_t *mmap;
  +};
  +
  +typedef struct ap_bucket_file ap_bucket_file;
  +
  +/**
  + * A bucket referring to an file
  + */
  +struct ap_bucket_file {
  +    /** The file this bucket refers to */
  +    apr_file_t *fd;
  +    /** The offset into the file */
  +    apr_off_t offset;
   };
   
   /*  *****  Bucket Brigade Functions  *****  */
  
  
  
  1.165     +3 -2      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.164
  retrieving revision 1.165
  diff -u -r1.164 -r1.165
  --- http_core.c	2000/10/12 16:35:39	1.164
  +++ http_core.c	2000/10/12 18:01:30	1.165
  @@ -3382,10 +3382,11 @@
                   break;
               }
               else if (e->type == AP_BUCKET_FILE) {
  +                ap_bucket_file *a = e->data;
                   /* Assume there is at most one AP_BUCKET_FILE in the brigade */
  -                fd = e->data;
  +                fd = a->fd;
                   flen = e->length;
  -                foffset = e->offset;
  +                foffset = a->offset;
               }
               else {
                   const char *str;
  
  
  

Mime
View raw message