Cook Computing

« January 2004 »

MIME Encapsulation of Aggregate Documents

I often use the "Save as ...Web Page, single file (*.mht)" feature of IE, and have sometimes speculated about the format, though never enough to investigate it any further, until I came across a Slashdot posting yesterday which mentioned that the format is defined in RFC2557 - MIME Encapsulation of Aggregate Documents.

To give a flavour of the format, this is one of the examples from the RFC, an HTML message containing a single image:

From: foo1@bar.net
To: foo2@bar.net
Subject: A simple example
Mime-Version: 1.0
Content-Type: multipart/related; boundary="boundary-example";
        type="text/html"; start="<foo3@foo1@bar.net>"

--boundary-example
Content-Type: text/html;charset="US-ASCII"
Content-ID: <foo3@foo1@bar.net>

... text of the HTML document, which might contain a URI
referencing a resource in another body part, for example
through a statement such as:
<IMG SRC="http://www.ietf.cnri.reston.va.us/images/ietflogo.gif"
 ALT="IETF logo">
--boundary-example
Content-Location: http://www.ietf.cnri.reston.va.us/images/ietflogo.gif
Content-Type: IMAGE/GIF
Content-Transfer-Encoding: BASE64
R0lGODlhGAGgAPEAAP/////ZRaCgoAAAACH+PUNvcHlyaWdodCAoQykgMTk5
NSBJRVRGLiBVbmF1dGhvcml6ZWQgZHVwbGljYXRpb24gcHJvaGliaXRlZC4A
etc...

--boundary-example--
Posted by Charles Cook at 08:00 AM. Permalink. View Comments.

Folklore - Early Days of the Mac

If you're interested in reading anecdotes about the development of the original Mac, check out the Folklore site created by Andy Hertzfeld (via Rentzsch.com).

Posted by Charles Cook at 07:39 AM. Permalink. View Comments.

customErrors and Custom Channels

When working with .NET Remoting it can be irritating when a client receives an exception like this:

System.Runtime.Remoting.RemotingException: Server encountered an internal error. For more information, turn on customErrors in the server's .config file.[/quote]You get this by default when the client is on a different machine to the server, and you have to use a config file on the server to change this behavior because it is not possible to configure customErrors programmatically.

It gets worse when you develop a custom channel because there is no documented way of preventing exceptions from being filtered for local as well as remote calls. However, if the server side of the channel adds a new header called "__CustomErrorsEnabled" and sets it to boolean false before calling ProcessMessage on the next sink in the chain, then exception filtering will be turned off for all calls. For example, taking the code from the named pipe channel sample:

...
    pipe.BeginReadMessage();
    ITransportHeaders headers = pipe.ReadHeaders();
    headers["__CustomErrorsEnabled"] = false;
    Stream request = pipe.ReadStream();
    pipe.EndReadMessage();
    ServerChannelSinkStack stack = new ServerChannelSinkStack();
    stack.Push(_transportSink, null);
    IMessage respMsg;
    ITransportHeaders respHeaders;
    Stream respStream;
    ServerProcessing processing 
        = _transportSink.NextChannelSink.ProcessMessage(stack,
            null, headers, request, out respMsg, out respHeaders,
            out respStream);
...

Thanks to Andy McMullan for pointing this out.

Posted by Charles Cook at 07:24 PM. Permalink. View Comments.

vccomponents.dat

The Visual Studio 2003 VC++ include, lib, etc, directories are not stored in a registry setting. To copy these per-user settings, copy this file:

\Documents and Settings\username\Local Settings\Application Data\Microsoft\VisualStudio\7.1\VCComponents.dat

Posted by Charles Cook at 07:24 PM. Permalink. View Comments.