Bug 64413 - Improve error message for dav_fs_open_stream
Summary: Improve error message for dav_fs_open_stream
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_dav (show other bugs)
Version: 2.5-HEAD
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-07 01:21 UTC by Bingyu Shen
Modified: 2020-09-15 09:14 UTC (History)
1 user (show)



Attachments
A patch to improve the error message for dav_fs_open_stream (1.39 KB, patch)
2020-05-07 01:43 UTC, Bingyu Shen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bingyu Shen 2020-05-07 01:21:06 UTC
When dav fs want to PUT new contents, it first tries to open resource for writing in dav_fs_open_stream(). It specifies two modes, DAV_MODE_WRITE_TRUNC, DAV_MODE_WRITE_SEEKABLE, and default mode which simply open with OS default permissions. However, the log for all three modes is the same. "An error occurred while opening a resource." 

This becomes misleading since it may fail for two reasons (1) In the default mode to open with OS default permissions, the file may not exist (2) in the two modes DAV_MODE_WRITE_XXXX , open for writing may fail because of file permissions.

Also, it is appreciated to specify the actual file path to be opened, since some Rewrite rules may be specified. The inconsistency between the real file path and URL in the log may remind sysadmin about this. [1]

Therefore, I think we can improve the log a bit by providing the file name and more detailed reasons for each failed case. 

Any thoughts are appreciated! 

[1]https://serverfault.com/questions/20169/webdav-on-centos-getting-403-error-when-attempt-to-upload
Comment 1 Bingyu Shen 2020-05-07 01:43:08 UTC
Created attachment 37219 [details]
A patch to improve the error message for dav_fs_open_stream
Comment 2 Joe Orton 2020-09-15 09:14:59 UTC
Thanks for the patch!  Merged in r1881736.