ietf-822
[Top] [All Lists]

Re: Attention MIME implementors

1992-12-02 21:20:45
Maybe the next version of MIME needs to make a recommendation that
boundaries
should be quoted by MIME generators, whether you think it's needed or not.

Maybe people should just learn to read the grammar in protocol specifications
instead of just assuming that they can do any old crap.

Alternatively, how about a short example algorithm for generating a
"correct"
random boundary?  Not required of course, but a recommendation.  This could
solve a lot of future hassles.

The issue has nothing to do with whether or not the boundary is ``correct''
but whether or not it was correctly specified in the string.  Here is a
version of strcat() that applies tspecial quoting to a given string.  Somewhat
more general routines are in c-client.

char *tspecial_cat (char *dest,char *src)
{
  char *s;
                                /* any tspecials present? */
  if (strpbrk (src," ()<>@,;:\\\"[]./?=")) {
    strcat (dest,"\"");         /* opening quote */
                                /* quoting characters in there? */
    while (s = strpbrk (src,"\\\"")) {
      strncat (dest,src,s-src); /* yes, output leader */
      strcat (dest,"\\");       /* quoting of the quoting */
      strncat (dest,s,1);       /* output the quoting character */
      src = ++s;                /* continue after the quoting character */
    }
    if (*src) strcat (dest,src);/* output remainder of the string */
    return strcat (dest,"\"");  /* closing quote */
  }
  return strcat (dest,src);     /* otherwise it's the easy case */
}

 If a MIME implementor is unsure, then they
can just use the suggested algorithm.

If a MIME implementor is unsure, they should use one of the existing MIME
packages instead of inflicting their own brain-dead ideas of what is right
upon the rest of the world.  c-client is an excellent package (OK, I admit it,
I wrote c-client) that does all the MIME stuff and does it right, and is quite
suited for dropping into new applications.


<Prev in Thread] Current Thread [Next in Thread>