Index: [Article Count Order] [Thread]

Date:  Wed, 18 Apr 2007 22:05:47 +0200
From:  "Taco Scargo" <taco (at mark) scargo.nl>
Subject:  [coba-e:09616] Re: Godaddy SSL Certs
To:  <coba-e (at mark) bluequartz.org>
Message-Id:  <001701c781f4$f50e0ad0$14001fac@DELLP4TACO>
References:  <0JGP004UIE3KZGE0 (at mark) mxout5.netvision.net.il>
X-Mail-Count: 09616

Don't have time to upload it in svn right now, but here is the two patches 
that are needed.
It comes down to a very old MSIE bug regarding forcing the browser to 
download a file instead of displaying it in a browser. After a lot of 
reading I tried this, which works on all browsers I tried:

On PC:
MSIE 5.5, MSIE 6, MSIE 7
Firefox 2

On Mac (OSX 10.49/ppc:
MSIE 5
Safari
Firefox 2

diff -u browser.php.orig browser.php
--- browser.php.orig    2006-08-05 16:16:00.000000000 +0200
+++ browser.php 2007-04-18 21:34:52.000000000 +0200
@@ -23,9 +23,8 @@
  **/

 function browser_headers_for_download($filename, $type = '') {
-  // Attempt to determine if we are connected to an IE browser
+  // Attempt to determine if we are connected to a MAC browser
   global $HTTP_USER_AGENT;
-  $is_msie = strpos(strtoupper($HTTP_USER_AGENT), 'MSIE');
   $is_mac = strpos(strtoupper($HTTP_USER_AGENT), 'MAC');

   // DON'T CHANGE THESE MIMETYPES UNLESS YOU KNOW WHAT YOU'RE DOING!
@@ -45,22 +44,10 @@
     switch ($type) {
       case 'text':
       $mimetype = 'application/text';
-      $disposition = 'attachment';
       break;
     default:
       $mimetype = 'application/octet-stream';
-      $disposition = 'attachment';
     }
-  } else if ($is_msie !== false) {
-    // This will be IE on Windows
-    // When we send a Content-Disposition header, IE is supposed to show a
-    // Save As dialog and save the text to a file.
-    // But it has a bug, and so it doesn't.
-    // So we force it to think we're an octet-stream, and throw a weird
-    // Disposition to make it do the right thing.
-    // See http://support.microsoft.com/support/kb/articles/Q267/9/91.ASP
-    $mimetype = 'application/download';
-    $disposition = 'anything';
   } else {
     // Netscape on Windows
     // It too doesn't show a Save As dialog box when it sees a text file.
@@ -68,13 +55,14 @@
     switch ($type) {
     default:
       $mimetype = 'application/octet-stream';
-      $disposition = 'attachment';
-      break;
     }
   }

   header("Content-Type: $mimetype; name=\"$filename\"");
-  header("Content-Disposition: $disposition; filename=\"$filename\"");
+  header("Content-Disposition: attachment; filename=\"$filename\"");
+  header("Cache-Control: public, must-revalidate");
+  header("Pragma: hack");
+  header("Content-Transfer-Encoding: binary\n");
 }
 /*
 Copyright (c) 2003 Sun Microsystems, Inc. All  Rights Reserved.

diff -u exportCert.php.orig exportCert.php
--- exportCert.php.orig 2005-11-29 15:10:54.000000000 +0100
+++ exportCert.php      2007-04-18 21:42:41.000000000 +0200
@@ -45,6 +45,7 @@
     }

     browser_headers_for_download($filename, 'text');
+    header("Content-Length: " . strlen($cert));

     // spew out everything ssl_get gives us
     print $cert;


I know the sitestat section also uses the function, but as this parses a 
file I cannot determine the length without capturing everything in php 
first, which could exhaust memory on big files.

As a workaround, another option is the 'save target as' (right mouseclick) 
on the download/export button.

Taco
----- Original Message ----- 
From: "Arthur Sherman" <arturs (at mark) netvision.net.il>
To: <coba-e (at mark) bluequartz.org>
Sent: Wednesday, April 18, 2007 7:02 PM
Subject: [coba-e:09614] Re: Godaddy SSL Certs


>> >>> I did "Create signing request" in the SSL tab for the site.
>> >>>
>> >>> I then tried to "export" the request, for uploading to the cert
>> >>> authority's website. This failed. No errors in the adm error log
>> >>> file.... Any hints?
>> >>>
>> >>> Regards,
>> >>> Greg
>> >>
>> >> Greg
>> >>
>> >> Log in with Firefox, not IE.
>> > Thanks ken! That worked a treat.
>> >
>> > I have one really dumb question - How long has the BQ
>> community know
>> > about this? Is there a patch? Dont get me wrong, I do not
>> for one minute
>> > want to advocate IE as a recommended browser platform.....
>> Unfortunately
>> > for me, I need to use it for the dayjob for some custom
>> inhouse apps. I
>> > use firefox for my own stuff.... On this one occasion, I
>> tried to work
>> > on this cert on my work PC, and it failed!
>> >
>> > Regards,
>> > Greg.
>>
>>
>> Greg
>>
>> The raq550 servers also have this behavior.
>
>
> Could someone add this to bug tracker?
>
>
>
> Best,
>
> --
> Arthur
>
>
>