Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: CVS

svn commit: r834062 - in /httpd/httpd/trunk: CHANGES modules/dav/fs/repos.c

 

 

Apache cvs RSS feed   Index | Next | Previous | View Threaded


sf at apache

Nov 9, 2009, 5:50 AM

Post #1 of 1 (130 views)
Permalink
svn commit: r834062 - in /httpd/httpd/trunk: CHANGES modules/dav/fs/repos.c

Author: sf
Date: Mon Nov 9 13:50:21 2009
New Revision: 834062

URL: http://svn.apache.org/viewvc?rev=834062&view=rev
Log:
Don't delete the whole file if a PUT with content-range failed.

PR: 42896

Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/modules/dav/fs/repos.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=834062&r1=834061&r2=834062&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Nov 9 13:50:21 2009
@@ -10,6 +10,9 @@
mod_proxy_ftp: NULL pointer dereference on error paths.
[Stefan Fritsch <sf fritsch.de>, Joe Orton]

+ *) mod_dav_fs: Don't delete the whole file if a PUT with content-range failed.
+ PR 42896. [Stefan Fritsch]
+
*) mod_dav_fs: Make PUT create files atomically and no longer destroy the
old file if the transfer aborted. PR 39815. [Paul Querna, Stefan Fritsch]


Modified: httpd/httpd/trunk/modules/dav/fs/repos.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/repos.c?rev=834062&r1=834061&r2=834062&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/repos.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/repos.c Mon Nov 9 13:50:21 2009
@@ -198,6 +198,7 @@
apr_file_t *f;
const char *pathname; /* we may need to remove it at close time */
const char *temppath;
+ int unlink_on_error;
};

/* returns an appropriate HTTP status code given an APR status code for a
@@ -891,6 +892,7 @@
ds->p = p;
ds->pathname = resource->info->pathname;
ds->temppath = NULL;
+ ds->unlink_on_error = 0;

if (mode == DAV_MODE_WRITE_TRUNC) {
ds->temppath = apr_pstrcat(p, ap_make_dirstr_parent(p, ds->pathname),
@@ -899,6 +901,18 @@
apr_pool_cleanup_register(p, ds, tmpfile_cleanup,
apr_pool_cleanup_null);
}
+ else if (mode == DAV_MODE_WRITE_SEEKABLE) {
+ rv = apr_file_open(&ds->f, ds->pathname, flags | APR_FOPEN_EXCL,
+ APR_OS_DEFAULT, ds->p);
+ if (rv == APR_SUCCESS) {
+ /* we have created a new file */
+ ds->unlink_on_error = 1;
+ }
+ else if (APR_STATUS_IS_EEXIST(rv)) {
+ rv = apr_file_open(&ds->f, ds->pathname, flags, APR_OS_DEFAULT,
+ ds->p);
+ }
+ }
else {
rv = apr_file_open(&ds->f, ds->pathname, flags, APR_OS_DEFAULT, ds->p);
}
@@ -924,7 +938,7 @@
if (stream->temppath) {
apr_pool_cleanup_run(stream->p, stream, tmpfile_cleanup);
}
- else {
+ else if (stream->unlink_on_error) {
if (apr_file_remove(stream->pathname, stream->p) != APR_SUCCESS) {
/* ### use a better description? */
return dav_new_error(stream->p, HTTP_INTERNAL_SERVER_ERROR, 0,

Apache cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.