<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
  <title>aC forum: File Download problems over SSL</title>
  <link>http://www.activecollab.com/forums/topic/903/</link>
  <description>Recent posts on topic: File Download problems over SSL</description>
  <dc:language>en-us</dc:language>
  <pubDate>Thu, 24 May 2012 09:47:59 CDT</pubDate>
  
  <item>
    <link>http://www.activecollab.com/forums/post/9806/#post9806</link>
    <guid>http://www.activecollab.com/forums/post/9806/#post9806</guid>
    <title>Post #6 by [user deleted]</title>
    <dc:creator>[user deleted]</dc:creator>
    <description><![CDATA[<p>Does this fix only work for IIS? I am having the same problem on Apache2 and deparately need to fix it!<br />
<br />
Regards<br />
<br />
Andrew</p>]]></description>
    <pubDate>Thu, 11 Oct 2007 13:42:32 CDT</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/4091/#post4091</link>
    <guid>http://www.activecollab.com/forums/post/4091/#post4091</guid>
    <title>Post #5 by [user deleted]</title>
    <dc:creator>[user deleted]</dc:creator>
    <description><![CDATA[<p><div class="postQuote"><blockquote><div class="quoteAuthor">mcvogt:</div>svalarino, Could you share with us the steps for installing ActiveCollab in an IIS, SSL environment?</blockquote></div><br />
How far long are you? Assuming that you have installed PHP on IIS(6) and installed the SSL on your activeCollab website then it's a simple matter of changing:<br />
<br />
define('ROOT_URL', 'http://YourActiveCollabURL') <br />
<br />
to <br />
<br />
define('ROOT_URL', 'https://YourActiveCollabURL') <br />
<br />
in ..\activeCollab\config\config.php<br />
<br />
activeCollab will redirect every page after the login to the ROOT_URL, whether you start your login at https:// or http:// is up to you. I have not checked the PHP code but I believe the POST on pressing login will be submitted over https://  If you want to be absouletly secured force your users to start at https:// or make that link from your main domain.<br />
<br />
Hope that helps,</p>]]></description>
    <pubDate>Fri, 20 Oct 2006 21:52:56 CDT</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/4090/#post4090</link>
    <guid>http://www.activecollab.com/forums/post/4090/#post4090</guid>
    <title>Post #4 by [user deleted]</title>
    <dc:creator>[user deleted]</dc:creator>
    <description><![CDATA[<p><div class="postQuote"><blockquote><div class="quoteAuthor">Ilija Studen:</div>To update headers check out download_contents() function (in environment/functions/files.php). Report back if you find a solution.<br />
<br />
Thanks</blockquote></div><br />
Success! Thanks for pointing me in the right direction Ilija. Here is the hack:<br />
<br />
----------------------------------------------------------------------------------<br />
/** HACK SAVR 10/20/06 force file download over SSL for IE<br />
  * Was: <br />
  * function download_contents($content, $type, $name, $size, $force_download = false) {<br />
  */ <br />
  function download_contents($content, $type, $name, $size, $force_download = true) {<br />
    if(connection_status() != 0) return false; // check connection<br />
    <br />
    if($force_download) {<br />
  <br />
      /** HACK SAVR 10/20/06 <br />
      * Was: <br />
      * header(&quot;Cache-Control: public&quot;);<br />
      */ <br />
      header(&quot;Cache-Control: public, must-revalidate&quot;);<br />
      header(&quot;Pragma: hack&quot;);<br />
<br />
    } else {<br />
      header(&quot;Cache-Control: no-store, no-cache, must-revalidate&quot;);<br />
      header(&quot;Cache-Control: post-check=0, pre-check=0&quot;, false);<br />
      header(&quot;Pragma: no-cache&quot;);<br />
    } // if<br />
    header(&quot;Expires: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;, mktime(date(&quot;H&quot;) + 2, date(&quot;i&quot;), date(&quot;s&quot;), date(&quot;m&quot;), date(&quot;d&quot;), date(&quot;Y&quot;))) . &quot; GMT&quot;);<br />
    header(&quot;Last-Modified: &quot; . gmdate(&quot;D, d M Y H:i:s&quot;) . &quot; GMT&quot;);<br />
    header(&quot;Content-Type: $type&quot;);<br />
    header(&quot;Content-Length: &quot; . (string) $size);<br />
    <br />
    // Prepare disposition<br />
    $disposition = $force_download ? 'attachment' : 'inline';<br />
    header(&quot;Content-Disposition: $disposition; filename=\&quot;&quot; . $name) . &quot;\&quot;&quot;;<br />
    header(&quot;Content-Transfer-Encoding: binary&quot;);<br />
    print $content;<br />
    <br />
    return((connection_status() == 0) &amp;&amp; !connection_aborted());   <br />
  } // download_contents<br />
-----------------------------------------------------------------------------------<br />
<br />
Here is the http header it produces which lets IE cache encrypted content and thus allows activeCollab to donwload files over an SSL.<br />
<br />
-------------------------------------------------------------------------------<br />
HTTP/1.1 200 OK<br />
Connection: close<br />
Date: Sat, 21 Oct 2006 02:14:01 GMT<br />
Server: Microsoft-IIS/6.0<br />
X-Powered-By: PHP/5.1.6<br />
Set-Cookie: id=1; expires=Sat, 21-Oct-2006 03:14:01 GMT; path=/<br />
Set-Cookie: token=73b986c1869a50ba0bce6350209126a84db0838f; expires=Sat, 21-Oct-2006 03:14:01 GMT; path=/<br />
Set-Cookie: remember=deleted; expires=Fri, 21-Oct-2005 02:14:00 GMT; path=/<br />
Cache-Control: public, must-revalidate<br />
Pragma: hack<br />
Expires: Sat, 21 Oct 2006 04:14:01 GMT<br />
Last-Modified: Sat, 21 Oct 2006 02:14:01 GMT<br />
Content-Type: image/tiff<br />
Content-Length: 645344<br />
Content-Disposition: attachment; filename=&quot;CyberLogoVert.tif<br />
Content-Transfer-Encoding: binary<br />
----------------------------------------------------------------------------------<br />
<br />
Notice the &quot;Pragma: hack&quot;  That is necessary because PHP automatically set &quot;Pragma: no-cache&quot; and there is no way to override that in any of the PHP settings.<br />
<br />
Here is where that hack came from http://us3.php.net/header look for the comment from Nick Sterling.<br />
<br />
I am not sure how the calling modules would &quot;$force_download = true&quot; but it's obvious you default it to false.<br />
<br />
BTW, great project. I'm a .NET guy and up to now I have been dismissive of PHP. I think activeCollab will motivate me to SVN a download and give PHP a try! (Love the Angie framework idea!)<br />
<br />
Greetings,<br />
<br />
Sri Alexander Valarino</p>]]></description>
    <pubDate>Fri, 20 Oct 2006 21:42:25 CDT</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/4085/#post4085</link>
    <guid>http://www.activecollab.com/forums/post/4085/#post4085</guid>
    <title>Post #3 by [user deleted]</title>
    <dc:creator>[user deleted]</dc:creator>
    <description><![CDATA[<p>svalarino, Could you share with us the steps for installing ActiveCollab in an IIS, SSL environment?</p>]]></description>
    <pubDate>Fri, 20 Oct 2006 14:51:54 CDT</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/4083/#post4083</link>
    <guid>http://www.activecollab.com/forums/post/4083/#post4083</guid>
    <title>Post #2 by Ilija Studen</title>
    <dc:creator>Ilija Studen</dc:creator>
    <description><![CDATA[<p>To update headers check out download_contents() function (in environment/functions/files.php). Report back if you find a solution.<br />
<br />
Thanks</p>]]></description>
    <pubDate>Fri, 20 Oct 2006 13:48:51 CDT</pubDate>
  </item>
  <item>
    <link>http://www.activecollab.com/forums/post/4067/#post4067</link>
    <guid>http://www.activecollab.com/forums/post/4067/#post4067</guid>
    <title>Post #1 by [user deleted]</title>
    <dc:creator>[user deleted]</dc:creator>
    <description><![CDATA[<p>There is a well known problem with IE regarding downloading files over SSL. This problem manifests itself in my actievCollab install under IIS6. The problem does not happen with Firefox. <br />
<br />
The following errors are displayed after trying to &quot;Save Target As&quot; depending on the type of file being downloaded:<br />
<br />
(1) The File could not be written to the cache<br />
(2) Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.<br />
<br />
Some KB's suggest to turn off (clear, uncheck) this IE setting &quot;Do not save encrypted pages to disk&quot; (Tools &gt;Advanced &gt; Security)  However this does not resolve the problem in activeCollab.<br />
<br />
I believe the problem has to do with downloaded files being served by active Collab with the following http Header:<br />
<br />
Cache-Control: no-store, no-cache, must-revalidate<br />
<br />
Supposedly, if the the cache is set to &quot;public&quot; then IE will download files over SSL. This problems is well documented for other php projects. I have tried the following options:<br />
<br />
(1) Adding an IIS header as in &quot;Cache-Control: public, max-age=12000&quot; does not work because it gets overwritten by the php http headers.<br />
<br />
(2) Enabling and changing the session variables for PHP under IIS does produce the proper http headers. Example<br />
<br />
---------------------------------------------------------------------<br />
HTTP/1.1 200 OK<br />
Connection: close<br />
Date: Thu, 19 Oct 2006 22:32:51 GMT<br />
Server: Microsoft-IIS/6.0<br />
X-Powered-By: PHP/5.1.6<br />
Expires: Fri, 20 Oct 2006 01:52:51 GMT<br />
Cache-Control: public, max-age=12000<br />
Last-Modified: Thu, 12 Oct 2006 19:35:38 GMT<br />
Content-Type: image/gif<br />
---------------------------------------------------------------------<br />
<br />
BTW, here is a great page describing PHP installation on Win32/IIS6 including setting PHP sessions: http://www.phplivesupport.com/documentation/viewarticle.php?uid=1&amp;aid=78&amp;pid=8<br />
<br />
<br />
The problem is that activeCollab overwrites the PHP http header when downloading files resulting in http headers that cause the problem with IE downloads over SSL. Example:<br />
<br />
----------------------------------------------------------------------------------------------<br />
HTTP/1.1 200 OK<br />
Connection: close<br />
Date: Thu, 19 Oct 2006 22:52:23 GMT<br />
Server: Microsoft-IIS/6.0<br />
X-Powered-By: PHP/5.1.6<br />
Set-Cookie: id=1; expires=Thu, 19-Oct-2006 23:52:23 GMT; path=/<br />
Set-Cookie: token=73b986c1869a50ba0bce6350209126a84db0838f; expires=Thu, 19-Oct-2006 23:52:23 GMT; path=/<br />
Set-Cookie: remember=deleted; expires=Wed, 19-Oct-2005 22:52:22 GMT; path=/<br />
Cache-Control: no-store, no-cache, must-revalidate<br />
Cache-Control: post-check=0, pre-check=0<br />
Pragma: no-cache<br />
Expires: Fri, 20 Oct 2006 00:52:23 GMT<br />
Last-Modified: Thu, 19 Oct 2006 22:52:23 GMT<br />
Content-Type: image/tiff<br />
Content-Length: 645344<br />
Content-Disposition: inline; filename=&quot;CyberLogoVert.tif<br />
Content-Transfer-Encoding: binary<br />
----------------------------------------------------------------------------------------------<br />
<br />
Specifically, &quot;Cache-Control: no-store, no-cache, must-revalidate&quot;<br />
<br />
Both http headers cam from the same website but the first one was displaying info.php while the second was displaying an activeCollab &quot;Files&quot; download.<br />
<br />
How can I get activeCollab not to overwrite the php http headers when downloading files so that they can be downloaded using IE over SSL?<br />
<br />
I thank you in advance</p>]]></description>
    <pubDate>Thu, 19 Oct 2006 18:11:55 CDT</pubDate>
  </item>
</channel>
</rss>
