httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_negotiation.c
Date Thu, 26 Jul 2001 15:53:16 GMT
wrowe       01/07/26 08:53:16

  Modified:    include  http_protocol.h httpd.h scoreboard.h
               modules/http http_protocol.c
               modules/loggers mod_log_config.c
               modules/mappers mod_negotiation.c
  Log:
    Change the length of the content args to apr_off_t identifiers, and fix
    mod_negotation to treat a size of -1 and indeterminate, instead of 0.
  
  Revision  Changes    Path
  1.59      +2 -2      httpd-2.0/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- http_protocol.h	2001/02/27 21:02:15	1.58
  +++ http_protocol.h	2001/07/26 15:53:15	1.59
  @@ -413,9 +413,9 @@
    * @param bufsiz The size of the buffer
    * @return Number of bytes inserted into the buffer.  When done reading, 0
    *         if EOF, or -1 if there was an error
  - * @deffunc long ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
  + * @deffunc long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
    */
  -AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz);
  +AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
   
   /**
    * In HTTP/1.1, any method can have a body.  However, most GET handlers
  
  
  
  1.156     +4 -4      httpd-2.0/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
  retrieving revision 1.155
  retrieving revision 1.156
  diff -u -r1.155 -r1.156
  --- httpd.h	2001/07/25 22:38:21	1.155
  +++ httpd.h	2001/07/26 15:53:15	1.156
  @@ -686,9 +686,9 @@
       ap_method_list_t *allowed_methods; 
   
       /** byte count in stream is for body */
  -    int sent_bodyct;
  +    apr_off_t sent_bodyct;
       /** body byte count, for easy access */
  -    long bytes_sent;
  +    apr_off_t bytes_sent;
       /** Time the resource was last modified */
       apr_time_t mtime;
   
  @@ -704,9 +704,9 @@
       apr_off_t clength;
   
       /** bytes left to read */
  -    apr_size_t remaining;
  +    apr_off_t remaining;
       /** bytes that have been read */
  -    long read_length;
  +    apr_off_t read_length;
       /** how the request body should be read */
       int read_body;
       /** reading chunked transfer-coding */
  
  
  
  1.28      +3 -3      httpd-2.0/include/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/scoreboard.h,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- scoreboard.h	2001/07/18 21:14:21	1.27
  +++ scoreboard.h	2001/07/26 15:53:15	1.28
  @@ -148,10 +148,10 @@
   #endif
       unsigned char status;
       unsigned long access_count;
  -    unsigned long bytes_served;
  +    apr_off_t     bytes_served;
       unsigned long my_access_count;
  -    unsigned long my_bytes_served;
  -    unsigned long conn_bytes;
  +    apr_off_t     my_bytes_served;
  +    apr_off_t     conn_bytes;
       unsigned short conn_count;
       apr_time_t start_time;
       apr_time_t stop_time;
  
  
  
  1.333     +2 -2      httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.332
  retrieving revision 1.333
  diff -u -r1.332 -r1.333
  --- http_protocol.c	2001/07/24 20:38:01	1.332
  +++ http_protocol.c	2001/07/26 15:53:15	1.333
  @@ -558,7 +558,7 @@
               }
               else {
                   const char *c = str;
  -                while (c - str < length) {
  +                while (c < str + length) {
                       if (*c == APR_ASCII_LF)
                           c++;
                       else if (*c == APR_ASCII_CR && *(c + 1) == APR_ASCII_LF)
  @@ -1422,7 +1422,7 @@
    * hold a chunk-size line, including any extensions. For now, we'll leave
    * that to the caller, at least until we can come up with a better solution.
    */
  -AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
  +AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
   {
       apr_size_t len_read, total;
       apr_status_t rv;
  
  
  
  1.64      +1 -1      httpd-2.0/modules/loggers/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/mod_log_config.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- mod_log_config.c	2001/07/24 22:55:29	1.63
  +++ mod_log_config.c	2001/07/26 15:53:15	1.64
  @@ -381,7 +381,7 @@
           return "-";
       }
       else {
  -	return apr_ltoa(r->pool, r->bytes_sent);
  +	return apr_off_t_toa(r->pool, r->bytes_sent);
       }
   }
   
  
  
  
  1.60      +18 -17    httpd-2.0/modules/mappers/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_negotiation.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- mod_negotiation.c	2001/06/27 21:59:48	1.59
  +++ mod_negotiation.c	2001/07/26 15:53:15	1.60
  @@ -204,7 +204,7 @@
   
       /* Now some special values */
       float level;                /* Auxiliary to content-type... */
  -    long  bytes;                /* content length, if known */
  +    apr_off_t bytes;            /* content length, if known */
       int lang_index;             /* pre HTTP/1.1 language priority stuff */
       int is_pseudo_html;         /* text/html, *or* the INCLUDES_MAGIC_TYPEs */
   
  @@ -266,7 +266,7 @@
       mime_info->is_pseudo_html = 0;
       mime_info->level = 0.0f;
       mime_info->level_matched = 0.0f;
  -    mime_info->bytes = 0;
  +    mime_info->bytes = -1;
       mime_info->lang_index = -1;
       mime_info->mime_stars = 0;
       mime_info->definite = 1;
  @@ -1451,23 +1451,24 @@
   
   /* Determining the content length --- if the map didn't tell us,
    * we have to do a stat() and remember for next time.
  - *
  - * Grump.  For Apache, even the first stat here may well be
  - * redundant (for multiviews) with a stat() done by the sub_req
  - * machinery.  At some point, that ought to be fixed.
    */
   
  -static long find_content_length(negotiation_state *neg, var_rec *variant)
  +static apr_off_t find_content_length(negotiation_state *neg, var_rec *variant)
   {
       apr_finfo_t statb;
   
  -    if (variant->bytes == 0) {
  -        char *fullname = ap_make_full_path(neg->pool, neg->dir_name,
  -                                           variant->file_name);
  -
  -        if (apr_stat(&statb, fullname,
  -                     APR_FINFO_SIZE, neg->pool) == APR_SUCCESS) {
  -            variant->bytes = statb.size;
  +    if (variant->bytes < 0) {
  +        if (variant->sub_req && (variant->sub_req->finfo.valid & APR_FINFO_SIZE))
{
  +            variant->bytes = variant->sub_req->finfo.size;
  +        }
  +        else {
  +            char *fullname = ap_make_full_path(neg->pool, neg->dir_name,
  +                                               variant->file_name);
  +
  +            if (apr_stat(&statb, fullname,
  +                         APR_FINFO_SIZE, neg->pool) == APR_SUCCESS) {
  +                variant->bytes = statb.size;
  +            }
           }
       }
   
  @@ -2060,7 +2061,7 @@
       char *lang;
       char *qstr;
       char *lenstr;
  -    long len;
  +    apr_off_t len;
       apr_array_header_t *arr;
       int max_vlist_array = (neg->avail_vars->nelts * 21);
       int first_variant = 1;
  @@ -2193,10 +2194,10 @@
            * content-length, which currently leads to the correct result).
            */
           if (!(variant->sub_req && variant->sub_req->handler)
  -            && (len = find_content_length(neg, variant)) != 0) {
  +            && (len = find_content_length(neg, variant)) >= 0) {
   
               lenstr = (char *) apr_palloc(r->pool, 22);
  -            apr_snprintf(lenstr, 22, "%ld", len);
  +            apr_snprintf(lenstr, 22, "%" APR_OFF_T_FMT, len);
               *((const char **) apr_array_push(arr)) = " {length ";
               *((const char **) apr_array_push(arr)) = lenstr;
               *((const char **) apr_array_push(arr)) = "}";
  
  
  

Mime
View raw message