MantisBT - CMake
View Issue Details
0009262CMakeCMakepublic2009-07-12 13:182016-06-10 14:30
Eric NOULARD 
Bill Hoffman 
normalminoralways
closedmoved 
CMake-2-6 
 
0009262: FILE(DOWNLOAD ) creates file containing HTTP error
When using FILE(DOWNLOAD
the error handling behavior is a bit strange.

1) If you get "HTTP 404 Not Found" the
   STATUS is 0 --> no error

2) When the command fails with "HTTP 404 Not Found"
   the target file is created and contains
   the HTML error page.

I you want to catch this you have to MATCHES "404 Not Found"
in the LOG.

The attached cmake scripts (may be launched with cmake -P)
show how I did it.
Just change the url to a "Not Found" file and see how it behaves.

I'd rather want FILE(DOWNLOAD to report HTTP ERROR has error
and avoid to match the LOG myself.

Has the current behavior has been designed on purpose?
No tags attached.
related to 0008903closed Zach Mullen CTest does not check if CDash submission is successful 
? getMscStyle.cmake (1,066) 2009-07-12 13:18
https://public.kitware.com/Bug/file/2363/getMscStyle.cmake
Issue History
2009-07-12 13:18Eric NOULARDNew Issue
2009-07-12 13:18Eric NOULARDFile Added: getMscStyle.cmake
2009-09-14 12:26Bill HoffmanNote Added: 0017431
2009-09-14 12:26Bill HoffmanStatusnew => assigned
2009-09-14 12:26Bill HoffmanAssigned To => Bill Hoffman
2009-09-14 13:27Eric NOULARDNote Added: 0017448
2011-02-03 18:51David ColeRelationship addedrelated to 0008903
2016-06-10 14:27Kitware RobotNote Added: 0041578
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0017431)
Bill Hoffman   
2009-09-14 12:26   
Well, it is not really an http error, the web server gave a page pack, it was a page not here page, but it was a page. I don't think curl can tell the difference, and I don't want to parse in cmake, I think...
(0017448)
Eric NOULARD   
2009-09-14 13:27   
Hi Bill,

Agreed you really don't want to parse it in cmake.

However, I think libcurl may tell you that it received an http error > 400
if you CURLOPT_FAILONERROR curl option is set to true.

If you did set this option to true then CURL will return you
CURLE_HTTP_RETURNED_ERROR (22)
when an HTTP ERROR is encountered.

This should be a similar problem reported on this bug:
http://public.kitware.com/Bug/view.php?id=8903 [^]

for which I suggested a similar solution :-)

Since it works for CTest I bet it should work for "FILE(DOWNLOAD" too.
(0041578)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.