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/dav/main mod_dav.c
Date Wed, 06 Aug 2003 21:38:58 GMT
nd          2003/08/06 14:38:58

  Modified:    modules/dav/main mod_dav.c
  Log:
  drop the test, whether apr_brigade_create returns NULL. It does never
  (dumps core instead :-)
  
  Submitted by: Cliff Woolley
  
  Revision  Changes    Path
  1.99      +34 -41    httpd-2.0/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- mod_dav.c	6 Aug 2003 14:46:48 -0000	1.98
  +++ mod_dav.c	6 Aug 2003 21:38:58 -0000	1.99
  @@ -985,56 +985,49 @@
   
           bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
   
  -        if (!bb) {
  -            err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
  -                                "Could not create bucket brigade");
  -        }
  -        else {
  -            do {
  -                apr_status_t rc;
  +        do {
  +            apr_status_t rc;
   
  -                rc = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
  -                                    APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
  +            rc = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
  +                                APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
   
  +            if (rc != APR_SUCCESS) {
  +                err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
  +                                    "Could not get next bucket brigade");
  +                break;
  +            }
  +
  +            APR_BRIGADE_FOREACH(b, bb) {
  +                const char *data;
  +                apr_size_t len;
  +
  +                if (APR_BUCKET_IS_EOS(b)) {
  +                    seen_eos = 1;
  +                    break;
  +                }
  +
  +                if (APR_BUCKET_IS_METADATA(b)) {
  +                    continue;
  +                }
  +
  +                rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
                   if (rc != APR_SUCCESS) {
  -                    err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
  -                                        "Could not get next bucket brigade");
  +                    err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
  +                                        "An error occurred while reading "
  +                                        "the request body.");
                       break;
                   }
   
  -                APR_BRIGADE_FOREACH(b, bb) {
  -                    const char *data;
  -                    apr_size_t len;
  -
  -                    if (APR_BUCKET_IS_EOS(b)) {
  -                        seen_eos = 1;
  -                        break;
  -                    }
  -
  -                    if (APR_BUCKET_IS_METADATA(b)) {
  -                        continue;
  -                    }
  -
  -                    rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
  -                    if (rc != APR_SUCCESS) {
  -                        err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
  -                                            "An error occurred while reading "
  -                                            "the request body.");
  -                        break;
  -                    }
  -
  -                    if (err == NULL) {
  -                        /* write whatever we read, until we see an error */
  -                        err = (*resource->hooks->write_stream)(stream, data,
  -                                                               len);
  -                    }
  +                if (err == NULL) {
  +                    /* write whatever we read, until we see an error */
  +                    err = (*resource->hooks->write_stream)(stream, data, len);
                   }
  +            }
   
  -                apr_brigade_cleanup(bb);
  -            } while (!seen_eos);
  +            apr_brigade_cleanup(bb);
  +        } while (!seen_eos);
   
  -            apr_brigade_destroy(bb);
  -        }
  +        apr_brigade_destroy(bb);
   
           err2 = (*resource->hooks->close_stream)(stream,
                                                   err == NULL /* commit */);
  
  
  

Mime
View raw message