Bug 1235383

Summary: mod_dav sends incomplete response body
Product: Red Hat Enterprise Linux 7 Reporter: Martin Frodl <mfrodl>
Component: httpdAssignee: Luboš Uhliarik <luhliari>
Status: CLOSED ERRATA QA Contact: Martin Frodl <mfrodl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: jkaluza, jorton
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: httpd-2.4.6-35.el7 Doc Type: Bug Fix
Doc Text:
Cause: mod_dav did not set the status line of the response. Consequence: Responses sent by mod_dav has been terminated right after the "<title>" tag in their body. Fix: Status line is set properly for mod_dav responses. Result: Responses are not terminated prematurely anymore.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 04:38:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch none

Description Martin Frodl 2015-06-24 16:28:53 UTC
Created attachment 1042789 [details]
Proposed patch

Description of problem:

When a file is uploaded to Apache server via mod_dav, the response body sent by server is incomplete.

Version-Release number of selected component (if applicable):
httpd-2.4.6-34.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
# cat > /etc/httpd/conf.d/dav.conf <<EOF
DavLockDB /tmp/davlock
<Directory /var/www/html/webdav>
    Dav On
</Directory>
EOF
# mkdir /var/www/html/webdav
# chown apache:apache /var/www/html/webdav
# setsebool httpd_unified on
# systemctl start httpd
# echo test | curl -v -T - http://localhost/webdav/newfile

Actual results:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>

Expected results:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /webdav/newfile has been created.</p>
</body></html>

Additional info:
This issue is not present in httpd 2.2 on RHEL 6, which made me wonder what makes the difference. It turns out that in httpd-2.2.15-45.el6.x86_64 there is an extra line in modules/dav/main/mod_dav.c, function dav_error_response(), with a funny comment:

317     /* ### I really don't think this is needed; gotta test */
318     r->status_line = ap_get_status_line(status);

When returning this line where it originally was, the server sends a full response body.

Comment 8 errata-xmlrpc 2015-11-19 04:38:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2194.html