<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Verdana;
        color:gray;
        font-weight:bold;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><b><font size=2 color=gray face=Verdana><span
style='font-size:10.0pt;font-family:Verdana;color:gray;font-weight:bold'>I don’t
know what options are compiled in for CMake, but it looks like this is the libcurl
option required to follow redirects:<o:p></o:p></span></font></b></p>
<p class=MsoNormal><b><font size=2 color=gray face=Verdana><span
style='font-size:10.0pt;font-family:Verdana;color:gray;font-weight:bold'><o:p> </o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'>CURLOPT_FOLLOWLOCATION <o:p></o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'><o:p> </o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'>A parameter set to 1 tells the library to follow any
Location: header that the server sends as part of an HTTP header. <o:p></o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'><o:p> </o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'>This means that the library will re-send the same request on
the new location and follow new Location: headers all the way until no more
such headers are returned. CURLOPT_MAXREDIRS can be used to limit the number of
redirects libcurl will follow. <o:p></o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'><o:p> </o:p></span></font></b></p>
<p class=MsoNormal style='margin-left:.5in'><b><font size=2 color=gray
face=Verdana><span style='font-size:10.0pt;font-family:Verdana;color:gray;
font-weight:bold'>Since 7.19.4, libcurl can limit what protocols it will
automatically follow. The accepted protocols are set with
CURLOPT_REDIR_PROTOCOLS and it excludes the FILE protocol by default.<o:p></o:p></span></font></b></p>
<p class=MsoNormal><b><font size=2 color=gray face=Verdana><span
style='font-size:10.0pt;font-family:Verdana;color:gray;font-weight:bold'><o:p> </o:p></span></font></b></p>
<div>
<div style='border:none;border-top:dotted silver 1.0pt;padding:4.0pt 0in 0in 0in'>
<p class=MsoNormal><b><font size=1 color="#666666" face=Arial><span
style='font-size:9.0pt;font-family:Arial;color:#666666;font-weight:bold'>Aaron
C. Meadows</span></span></font></b><font size=1 color="#666666" face=Arial><span
style='font-size:9.0pt;font-family:Arial;color:#666666'> </span></font><font
size=1 color="#666666" face=Arial><span style='font-size:9.0pt;font-family:
Arial;color:#666666'><o:p></o:p></span></font></p>
</div>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
cmake-bounces@cmake.org [mailto:cmake-bounces@cmake.org] <b><span
style='font-weight:bold'>On Behalf Of </span></b>David Cole<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, June 04, 2010 9:47
AM<br>
<b><span style='font-weight:bold'>To:</span></b> Michael Wild<br>
<b><span style='font-weight:bold'>Cc:</span></b> CMake List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [CMake]
file(DOWNLOAD) and HTTP 302 (redirect)</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Fri, Jun 4, 2010 at 8:03 AM, Michael Wild <<a
href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>> wrote:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>The log looks like this (I've put a message("log = ${log}")
into ExternalProject.cmake to get this, since the numeric error code is 0):<br>
<br>
<snip><br>
-- downloading...<br>
src='<a
href="http://downloads.sourceforge.net/project/freefoam/ThirdParty/zlib/zlib-1.2.5.tar.gz"
target="_blank">http://downloads.sourceforge.net/project/freefoam/ThirdParty/zlib/zlib-1.2.5.tar.gz</a>'<br>
dst='/Users/mwild/Projects/FreeFOAM/build-pu/ThirdParty/zlib/src/zlib-1.2.5.tar.gz'<br>
timeout='none'<br>
log = About to connect() to <a href="http://downloads.sourceforge.net"
target="_blank">downloads.sourceforge.net</a> port 80 (#0)<br>
Trying 216.34.181.59... connected<br>
Connected to <a href="http://downloads.sourceforge.net" target="_blank">downloads.sourceforge.net</a>
(216.34.181.59) port 80 (#0)<br>
GET /project/freefoam/ThirdParty/zlib/zlib-1.2.5.tar.gz HTTP/1.1<br>
Host: <a href="http://downloads.sourceforge.net" target="_blank">downloads.sourceforge.net</a><br>
Accept: */*<br>
<br>
HTTP/1.1 302 Found<br>
X-Powered-By: PHP/5.2.9<br>
Content-Disposition: attachment; filename="zlib-1.2.5.tar.gz"<br>
Location: <a
href="http://surfnet.dl.sourceforge.net/project/freefoam/ThirdParty/zlib/zlib-1.2.5.tar.gz%0d%0aContent-type"
target="_blank">http://surfnet.dl.sourceforge.net/project/freefoam/ThirdParty/zlib/zlib-1.2.5.tar.gz<br>
Content-type</a>: text/html<br>
Content-Length: 0<br>
Date: Fri, 04 Jun 2010 07:52:13 GMT<br>
Server: lighttpd/1.4.26<br>
<br>
Connection #0 to host <a href="http://downloads.sourceforge.net" target="_blank">downloads.sourceforge.net</a>
left intact<br>
Closing connection #0<br>
<br>
-- downloading... done<br>
</snip><br>
<br>
So you see, CMake really thinks this succeeded.<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hmm. I wonder if there's some sort of curl option we should be passing
to get redirects to work automatically...?<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
I really am looking forward to the EXPECTED_MD5 feature, please also make it
available through ExternalProject_Add! Currently I'm doing this manually via an
additional step, but it's awfully fragile...<o:p></o:p></span></font></p>
</blockquote>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>It is. That was actually the main motivation for the additional
file(DOWNLOAD arg... In CMake 'next' there's a URL_MD5 arg to
ExternalProject_Add now.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'><br>
Michael</span></font><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
On 4. Jun, 2010, at 13:57 , David Cole wrote:<br>
<br>
> I'm pretty sure the original intent was for file(DOWNLOAD ...) to not
raise<br>
> errors so that scripts can analyze status and log and decide what to do
next<br>
> rather than forcing a CMake error...<br>
><br>
> I recently added EXPECTED_MD5 to file(DOWNLOAD in the 'next' branch of<br>
> CMake. If a download fails when there's an expected MD5 sum given, then it<br>
> *does* raise an error. Perhaps you'll find that useful in the next<br>
> release...<br>
><br>
> Cheers,<br>
> David C.<br>
><br>
><br>
> On Fri, Jun 4, 2010 at 7:55 AM, David Cole <<a
href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
><br>
>> What if you do something this...? What do status and log tell you?<br>
>><br>
>> set(remote "http://......")<br>
>> set(local "some file name")<br>
>><br>
>> file(DOWNLOAD<br>
>><br>
>> "${remote}"<br>
>><br>
>> "${local}"<br>
>><br>
>> STATUS status<br>
>><br>
>> LOG log)<br>
>><br>
>><br>
>> list(GET status 0 status_code)<br>
>><br>
>> list(GET status 1 status_string)<br>
>><br>
>><br>
>> if(NOT status_code EQUAL 0)<br>
>><br>
>> message(FATAL_ERROR "error: downloading '${remote}' failed<br>
>><br>
>> status_code: ${status_code}<br>
>><br>
>> status_string: ${status_string}<br>
>><br>
>> log: ${log}<br>
>><br>
>> ")<br>
>><br>
>> endif()<br>
>><br>
>><br>
>><br>
>> On Fri, Jun 4, 2010 at 4:00 AM, Michael Wild <<a
href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>> wrote:<br>
>><br>
>>> When downloading something from <a
href="http://downloads.sourceforge.net/" target="_blank">http://downloads.sourceforge.net/.</a>..
you<br>
>>> always get a 302 redirect to one of the many mirror servers.
Unfortunately,<br>
>>> it seems that file(DOWNLOAD ...) doesn't follow the redirect, but
just stops<br>
>>> and leaves an empty file behind. No error, no nothing. Is this
intentional?<br>
>>><br>
>>> I'd rather not use a specific mirror...<br>
>>><br>
>>> Michael<br>
>>> _______________________________________________<br>
>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>><br>
>>> Visit other Kitware open-source projects at<br>
>>> <a href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>><br>
>>> Please keep messages on-topic and check the CMake FAQ at:<br>
>>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>>><br>
>>> Follow this link to subscribe/unsubscribe:<br>
>>> <a href="http://www.cmake.org/mailman/listinfo/cmake"
target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
>>><br>
>><br>
>><o:p></o:p></span></font></p>
</div>
</div>
</blockquote>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<br clear=all> This email was sent to you by Thomson Reuters, the global news and information company.<br>
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
</body>
</html>