MantisBT - CMake
View Issue Details
0015774CMakeCTestpublic2015-10-07 17:492016-03-07 09:12
Derek Bruening 
Brad King 
lowblockalways
closedfixed 
AllAll
CMake 3.3.1 
CMake 3.4CMake 3.4 
0015774: CTest result submission over http fails to set Content-Type header which runs afoul of ModSecurity rules
On some web hosting providers, ModSecurity rules are in place that prevent using CTest with a CDash installation on that provider. The particular rule looks like this (pieces removed for anonymity):

ModSecurity: Access denied with code 406 (phase 2). Match of "rx ^0$" against "REQUEST_HEADERS:Content-Length" required. [msg "Request Containing Content, but Missing Content-Type header"] [uri "/CDash/submit.php"]

CTest runs show this error:

Submit files (using http)
   Using HTTP submit method
   Drop site:http://<mysite>/CDash/submit.php?project=<myproject> [^]
   Error when uploading file: <mypath>/Testing/20151005-0900/Build.xml
   Error message was: The requested URL returned error: 406 Not Acceptable
   Problems when submitting via HTTP

The same 406 error is seen using curl -T:

# curl -T <mypath>/Testing/20151007-0900/Build.xml http://<mysite>/CDash/submit.php?project=<myproject> [^]
<head><title>Not Acceptable!</title></head><body><h1>Not Acceptable!</h1>

An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.

</body></html>

These hosting providers do not allow any method of disabling particular rules or ModSecurity in general.

While we can debate the merits of this rule, it is simple to work around by providing a Content-Type header. E.g., curl -d works:

# curl -d @<mypath>/Testing/20151007-0900/Build.xml http://<mysite>/CDash/submit.php?project=<myproject> [^]
<cdash version="2.2.2">
  <status>OK</status>
  <message></message>
  <md5>...</md5>
</cdash>
No tags attached.
Issue History
2015-10-07 17:49Derek BrueningNew Issue
2015-10-08 11:00Brad KingNote Added: 0039540
2015-10-08 11:00Brad KingAssigned To => Brad King
2015-10-08 11:00Brad KingStatusnew => resolved
2015-10-08 11:00Brad KingResolutionopen => fixed
2015-10-08 11:00Brad KingFixed in Version => CMake 3.5
2015-10-08 11:00Brad KingTarget Version => CMake 3.5
2015-10-12 10:17Brad KingNote Edited: 0039540bug_revision_view_page.php?bugnote_id=39540#r1928
2015-10-12 10:33Brad KingNote Added: 0039572
2015-10-12 10:33Brad KingFixed in VersionCMake 3.5 => CMake 3.4
2015-10-12 10:33Brad KingTarget VersionCMake 3.5 => CMake 3.4
2016-03-07 09:12Robert MaynardNote Added: 0040611
2016-03-07 09:12Robert MaynardStatusresolved => closed

Notes
(0039540)
Brad King   
2015-10-08 11:00   
(edited on: 2015-10-12 10:17)
Fixed using your patch on the dev list:

 CTest: Set Content-Type header for http file upload
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a6e0b61 [^]

Thanks!

(0039572)
Brad King   
2015-10-12 10:33   
I merged this to 'release' to include in 3.4.0-rc2.
(0040611)
Robert Maynard   
2016-03-07 09:12   
Closing resolved issues that have not been updated in more than 4 months.