/*
- * "$Id: html.c 5548 2006-05-19 19:38:31Z mike $"
+ * HTML support functions for CUPS.
*
- * HTML support functions for the Common UNIX Printing System (CUPS).
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
*
- * Copyright 1997-2006 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * Contents:
- *
- * cgiEndHTML() - End a HTML page.
- * cgiFormEncode() - Encode a string as a form variable...
- * cgiStartHTML() - Start a HTML page.
- * cgi_null_passwd() - Return a NULL password for authentication.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * missing or damaged, see the license at "http://www.cups.org/".
*/
/*
#include "cgi-private.h"
+/*
+ * Local globals...
+ */
+
+static const char *cgi_multipart = NULL;
+ /* Multipart separator, if any */
+
+
/*
* Local functions...
*/
/*
- * 'cgiFormEncode()' - Encode a string as a form variable...
+ * 'cgiEndMultipart()' - End the delivery of a multipart web page.
+ */
+
+void
+cgiEndMultipart(void)
+{
+ if (cgi_multipart)
+ {
+ printf("\n%s--\n", cgi_multipart);
+ fflush(stdout);
+ }
+}
+
+
+/*
+ * 'cgiFormEncode()' - Encode a string as a form variable.
*/
char * /* O - Destination string */
for (dstptr = dst; *src && dstptr < dstend;)
{
switch (*src)
- {
+ {
case ' ' :
/*
* Encode spaces with a "+"...
* Tell the client to expect UTF-8 encoded HTML...
*/
+ if (cgi_multipart)
+ puts(cgi_multipart);
+
puts("Content-Type: text/html;charset=utf-8\n");
/*
}
+/*
+ * 'cgiStartMultipart()' - Start a multipart delivery of a web page.
+ */
+
+void
+cgiStartMultipart(void)
+{
+ puts("MIME-Version: 1.0\n"
+ "Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
+ fflush(stdout);
+
+ cgi_multipart = "--CUPS-MULTIPART";
+}
+
+
+/*
+ * 'cgiSupportsMultipart()' - Does the browser support multi-part documents?
+ */
+
+int /* O - 1 if multi-part supported, 0 otherwise */
+cgiSupportsMultipart(void)
+{
+ /*
+ * Too many bug reports for browsers that don't support it, and too much pain
+ * to whitelist known-good browsers, so for now we just punt on multi-part
+ * support... :(
+ */
+
+ return (0);
+}
+
+
/*
* 'cgi_null_passwd()' - Return a NULL password for authentication.
*/
return (NULL);
}
-
-
-/*
- * End of "$Id: html.c 5548 2006-05-19 19:38:31Z mike $".
- */