httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_include.c
Date Fri, 22 Aug 2003 21:16:14 GMT
nd          2003/08/22 14:16:14

  Modified:    modules/filters mod_include.c
  Log:
  cleanup handle_flastmod function
  
  Revision  Changes    Path
  1.245     +48 -30    httpd-2.0/modules/filters/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
  retrieving revision 1.244
  retrieving revision 1.245
  diff -u -r1.244 -r1.245
  --- mod_include.c	22 Aug 2003 07:40:48 -0000	1.244
  +++ mod_include.c	22 Aug 2003 21:16:14 -0000	1.245
  @@ -2054,41 +2054,59 @@
       return APR_SUCCESS;
   }
   
  +/*
  + * <!--#flastmod virtual|file="..." [virtual|file="..."] ... -->
  + */
   static apr_status_t handle_flastmod(include_ctx_t *ctx, ap_filter_t *f,
                                       apr_bucket_brigade *bb)
   {
  -    char *tag     = NULL;
  -    char *tag_val = NULL;
  -    apr_finfo_t  finfo;
  -    apr_size_t  t_len;
  -    apr_bucket   *tmp_buck;
  -    char *parsed_string;
       request_rec *r = f->r;
   
  -    if (ctx->flags & SSI_FLAG_PRINTING) {
  -        while (1) {
  -            ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, SSI_VALUE_DECODED);
  -            if (!tag || !tag_val) {
  -                return APR_SUCCESS;
  -            }
  -            else {
  -                parsed_string = ap_ssi_parse_string(r, ctx, tag_val, NULL, 
  -                                                    MAX_STRING_LEN,
  -                                                    SSI_EXPAND_DROP_NAME);
  -                if (!find_file(r, "flastmod", tag, parsed_string, &finfo)) {
  -                    char *t_val;
  -
  -                    t_val = ap_ht_time(r->pool, finfo.mtime, ctx->time_str, 0);
  -                    t_len = strlen(t_val);
  -
  -                    tmp_buck = apr_bucket_pool_create(t_val, t_len, r->pool,
  -                                                  r->connection->bucket_alloc);
  -                    APR_BRIGADE_INSERT_TAIL(bb, tmp_buck);
  -                }
  -                else {
  -                    SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
  -                }
  -            }
  +    if (!ctx->argc) {
  +        ap_log_rerror(APLOG_MARK,
  +                      (ctx->flags & SSI_FLAG_PRINTING)
  +                          ? APLOG_ERR : APLOG_WARNING,
  +                      0, r, "missing argument for flastmod element in %s",
  +                      r->filename);
  +    }
  +
  +    if (!(ctx->flags & SSI_FLAG_PRINTING)) {
  +        return APR_SUCCESS;
  +    }
  +
  +    if (!ctx->argc) {
  +        SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
  +        return APR_SUCCESS;
  +    }
  +
  +    while (1) {
  +        char *tag     = NULL;
  +        char *tag_val = NULL;
  +        apr_finfo_t  finfo;
  +        char *parsed_string;
  +
  +        ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, SSI_VALUE_DECODED);
  +        if (!tag || !tag_val) {
  +            break;
  +        }
  +
  +        parsed_string = ap_ssi_parse_string(r, ctx, tag_val, NULL,
  +                                            MAX_STRING_LEN,
  +                                            SSI_EXPAND_DROP_NAME);
  +
  +        if (!find_file(r, "flastmod", tag, parsed_string, &finfo)) {
  +            char *t_val;
  +            apr_size_t t_len;
  +
  +            t_val = ap_ht_time(ctx->pool, finfo.mtime, ctx->time_str, 0);
  +            t_len = strlen(t_val);
  +
  +            APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_pool_create(t_val, t_len,
  +                                    ctx->pool, f->c->bucket_alloc));
  +        }
  +        else {
  +            SSI_CREATE_ERROR_BUCKET(ctx, f, bb);
  +            break;
           }
       }
   
  
  
  

Mime
View raw message