ASF Bugzilla – Attachment 7641 Details for
Bug 22104
mod_deflate does not change Content-Length, breaks DAV file upload via PUT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to make mod_dav use bucket brigades when handling PUT requests
mod_dav_put_brigade.diff (text/plain), 2.98 KB, created by
Tim Robbins
on 2003-08-04 13:22:16 UTC
(
hide
)
Description:
Patch to make mod_dav use bucket brigades when handling PUT requests
Filename:
MIME Type:
Creator:
Tim Robbins
Created:
2003-08-04 13:22:16 UTC
Size:
2.98 KB
patch
obsolete
>--- mod_dav.c.old Mon Aug 4 21:35:02 2003 >+++ mod_dav.c Mon Aug 4 23:16:48 2003 >@@ -982,41 +982,49 @@ > } > > if (err == NULL) { >- if (ap_should_client_block(r)) { >- char *buffer = apr_palloc(r->pool, DAV_READ_BLOCKSIZE); >- long len; >+ apr_status_t rv; >+ apr_bucket_brigade *bb; >+ apr_bucket *b; >+ const char *buf; >+ apr_ssize_t len; > >+ bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); >+ if (bb == NULL) { >+ err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, >+ "Could not create brigade."); >+ goto done; >+ } >+ for (;;) { >+ rv = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES, >+ APR_BLOCK_READ, DAV_READ_BLOCKSIZE); >+ if (rv != APR_SUCCESS) { >+ err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, >+ "Could not get brigade."); >+ goto done; >+ } > /* > * Once we start reading the request, then we must read the > * whole darn thing. ap_discard_request_body() won't do anything > * for a partially-read request. > */ >- >- while ((len = ap_get_client_block(r, buffer, >- DAV_READ_BLOCKSIZE)) > 0) { >- if (err == NULL) { >- /* write whatever we read, until we see an error */ >- err = (*resource->hooks->write_stream)(stream, >- buffer, len); >- } >- } >- >- /* >- * ### what happens if we read more/less than the amount >- * ### specified in the Content-Range? eek... >- */ >- >- if (len == -1) { >- /* >- * Error reading request body. This has precedence over >- * prior errors. >- */ >- err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, >- "An error occurred while reading the " >- "request body."); >- } >+ APR_BRIGADE_FOREACH(b, bb) { >+ if (APR_BUCKET_IS_EOS(b)) >+ goto done; >+ if ((rv = apr_bucket_read(b, (const char **)&buf, &len, >+ APR_BLOCK_READ)) != APR_SUCCESS && >+ err == NULL) >+ err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0, >+ "An error occurred while reading the " >+ "request body."); >+ if (err == NULL) >+ /* write whatever we read, until we see an error */ >+ err = (*resource->hooks->write_stream)(stream, >+ buf, len); >+ } > } >- >+done: >+ if (bb != NULL) >+ apr_brigade_destroy(bb); > err2 = (*resource->hooks->close_stream)(stream, > err == NULL /* commit */); > if (err2 != NULL && err == NULL) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 22104
: 7641 |
7642
|
7643