about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES9
-rw-r--r--WWW/Library/Implementation/HTFTP.c4
-rw-r--r--WWW/Library/Implementation/HTFile.c5
-rw-r--r--WWW/Library/Implementation/HTFormat.h22
-rw-r--r--WWW/Library/Implementation/HTMIME.c27
-rw-r--r--WWW/Library/Implementation/HTTP.c6
-rw-r--r--WWW/Library/Implementation/HTWAIS.c8
-rw-r--r--lynx.cfg8
-rw-r--r--src/GridText.c10
-rw-r--r--src/HTFWriter.c21
-rw-r--r--src/HTInit.c112
-rw-r--r--src/LYBookmark.c4
-rw-r--r--src/LYCgi.c4
-rw-r--r--src/LYCharUtils.c6
-rw-r--r--src/LYGlobalDefs.h4
-rw-r--r--src/LYHistory.c4
-rw-r--r--src/LYMail.c4
-rw-r--r--src/LYMain.c13
-rw-r--r--src/LYMainLoop.c7
-rw-r--r--src/LYMap.c4
-rw-r--r--src/LYOptions.c66
-rw-r--r--src/LYPrint.c15
-rw-r--r--src/LYReadCFG.c3
-rw-r--r--src/LYrcFile.c11
-rw-r--r--src/LYrcFile.h4
25 files changed, 218 insertions, 163 deletions
diff --git a/CHANGES b/CHANGES
index 62e21530..cb183ed1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,14 @@
--- $LynxId: CHANGES,v 1.941 2018/03/03 15:23:29 tom Exp $
+-- $LynxId: CHANGES,v 1.942 2018/03/05 22:48:35 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
-2018-03-02 (2.8.9dev.17)
+2018-03-05 (2.8.9dev.17)
+* add PREFERRED_CONTENT_TYPE defaulting to text/plain and options-menu to
+  replace an assumption in HTMIMEConvert that everything is text/html.
+  Since most servers provide a valid Content-Type for HTML, and are more likely
+  to omit it for files lacking a known suffix, defaulting to text/plain is a
+  better choice -TD
 * remove dead-code for OMIT_SCN_KEEPING -TD
 * remove dead/unreachable pretty-source code in HTML.c, noticed because
   it complicates hashing -TD
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index da6cc477..4e24ade3 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFTP.c,v 1.129 2017/07/02 20:42:32 tom Exp $
+ * $LynxId: HTFTP.c,v 1.130 2018/03/05 22:33:35 tom Exp $
  *
  *			File Transfer Protocol (FTP) Client
  *			for a WorldWideWeb browser
@@ -2556,7 +2556,7 @@ static EntryInfo *parse_dir_entry(char *entry,
 	    if ((server_type != UNIX_SERVER) ||
 		(cp > (entry_info->filename + 3) &&
 		 0 == strncasecomp((cp - 4), "read.me", 7))) {
-		StrAllocCopy(entry_info->type, "text/plain");
+		StrAllocCopy(entry_info->type, STR_PLAINTEXT);
 	    }
 	}
     }
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 77817a4f..1f3ec5eb 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFile.c,v 1.147 2017/07/02 20:42:33 tom Exp $
+ * $LynxId: HTFile.c,v 1.148 2018/03/05 22:37:12 tom Exp $
  *
  *			File Access				HTFile.c
  *			===========
@@ -1583,7 +1583,8 @@ void HTStructured_doctype(HTStructured * target, HTFormat format_out)
 void HTStructured_meta(HTStructured * target, HTFormat format_out)
 {
     if (view_structured(format_out))
-	PUTS("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
+	PUTS("<meta http-equiv=\"Content-Type\" content=\"" STR_HTML
+	     "; charset=iso-8859-1\">\n");
 }
 /*	Output parent directory entry.
  *	------------------------------
diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h
index 1e82fd76..f7e65f2c 100644
--- a/WWW/Library/Implementation/HTFormat.h
+++ b/WWW/Library/Implementation/HTFormat.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFormat.h,v 1.33 2010/10/27 00:13:53 tom Exp $
+ * $LynxId: HTFormat.h,v 1.36 2018/03/05 22:25:50 tom Exp $
  *
  *                                            HTFormat: The format manager in the WWW Library
  *                          MANAGE DIFFERENT DOCUMENT FORMATS
@@ -108,12 +108,17 @@ extern "C" {
    versions (pre 2.11).
 
  */
-#define WWW_PLAINTEXT   HTAtom_for("text/plain")
+#define STR_BINARY      "application/octet-stream"
+#define STR_PLAINTEXT   "text/plain"
+#define STR_HTML        "text/html"
+
+#define WWW_BINARY      HTAtom_for(STR_BINARY)
+#define WWW_PLAINTEXT   HTAtom_for(STR_PLAINTEXT)
+#define WWW_HTML        HTAtom_for(STR_HTML)
+
 #define WWW_POSTSCRIPT  HTAtom_for("application/postscript")
 #define WWW_RICHTEXT    HTAtom_for("application/rtf")
 #define WWW_AUDIO       HTAtom_for("audio/basic")
-#define WWW_HTML        HTAtom_for("text/html")
-#define WWW_BINARY      HTAtom_for("application/octet-stream")
 
     typedef HTAtom *HTEncoding;
 
@@ -188,6 +193,15 @@ The HTPresentation and HTConverter types
     extern HTPresentation *default_presentation;
 
 /*
+ * Options used for "Content-Type" string
+ */
+    typedef enum {
+	contentBINARY = 0
+	,contentTEXT
+	,contentHTML
+    } ContentType;
+
+/*
  * Options used for "Accept:" string
  */
     typedef enum {
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 1644793a..bc2fd1ec 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTMIME.c,v 1.95 2017/07/02 19:40:06 tom Exp $
+ * $LynxId: HTMIME.c,v 1.97 2018/03/05 10:21:10 tom Exp $
  *
  *			MIME Message Parse			HTMIME.c
  *			==================
@@ -32,6 +32,7 @@
 #include <LYCharUtils.h>
 #include <LYStrings.h>
 #include <LYUtils.h>
+#include <LYGlobalDefs.h>
 #include <LYLeaks.h>
 
 /*		MIME Object
@@ -2165,6 +2166,7 @@ HTStream *HTMIMEConvert(HTPresentation *pres,
 {
     HTStream *me;
 
+    CTRACE((tfp, "HTMIMEConvert\n"));
     me = typecalloc(HTStream);
 
     if (me == NULL)
@@ -2197,27 +2199,8 @@ HTStream *HTMIMEConvert(HTPresentation *pres,
     FREE(me->anchor->server);
     me->target = NULL;
     me->state = miBEGINNING_OF_LINE;
-    /*
-     * Sadly enough, change this to always default to WWW_HTML to parse all
-     * text as HTML for the users.
-     * GAB 06-30-94
-     * Thanks to Robert Rowland robert@cyclops.pei.edu
-     *
-     * After discussion of the correct handline, should be application/octet-
-     * stream or unknown; causing servers to send a correct content type.
-     *
-     * The consequence of using WWW_UNKNOWN is that you end up downloading as a
-     * binary file what 99.9% of the time is an HTML file, which should have
-     * been rendered or displayed.  So sadly enough, I'm changing it back to
-     * WWW_HTML, and it will handle the situation like Mosaic does, and as
-     * Robert Rowland suggested, because being functionally correct 99.9% of
-     * the time is better than being technically correct but functionally
-     * nonsensical.  - FM
-     */
-    /***
-    me->format	  =	WWW_UNKNOWN;
-    ***/
-    me->format = WWW_HTML;
+    me->format = HTAtom_for(ContentTypes[LYContentType]);
+    CTRACE((tfp, "default Content-Type is %s\n", HTAtom_name(me->format)));
     me->targetRep = pres->rep_out;
     me->boundary = NULL;	/* Not set yet */
     me->set_cookie = NULL;	/* Not set yet */
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index ebdf28e6..b6af5887 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.166 2018/02/26 00:21:47 tom Exp $
+ * $LynxId: HTTP.c,v 1.167 2018/03/05 22:33:35 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -2004,7 +2004,7 @@ static int HTLoadHTTP(const char *arg,
 	     * Treat all plain text as HTML.  This sucks but its the only
 	     * solution without without looking at content.
 	     */
-	    if (!StrNCmp(HTAtom_name(format_in), "text/plain", 10)) {
+	    if (!StrNCmp(HTAtom_name(format_in), STR_PLAINTEXT, 10)) {
 		CTRACE((tfp, "HTTP: format_in being changed to text/HTML\n"));
 		format_in = WWW_HTML;
 	    }
@@ -2551,7 +2551,7 @@ static int HTLoadHTTP(const char *arg,
 #else
 	length = rawlength;
 #endif
-	format_in = HTAtom_for("text/plain");
+	format_in = HTAtom_for(STR_PLAINTEXT);
 
     } else if (doing_redirect) {
 
diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c
index e24dd6ec..cf510faf 100644
--- a/WWW/Library/Implementation/HTWAIS.c
+++ b/WWW/Library/Implementation/HTWAIS.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTWAIS.c,v 1.38 2013/11/28 11:16:03 tom Exp $
+ * $LynxId: HTWAIS.c,v 1.39 2018/03/05 22:33:35 tom Exp $
  *
  *	WorldWideWeb - Wide Area Informaion Server Access	HTWAIS.c
  *	==================================================
@@ -915,10 +915,10 @@ int HTLoadWAIS(const char *arg,
 
 	format_in =
 	    !strcmp(doctype, "WSRC") ? HTAtom_for("application/x-wais-source") :
-	    !strcmp(doctype, "TEXT") ? HTAtom_for("text/plain") :
-	    !strcmp(doctype, "HTML") ? HTAtom_for("text/html") :
+	    !strcmp(doctype, "TEXT") ? HTAtom_for(STR_PLAINTEXT) :
+	    !strcmp(doctype, "HTML") ? HTAtom_for(STR_HTML) :
 	    !strcmp(doctype, "GIF") ? HTAtom_for("image/gif") :
-	    HTAtom_for("application/octet-stream");
+	    HTAtom_for(STR_BINARY);
 	binary =
 	    0 != strcmp(doctype, "WSRC") &&
 	    0 != strcmp(doctype, "TEXT") &&
diff --git a/lynx.cfg b/lynx.cfg
index ca1d4f88..2950d7c3 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -1,4 +1,4 @@
-# $LynxId: lynx.cfg,v 1.291 2018/03/02 21:30:34 tom Exp $
+# $LynxId: lynx.cfg,v 1.292 2018/03/05 22:52:26 tom Exp $
 # lynx.cfg file.
 # The default placement for this file is /usr/local/lib/lynx.cfg (Unix)
 #                                     or Lynx_Dir:lynx.cfg (VMS)
@@ -2405,6 +2405,12 @@ MINIMAL_COMMENTS:TRUE
 #	ALL		All of the above.
 #PREFERRED_ENCODING:all
 
+.h2 PREFERRED_CONTENT_TYPE
+# When doing a GET, lynx expects the server to provide a Content-Type, i.e.,
+# the MIME name which tells it how to present data.  When that is missing
+# lynx uses this value.
+#PREFERRED_CONTENT_TYPE: text/plain
+
 .h1 Keyboard Input
 
 .h2 KEYBOARD_LAYOUT
diff --git a/src/GridText.c b/src/GridText.c
index 82596e8e..416f440e 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.307 2018/03/01 22:23:53 Takeshi.Hataguchi Exp $
+ * $LynxId: GridText.c,v 1.308 2018/03/05 22:35:07 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -10666,7 +10666,7 @@ static const char *guess_content_type(const char *filename)
 
     return (format != 0 && non_empty(format->name))
 	? format->name
-	: "text/plain";
+	: STR_PLAINTEXT;
 }
 #endif /* USE_FILE_UPLOAD */
 
@@ -10837,7 +10837,7 @@ static char *escape_or_quote_name(const char *name,
 	StrAllocCopy(escaped1, "Content-Disposition: form-data");
 	HTSprintf(&escaped1, "; name=\"%s\"", name);
 	if (MultipartContentType)
-	    HTSprintf(&escaped1, MultipartContentType, "text/plain");
+	    HTSprintf(&escaped1, MultipartContentType, STR_PLAINTEXT);
 	if (quoting == QUOTE_BASE64)
 	    StrAllocCat(escaped1, "\r\nContent-Transfer-Encoding: base64");
 	StrAllocCat(escaped1, "\r\n\r\n");
@@ -10989,7 +10989,7 @@ int HText_SubmitForm(FormInfo * submit_item, DocInfo *doc,
      * Check the ENCTYPE and set up the appropriate variables.  -FM
      */
     if (submit_item->submit_enctype &&
-	!strncasecomp(submit_item->submit_enctype, "text/plain", 10)) {
+	!strncasecomp(submit_item->submit_enctype, STR_PLAINTEXT, 10)) {
 	/*
 	 * Do not hex escape, and use physical newlines
 	 * to separate name=value pairs.  -FM
@@ -11181,7 +11181,7 @@ int HText_SubmitForm(FormInfo * submit_item, DocInfo *doc,
 			 "application/sgml-form-urlencoded");
 	} else if (PlainText == TRUE) {
 	    StrAllocCopy(content_type_out,
-			 "text/plain");
+			 STR_PLAINTEXT);
 	} else if (Boundary != NULL) {
 	    StrAllocCopy(content_type_out,
 			 "multipart/form-data");
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index ee123013..f119e4a5 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFWriter.c,v 1.114 2018/03/01 22:14:42 Takeshi.Hataguchi Exp $
+ * $LynxId: HTFWriter.c,v 1.115 2018/03/05 22:38:53 tom Exp $
  *
  *		FILE WRITER				HTFWrite.h
  *		===========
@@ -782,7 +782,7 @@ HTStream *HTSaveAndExecute(HTPresentation *pres,
 	 * Check for a suffix.
 	 * Save the file under a suitably suffixed name.
 	 */
-	if (!strcasecomp(pres->rep->name, "text/html")) {
+	if (!strcasecomp(pres->rep->name, STR_HTML)) {
 	    suffix = HTML_SUFFIX;
 	} else if (!strncasecomp(pres->rep->name, "text/", 5)) {
 	    suffix = TEXT_SUFFIX;
@@ -936,7 +936,7 @@ HTStream *HTSaveToFile(HTPresentation *pres,
 	 * Check for a suffix.
 	 * Save the file under a suitably suffixed name.
 	 */
-	if (!strcasecomp(pres->rep->name, "text/html")) {
+	if (!strcasecomp(pres->rep->name, STR_HTML)) {
 	    suffix = HTML_SUFFIX;
 	} else if (!strncasecomp(pres->rep->name, "text/", 5)) {
 	    suffix = TEXT_SUFFIX;
@@ -1003,7 +1003,7 @@ HTStream *HTSaveToFile(HTPresentation *pres,
     StrAllocCopy(anchor->FileCache, fnam);
   Prepend_BASE:
     if (LYPrependBaseToSource &&
-	!strncasecomp(pres->rep->name, "text/html", 9) &&
+	!strncasecomp(pres->rep->name, STR_HTML, 9) &&
 	!anchor->content_encoding) {
 	/*
 	 * Add the document's base as a BASE tag at the top of the file, so
@@ -1047,7 +1047,7 @@ HTStream *HTSaveToFile(HTPresentation *pres,
 	FREE(temp);
     }
     if (LYPrependCharsetToSource &&
-	!strncasecomp(pres->rep->name, "text/html", 9) &&
+	!strncasecomp(pres->rep->name, STR_HTML, 9) &&
 	!anchor->content_encoding) {
 	/*
 	 * Add the document's charset as a META CHARSET tag at the top of the
@@ -1063,7 +1063,8 @@ HTStream *HTSaveToFile(HTPresentation *pres,
 	    StrAllocCopy(temp, anchor->charset);
 	    LYRemoveBlanks(temp);
 	    fprintf(ret_obj->fp,
-		    "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=%s\">\n\n",
+		    "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"" STR_HTML
+		    "; charset=%s\">\n\n",
 		    temp);
 	}
 	FREE(temp);
@@ -1101,7 +1102,7 @@ HTStream *HTCompressed(HTPresentation *pres,
 	 * We have no idea what we're dealing with, so treat it as a binary
 	 * stream.  - FM
 	 */
-	format = HTAtom_for("application/octet-stream");
+	format = HTAtom_for(STR_BINARY);
 	me = HTStreamStack(format, pres->rep_out, sink, anchor);
 	return me;
     }
@@ -1176,8 +1177,8 @@ HTStream *HTCompressed(HTPresentation *pres,
 	HTOutputFormat == HTAtom_for("www/download") ||		/* download */
 	!strcasecomp(pres->rep_out->name, "www/download") ||	/* download */
 	(traversal &&		/* only handle html or plain text for traversals */
-	 strcasecomp(anchor->content_type, "text/html") &&
-	 strcasecomp(anchor->content_type, "text/plain"))) {
+	 strcasecomp(anchor->content_type, STR_HTML) &&
+	 strcasecomp(anchor->content_type, STR_PLAINTEXT))) {
 	/*
 	 * Cast the Content-Encoding to a Content-Type and pass it back to be
 	 * handled as that type.  - FM
@@ -1232,7 +1233,7 @@ HTStream *HTCompressed(HTPresentation *pres,
      * Get a new temporary filename and substitute a suitable suffix.  - FM
      */
     middle = NULL;
-    if (!strcasecomp(anchor->content_type, "text/html")) {
+    if (!strcasecomp(anchor->content_type, STR_HTML)) {
 	middle = HTML_SUFFIX;
 	middle++;		/* point to 'h' of .htm(l) - kw */
     } else if (!strncasecomp(anchor->content_type, "text/", 5)) {
diff --git a/src/HTInit.c b/src/HTInit.c
index c2c6c71c..42e7525c 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTInit.c,v 1.89 2016/11/24 15:35:29 tom Exp $
+ * $LynxId: HTInit.c,v 1.90 2018/03/05 22:35:07 tom Exp $
  *
  *		Configuration-specific Initialization		HTInit.c
  *		----------------------------------------
@@ -118,7 +118,7 @@ void HTFormatInit(void)
      * The following support some content types seen here/there:
      */
     SET_INTERNL("application/html", "text/x-c", HTMLToC, 0.5);
-    SET_INTERNL("application/html", "text/plain", HTMLToPlain, 0.5);
+    SET_INTERNL("application/html", STR_PLAINTEXT, HTMLToPlain, 0.5);
     SET_INTERNL("application/html", "www/present", HTMLPresent, 2.0);
     SET_INTERNL("application/html", "www/source", HTPlainPresent, 1.0);
     SET_INTERNL("application/xml", "www/present", HTMLPresent, 2.0);
@@ -144,11 +144,11 @@ void HTFormatInit(void)
      * Other internal types, which must precede the "www/present" entries
      * below (otherwise, they will be filtered out in HTFilterPresentations()).
      */
-    SET_INTERNL("text/css", "text/plain", HTMLToPlain, 0.5);
-    SET_INTERNL("text/html", "text/plain", HTMLToPlain, 0.5);
-    SET_INTERNL("text/html", "text/x-c", HTMLToC, 0.5);
-    SET_INTERNL("text/html", "www/source", HTPlainPresent, 1.0);
-    SET_INTERNL("text/plain", "www/source", HTPlainPresent, 1.0);
+    SET_INTERNL("text/css", STR_PLAINTEXT, HTMLToPlain, 0.5);
+    SET_INTERNL(STR_HTML, STR_PLAINTEXT, HTMLToPlain, 0.5);
+    SET_INTERNL(STR_HTML, "text/x-c", HTMLToC, 0.5);
+    SET_INTERNL(STR_HTML, "www/source", HTPlainPresent, 1.0);
+    SET_INTERNL(STR_PLAINTEXT, "www/source", HTPlainPresent, 1.0);
     SET_INTERNL("text/sgml", "www/source", HTPlainPresent, 1.0);
     SET_INTERNL("text/x-sgml", "www/source", HTPlainPresent, 1.0);
 
@@ -180,8 +180,8 @@ void HTFormatInit(void)
      */
     SET_INTERNL("application/xhtml+xml", "www/present", HTMLPresent, 1.0);
     SET_INTERNL("text/css", "www/present", HTPlainPresent, 1.0);
-    SET_INTERNL("text/html", "www/present", HTMLPresent, 1.0);
-    SET_INTERNL("text/plain", "www/present", HTPlainPresent, 1.0);
+    SET_INTERNL(STR_HTML, "www/present", HTMLPresent, 1.0);
+    SET_INTERNL(STR_PLAINTEXT, "www/present", HTPlainPresent, 1.0);
     SET_INTERNL("text/sgml", "www/present", HTMLPresent, 1.0);
     SET_INTERNL("text/x-sgml", "www/present", HTMLPresent, 2.0);
     SET_INTERNL("text/xml", "www/present", HTMLPresent, 2.0);
@@ -217,8 +217,8 @@ void HTPreparsedFormatInit(void)
 {
     CTrace((tfp, "HTPreparsedFormatInit\n"));
     if (LYPreparsedSource) {
-	SET_INTERNL("text/html", "www/source", HTMLParsedPresent, 1.0);
-	SET_INTERNL("text/html", "www/dump", HTMLParsedPresent, 1.0);
+	SET_INTERNL(STR_HTML, "www/source", HTMLParsedPresent, 1.0);
+	SET_INTERNL(STR_HTML, "www/dump", HTMLParsedPresent, 1.0);
     }
 }
 
@@ -413,8 +413,8 @@ static int ProcessMailcapEntry(FILE *fp, struct MailcapEntry *mc, AcceptMedia me
 	return (0);
     }
     *s++ = '\0';
-    if (!strncasecomp(t, "text/html", 9) ||
-	!strncasecomp(t, "text/plain", 10)) {
+    if (!strncasecomp(t, STR_HTML, 9) ||
+	!strncasecomp(t, STR_PLAINTEXT, 10)) {
 	--s;
 	*s = ';';
 	CTrace((tfp, "ProcessMailcapEntry: Ignoring mailcap entry: %s\n",
@@ -1052,8 +1052,8 @@ void HTFileInit(void)
 	CTrace((tfp, "HTFileInit: Loading default (HTInit) extension maps.\n"));
 
 	/* default suffix interpretation */
-	SET_SUFFIX1("*", "text/plain", "8bit");
-	SET_SUFFIX1("*.*", "text/plain", "8bit");
+	SET_SUFFIX1("*", STR_PLAINTEXT, "8bit");
+	SET_SUFFIX1("*.*", STR_PLAINTEXT, "8bit");
 
 #ifdef EXEC_SCRIPTS
 	/*
@@ -1090,7 +1090,7 @@ void HTFileInit(void)
 	SET_SUFFIX1(".AXP_exe", "application/x-Executable",	"binary");
 	SET_SUFFIX1(".VAX-exe", "application/x-Executable",	"binary");
 	SET_SUFFIX1(".VAX_exe", "application/x-Executable",	"binary");
-	SET_SUFFIX5(".exe",	"application/octet-stream",	"binary", "Executable");
+	SET_SUFFIX5(".exe",	STR_BINARY,			"binary", "Executable");
 
 #ifdef TRADITIONAL_SUFFIXES
 	SET_SUFFIX1(".exe.Z",	"application/x-Comp. Executable", "binary");
@@ -1100,7 +1100,7 @@ void HTFileInit(void)
 #else
 	SET_SUFFIX5(".Z",	"application/x-compress",	"binary", "UNIX Compressed");
 	SET_SUFFIX5(".Z",	NULL,				"compress", "UNIX Compressed");
-	SET_SUFFIX5(".exe.Z",	"application/octet-stream",	"compress", "Executable");
+	SET_SUFFIX5(".exe.Z",	STR_BINARY,			"compress", "Executable");
 	SET_SUFFIX5(".tar_Z",	"application/x-tar",		"compress", "UNIX Compr. Tar");
 	SET_SUFFIX5(".tar.Z",	"application/x-tar",		"compress", "UNIX Compr. Tar");
 #endif
@@ -1151,9 +1151,9 @@ void HTFileInit(void)
 
 	SET_SUFFIX5(".hqx",	"application/mac-binhex40",	"8bit", "Mac BinHex");
 
-	HTSetSuffix5(".o",	"application/octet-stream",	"binary", "Prog. Object", 0.5);
-	HTSetSuffix5(".a",	"application/octet-stream",	"binary", "Prog. Library", 0.5);
-	HTSetSuffix5(".so",	"application/octet-stream",	"binary", "Shared Lib", 0.5);
+	HTSetSuffix5(".o",	STR_BINARY,			"binary", "Prog. Object", 0.5);
+	HTSetSuffix5(".a",	STR_BINARY,			"binary", "Prog. Library", 0.5);
+	HTSetSuffix5(".so",	STR_BINARY,			"binary", "Shared Lib", 0.5);
 #endif
 
 	SET_SUFFIX5(".oda",	"application/oda",		"binary", "ODA");
@@ -1210,19 +1210,19 @@ void HTFileInit(void)
 	SET_SUFFIX1(".bkp",	"application/x-VMS BAK File",	"binary");
 	SET_SUFFIX1(".bck",	"application/x-VMS BAK File",	"binary");
 
-	SET_SUFFIX5(".bkp_gz",	"application/octet-stream",	"gzip", "GNU BAK File");
-	SET_SUFFIX5(".bkp-gz",	"application/octet-stream",	"gzip", "GNU BAK File");
-	SET_SUFFIX5(".bck_gz",	"application/octet-stream",	"gzip", "GNU BAK File");
-	SET_SUFFIX5(".bck-gz",	"application/octet-stream",	"gzip", "GNU BAK File");
+	SET_SUFFIX5(".bkp_gz",	STR_BINARY,			"gzip", "GNU BAK File");
+	SET_SUFFIX5(".bkp-gz",	STR_BINARY,			"gzip", "GNU BAK File");
+	SET_SUFFIX5(".bck_gz",	STR_BINARY,			"gzip", "GNU BAK File");
+	SET_SUFFIX5(".bck-gz",	STR_BINARY,			"gzip", "GNU BAK File");
 
-	SET_SUFFIX5(".bkp-Z",	"application/octet-stream",	"compress", "Comp. BAK File");
-	SET_SUFFIX5(".bkp_Z",	"application/octet-stream",	"compress", "Comp. BAK File");
-	SET_SUFFIX5(".bck-Z",	"application/octet-stream",	"compress", "Comp. BAK File");
-	SET_SUFFIX5(".bck_Z",	"application/octet-stream",	"compress", "Comp. BAK File");
+	SET_SUFFIX5(".bkp-Z",	STR_BINARY,			"compress", "Comp. BAK File");
+	SET_SUFFIX5(".bkp_Z",	STR_BINARY,			"compress", "Comp. BAK File");
+	SET_SUFFIX5(".bck-Z",	STR_BINARY,			"compress", "Comp. BAK File");
+	SET_SUFFIX5(".bck_Z",	STR_BINARY,			"compress", "Comp. BAK File");
 #else
 	HTSetSuffix5(".bak",	NULL,				"binary", "Backup", 0.5);
-	SET_SUFFIX5(".bkp",	"application/octet-stream",	"binary", "VMS BAK File");
-	SET_SUFFIX5(".bck",	"application/octet-stream",	"binary", "VMS BAK File");
+	SET_SUFFIX5(".bkp",	STR_BINARY,			"binary", "VMS BAK File");
+	SET_SUFFIX5(".bck",	STR_BINARY,			"binary", "VMS BAK File");
 #endif
 
 #if defined(TRADITIONAL_SUFFIXES) || defined(VMS)
@@ -1233,11 +1233,11 @@ void HTFileInit(void)
 	SET_SUFFIX1(".decw$book", "application/x-DEC BookReader", "binary");
 	SET_SUFFIX1(".mem",	"application/x-RUNOFF-MANUAL", "8bit");
 #else
-	SET_SUFFIX5(".hlb",	"application/octet-stream",	"binary", "VMS Help Libr.");
-	SET_SUFFIX5(".olb",	"application/octet-stream",	"binary", "VMS Obj. Libr.");
-	SET_SUFFIX5(".tlb",	"application/octet-stream",	"binary", "VMS Text Libr.");
-	SET_SUFFIX5(".obj",	"application/octet-stream",	"binary", "Prog. Object");
-	SET_SUFFIX5(".decw$book", "application/octet-stream",	"binary", "DEC BookReader");
+	SET_SUFFIX5(".hlb",	STR_BINARY,			"binary", "VMS Help Libr.");
+	SET_SUFFIX5(".olb",	STR_BINARY,			"binary", "VMS Obj. Libr.");
+	SET_SUFFIX5(".tlb",	STR_BINARY,			"binary", "VMS Text Libr.");
+	SET_SUFFIX5(".obj",	STR_BINARY,			"binary", "Prog. Object");
+	SET_SUFFIX5(".decw$book", STR_BINARY,			"binary", "DEC BookReader");
 	SET_SUFFIX5(".mem",	"text/x-runoff-manual",		"8bit", "RUNOFF-MANUAL");
 #endif
 
@@ -1320,25 +1320,25 @@ void HTFileInit(void)
 
 	SET_SUFFIX1(".mime",	"message/rfc822",		"8bit");
 
-	SET_SUFFIX1(".c",	"text/plain",			"8bit");
-	SET_SUFFIX1(".cc",	"text/plain",			"8bit");
-	SET_SUFFIX1(".c++",	"text/plain",			"8bit");
-	SET_SUFFIX1(".css",	"text/plain",			"8bit");
-	SET_SUFFIX1(".h",	"text/plain",			"8bit");
-	SET_SUFFIX1(".pl",	"text/plain",			"8bit");
-	SET_SUFFIX1(".text",	"text/plain",			"8bit");
-	SET_SUFFIX1(".txt",	"text/plain",			"8bit");
-
-	SET_SUFFIX1(".php",	"text/html",			"8bit");
-	SET_SUFFIX1(".php3",	"text/html",			"8bit");
-	SET_SUFFIX1(".html3",	"text/html",			"8bit");
-	SET_SUFFIX1(".ht3",	"text/html",			"8bit");
-	SET_SUFFIX1(".phtml",	"text/html",			"8bit");
-	SET_SUFFIX1(".shtml",	"text/html",			"8bit");
-	SET_SUFFIX1(".sht",	"text/html",			"8bit");
-	SET_SUFFIX1(".htmlx",	"text/html",			"8bit");
-	SET_SUFFIX1(".htm",	"text/html",			"8bit");
-	SET_SUFFIX1(".html",	"text/html",			"8bit");
+	SET_SUFFIX1(".c",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".cc",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".c++",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".css",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".h",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".pl",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".text",	STR_PLAINTEXT,			"8bit");
+	SET_SUFFIX1(".txt",	STR_PLAINTEXT,			"8bit");
+
+	SET_SUFFIX1(".php",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".php3",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".html3",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".ht3",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".phtml",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".shtml",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".sht",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".htmlx",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".htm",	STR_HTML,			"8bit");
+	SET_SUFFIX1(".html",	STR_HTML,			"8bit");
 	/* *INDENT-ON* */
 
     } else {			/* LYSuffixRules */
@@ -1362,8 +1362,8 @@ void HTFileInit(void)
      * in a lynx.cfg or mime.types file to be usable for local HTML files at
      * all.  That includes many of the generated user interface pages.  - kw
      */
-    SET_SUFFIX1(".htm", "text/html", "8bit");
-    SET_SUFFIX1(".html", "text/html", "8bit");
+    SET_SUFFIX1(".htm", STR_HTML, "8bit");
+    SET_SUFFIX1(".html", STR_HTML, "8bit");
 #endif /* BUILTIN_SUFFIX_MAPS */
 
     if (LYisAbsPath(global_extension_map)) {
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index d1a624ec..fcaf6fa1 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYBookmark.c,v 1.76 2013/11/28 11:17:59 tom Exp $
+ * $LynxId: LYBookmark.c,v 1.77 2018/03/05 22:32:14 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAlert.h>
@@ -368,7 +368,7 @@ void save_bookmark_link(const char *address,
 	else
 	    fprintf(fp, "<META %s %s>\n",
 		    "http-equiv=\"content-type\"",
-		    "content=\"text/html;charset=iso-2022-jp\"");
+		    "content=\"" STR_HTML ";charset=iso-2022-jp\"");
 #else
 	LYAddMETAcharsetToFD(fp, -1);
 #endif /* !_WINDOWS */
diff --git a/src/LYCgi.c b/src/LYCgi.c
index f4c2bdec..d6c01372 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCgi.c,v 1.70 2016/11/24 16:38:22 tom Exp $
+ * $LynxId: LYCgi.c,v 1.71 2018/03/05 22:36:09 tom Exp $
  *                   Lynx CGI support                              LYCgi.c
  *                   ================
  *
@@ -670,7 +670,7 @@ static int LYLoadCGI(const char *arg,
 		execve(argv[0], argv, env);
 		exec_errno = errno;
 		PERROR("execve failed");
-		printf("Content-Type: text/plain\r\n\r\n");
+		printf("Content-Type: " STR_PLAINTEXT "\r\n\r\n");
 		if (!anAnchor->isHEAD) {
 		    printf("exec of %s failed", pgm);
 		    printf(": %s.\r\n", LYStrerror(exec_errno));
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index caeac733..12c50a08 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharUtils.c,v 1.130 2017/07/02 19:54:30 tom Exp $
+ * $LynxId: LYCharUtils.c,v 1.131 2018/03/05 22:32:14 tom Exp $
  *
  *  Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM
  *  ==========================================================================
@@ -540,7 +540,7 @@ void LYAddMETAcharsetToStream(HTStream *target, int disp_chndl)
 	disp_chndl = current_char_set;
 
     if (target != 0 && disp_chndl >= 0) {
-	HTSprintf0(&buf, "<META %s content=\"text/html;charset=%s\">\n",
+	HTSprintf0(&buf, "<META %s content=\"" STR_HTML ";charset=%s\">\n",
 		   "http-equiv=\"content-type\"",
 		   LYCharSet_UC[disp_chndl].MIMEname);
 	(*target->isa->put_string) (target, buf);
@@ -605,7 +605,7 @@ void LYAddMETAcharsetToFD(FILE *fd, int disp_chndl)
      * during the lifetime of the file (by toggling raw mode or changing the
      * display character set), so proceed.
      */
-    fprintf(fd, "<META %s content=\"text/html;charset=%s\">\n",
+    fprintf(fd, "<META %s content=\"" STR_HTML ";charset=%s\">\n",
 	    "http-equiv=\"content-type\"",
 	    LYCharSet_UC[disp_chndl].MIMEname);
 }
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 6ee3f81c..743b1879 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYGlobalDefs.h,v 1.142 2017/07/03 23:10:31 tom Exp $
+ * $LynxId: LYGlobalDefs.h,v 1.143 2018/03/05 09:49:59 tom Exp $
  *
  * global variable definitions
  */
@@ -300,6 +300,8 @@ extern "C" {
 
     extern int LYAcceptEncoding;
     extern int LYAcceptMedia;
+    extern int LYContentType;
+    extern const char *ContentTypes[];
     extern int LYTransferRate;	/* see enum TransferRate */
     extern int display_lines;	/* number of lines in the display */
     extern int dump_output_width;
diff --git a/src/LYHistory.c b/src/LYHistory.c
index c3b7dd47..227a5d64 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYHistory.c,v 1.89 2016/11/24 16:38:22 tom Exp $
+ * $LynxId: LYHistory.c,v 1.90 2018/03/05 22:32:14 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -1112,7 +1112,7 @@ static int LYLoadMESSAGES(const char *arg GCC_UNUSED,
     /*
      * This page is a list of messages in display character set.
      */
-    HTSprintf0(&buf, "<META %s content=\"text/html;charset=%s\">\n",
+    HTSprintf0(&buf, "<META %s content=\"" STR_HTML ";charset=%s\">\n",
 	       "http-equiv=\"content-type\"",
 	       LYCharSet_UC[current_char_set].MIMEname);
     PUTS(buf);
diff --git a/src/LYMail.c b/src/LYMail.c
index 218e4d3a..6795aa91 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMail.c,v 1.97 2014/12/30 22:16:41 Gisle.Vanem Exp $
+ * $LynxId: LYMail.c,v 1.98 2018/03/05 22:36:09 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTParse.h>
@@ -1318,7 +1318,7 @@ void reply_by_mail(char *mail_address,
 	if (!LYHaveCJKCharacterSet &&
 	    strncasecomp(LYCharSet_UC[current_char_set].MIMEname, "x-", 2)
 	    != 0) {
-	    HTSprintf(&header, "Content-Type: text/plain; charset=%s\n",
+	    HTSprintf(&header, "Content-Type: " STR_PLAINTEXT "; charset=%s\n",
 		      LYCharSet_UC[current_char_set].MIMEname);
 	}
 	StrAllocCat(header, "Content-Transfer-Encoding: 8bit\n");
diff --git a/src/LYMain.c b/src/LYMain.c
index 87f8489e..6fc4cd07 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.267 2018/03/01 22:27:37 Takeshi.Hataguchi Exp $
+ * $LynxId: LYMain.c,v 1.270 2018/03/05 22:32:14 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -548,6 +548,13 @@ BOOLEAN LYShowTransferRate = TRUE;
 int LYTransferRate = rateKB;
 int LYAcceptEncoding = encodingALL;
 int LYAcceptMedia = mediaOpt1;
+int LYContentType = contentTEXT;
+const char *ContentTypes[] =
+{
+    STR_BINARY,
+    STR_PLAINTEXT,
+    STR_HTML
+};
 char *LYTransferName = NULL;
 
 char *XLoadImageCommand = NULL;	/* Default image viewer for X */
@@ -3356,7 +3363,7 @@ static Config_Type Arg_Table [] =
    ),
    PARSE_FUN(
       "base",		4|FUNCTION_ARG,		base_fun,
-      "prepend a request URL comment and BASE tag to text/html\n\
+      "prepend a request URL comment and BASE tag to " STR_HTML "\n\
 outputs for -source dumps"
    ),
 #ifndef DISABLE_BIBP
@@ -3804,7 +3811,7 @@ terminated by '---' on a line"
    ),
    PARSE_SET(
       "preparsed",	4|SET_ARG,		LYPreparsedSource,
-      "show parsed text/html with -source and in source view\n\
+      "show parsed " STR_HTML " with -source and in source view\n\
 to visualize how lynx behaves with invalid HTML"
    ),
 #ifdef USE_PRETTYSRC
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index eee3d22e..05f5cbce 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMainLoop.c,v 1.238 2018/03/01 22:20:33 Takeshi.Hataguchi Exp $
+ * $LynxId: LYMainLoop.c,v 1.239 2018/03/05 22:38:53 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -6440,7 +6440,7 @@ int mainloop(void)
 			HTAtom *encoding;
 
 			if (HTFileFormat(temp, &encoding, NULL) != WWW_HTML) {
-			    HTSetSuffix(temp, "text/html", "8bit", 1.0);
+			    HTSetSuffix(temp, STR_HTML, "8bit", 1.0);
 			}
 		    }
 		    if ((cp = strrchr(temp, '/')) != NULL) {
@@ -8080,7 +8080,8 @@ static void exit_immediately_with_error_message(int state, int first_file)
     if (state == NULLFILE) {
 	HTSprintf0(&buf, "%s\n%s\n%s\n",
 		   NonNull(buf2),
-		   gettext("lynx: Start file could not be found or is not text/html or text/plain"),
+		   gettext("lynx: Start file could not be found or is not "
+			   STR_HTML " or " STR_PLAINTEXT),
 		   gettext("      Exiting..."));
     }
 
diff --git a/src/LYMap.c b/src/LYMap.c
index b34ae6d7..29b60f16 100644
--- a/src/LYMap.c
+++ b/src/LYMap.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMap.c,v 1.49 2016/11/24 16:38:22 tom Exp $
+ * $LynxId: LYMap.c,v 1.50 2018/03/05 22:32:14 tom Exp $
  *			Lynx Client-side Image MAP Support	       LYMap.c
  *			==================================
  *
@@ -550,7 +550,7 @@ static int LYLoadIMGmap(const char *arg,
 
     HTSprintf0(&buf, "<html>\n<head>\n");
     PUTS(buf);
-    HTSprintf0(&buf, "<META %s content=\"text/html;charset=%s\">\n",
+    HTSprintf0(&buf, "<META %s content=\"" STR_HTML ";charset=%s\">\n",
 	       "http-equiv=\"content-type\"",
 	       LYCharSet_UC[current_char_set].MIMEname);
     PUTS(buf);
diff --git a/src/LYOptions.c b/src/LYOptions.c
index eaee6be9..8b062834 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYOptions.c,v 1.174 2017/07/04 20:28:05 tom Exp $ */
+/* $LynxId: LYOptions.c,v 1.176 2018/03/05 22:18:05 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <HTTP.h>		/* 'reloading' flag */
@@ -2117,6 +2117,8 @@ typedef struct {
     const char *HtmlName;
 } OptValues;
 
+#define END_OPTIONS
+
 typedef struct {
     char *tag;
     char *value;
@@ -2132,7 +2134,7 @@ static OptValues bool_values[] =
 {
     {FALSE, N_("OFF"), "OFF"},
     {TRUE, N_("ON"), "ON"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *secure_string = "secure";
@@ -2162,7 +2164,7 @@ static OptValues exec_links_values[] =
 #ifndef NEVER_ALLOW_REMOTE_EXEC
     {EXEC_ALWAYS, N_("ALWAYS ON"), "ALWAYS ON"},
 #endif
-    {0, 0, 0}
+    END_OPTIONS
 };
 #endif /* ENABLE_OPTS_CHANGE_EXEC */
 
@@ -2182,7 +2184,7 @@ static OptValues keypad_mode_values[] =
     {FIELDS_ARE_NUMBERED,
      N_("Form fields are numbered"),
      "forms_numbered"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 static const char *lineedit_mode_string = RC_LINEEDIT_MODE;
 static const char *mail_address_string = RC_PERSONAL_MAIL_ADDRESS;
@@ -2197,7 +2199,7 @@ static OptValues search_type_values[] =
 {
     {FALSE, N_("Case insensitive"), "case_insensitive"},
     {TRUE, N_("Case sensitive"), "case_sensitive"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 #if defined(USE_SLANG) || defined(COLOR_CURSES)
@@ -2208,7 +2210,7 @@ static OptValues show_color_values[] =
     {SHOW_COLOR_OFF, off_string, off_string},
     {SHOW_COLOR_ON, on_string, on_string},
     {SHOW_COLOR_ALWAYS, always_string, always_string},
-    {0, 0, 0}
+    END_OPTIONS
 };
 #endif
 
@@ -2238,7 +2240,7 @@ static OptValues prompt_values[] =
     {FORCE_PROMPT_DFT, prompt_dft_string, prompt_dft_string},
     {FORCE_PROMPT_YES, prompt_yes_string, prompt_yes_string},
     {FORCE_PROMPT_NO, prompt_no_string, prompt_no_string},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *cookie_prompt_string = RC_FORCE_COOKIE_PROMPT;
@@ -2253,7 +2255,7 @@ static OptValues user_mode_values[] =
     {NOVICE_MODE, N_("Novice"), "Novice"},
     {INTERMEDIATE_MODE, N_("Intermediate"), "Intermediate"},
     {ADVANCED_MODE, N_("Advanced"), "Advanced"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *vi_keys_string = RC_VI_KEYS;
@@ -2268,7 +2270,7 @@ static OptValues visited_links_values[] =
     {VISITED_LINKS_AS_LATEST, N_("By Last Visit"), "last_visited"},
     {VISITED_LINKS_AS_LATEST | VISITED_LINKS_REVERSE,
      N_("By Last Visit Reversed"), "last_visited_reversed"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 /*
@@ -2280,7 +2282,7 @@ static OptValues DTD_type_values[] =
 	/* Old_DTD variable */
     {TRUE, N_("relaxed (TagSoup mode)"), "tagsoup"},
     {FALSE, N_("strict (SortaSGML mode)"), "sortasgml"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *bad_html_string = RC_BAD_HTML;
@@ -2290,7 +2292,7 @@ static OptValues bad_html_values[] =
     {BAD_HTML_TRACE, N_("Add to trace-file"), "trace"},
     {BAD_HTML_MESSAGE, N_("Add to LYNXMESSAGES"), "message"},
     {BAD_HTML_WARN, N_("Warn, point to trace-file"), "warn"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *select_popups_string = RC_SELECT_POPUPS;
@@ -2305,7 +2307,7 @@ static OptValues verbose_images_type_values[] =
 	/* verbose_img variable */
     {FALSE, N_("OFF"), "OFF"},
     {TRUE, N_("show filename"), "ON"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *collapse_br_tags_string = RC_COLLAPSE_BR_TAGS;
@@ -2314,7 +2316,7 @@ static OptValues collapse_br_tags_values[] =
 	/* LYCollapseBRs variable */
     {FALSE, N_("OFF"), "OFF"},
     {TRUE, N_("collapse"), "ON"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *trim_blank_lines_string = RC_TRIM_BLANK_LINES;
@@ -2323,7 +2325,7 @@ static OptValues trim_blank_lines_values[] =
 	/* LYtrimBlankLines variable */
     {FALSE, N_("OFF"), "OFF"},
     {TRUE, N_("trim-lines"), "ON"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 /*
@@ -2335,7 +2337,7 @@ static OptValues mbm_values[] =
     {MBM_OFF, N_("OFF"), "OFF"},
     {MBM_STANDARD, N_("STANDARD"), "STANDARD"},
     {MBM_ADVANCED, N_("ADVANCED"), "ADVANCED"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *single_bookmark_string = RC_BOOKMARK_FILE;
@@ -2371,7 +2373,7 @@ static OptValues dired_list_values[] =
     {DIRS_FIRST, N_("Directories first"), "dired_dir"},
     {FILES_FIRST, N_("Files first"), "dired_files"},
     {MIXED_STYLE, N_("Mixed style"), "dired_mixed"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 #ifdef LONG_LIST
@@ -2387,7 +2389,7 @@ static OptValues dired_sort_values[] =
     {ORDER_BY_USER, N_("By User"), "dired_by_user"},
     {ORDER_BY_GROUP, N_("By Group"), "dired_by_group"},
 #endif
-    {0, 0, 0}
+    END_OPTIONS
 };
 #endif /* LONG_LIST */
 #endif /* DIRED_SUPPORT */
@@ -2402,7 +2404,7 @@ static OptValues ftp_sort_values[] =
     {FILE_BY_TYPE, N_("By Type"), "ftp_by_type"},
     {FILE_BY_SIZE, N_("By Size"), "ftp_by_size"},
     {FILE_BY_DATE, N_("By Date"), "ftp_by_date"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 #endif
 
@@ -2422,10 +2424,19 @@ static OptValues rate_values[] =
 #ifdef USE_PROGRESSBAR
     {rateBAR, N_("Show progressbar"), "rate_bar"},
 #endif
-    {0, 0, 0}
+    END_OPTIONS
 };
 #endif /* USE_READPROGRESS */
 
+static const char *preferred_content_string = RC_PREFERRED_CONTENT_TYPE;
+static OptValues content_values[] =
+{
+    {contentBINARY, STR_BINARY, STR_BINARY},
+    {contentTEXT, STR_PLAINTEXT, STR_PLAINTEXT},
+    {contentHTML, STR_HTML, STR_HTML},
+    END_OPTIONS
+};
+
 /*
  * Presentation (MIME) types used in "Accept".
  */
@@ -2437,7 +2448,7 @@ static OptValues media_values[] =
     {mediaOpt3, N_("Also accept user's types"), "media_opt3"},
     {mediaOpt4, N_("Also accept system's types"), "media_opt4"},
     {mediaALL, N_("Accept all types"), "media_all"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *preferred_encoding_string = RC_PREFERRED_ENCODING;
@@ -2455,7 +2466,7 @@ static OptValues encoding_values[] =
     {encodingBZIP2, N_("bzip2"), "encoding_bzip2"},
 #endif
     {encodingALL, N_("All"), "encoding_all"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 /*
@@ -2466,7 +2477,7 @@ static OptValues http_protocol_values[] =
 {
     {HTTP_1_0, N_("HTTP 1.0"), "HTTP_1_0"},
     {HTTP_1_1, N_("HTTP 1.1"), "HTTP_1_1"},
-    {0, 0, 0}
+    END_OPTIONS
 };
 
 static const char *preferred_doc_char_string = RC_PREFERRED_CHARSET;
@@ -3274,6 +3285,11 @@ int postoptions(DocInfo *newdoc)
 	}
 #endif /* USE_READPROGRESS */
 
+	/* Preferred Content Type: SELECT */
+	if (!strcmp(data[i].tag, preferred_content_string)) {
+	    GetOptValues(content_values, data[i].value, &LYContentType);
+	}
+
 	/* Preferred Media Type: SELECT */
 	if (!strcmp(data[i].tag, preferred_media_string)) {
 	    GetOptValues(media_values, data[i].value, &LYAcceptMedia);
@@ -4079,6 +4095,12 @@ static int gen_options(char **newfile)
 		 NonNull(anonftp_password), text_len, "");
 #endif
 
+    /* Preferred content type: SELECT */
+    PutLabel(fp0, gettext("Preferred content type"), preferred_content_string);
+    BeginSelect(fp0, preferred_content_string);
+    PutOptValues(fp0, LYContentType, content_values);
+    EndSelect(fp0);
+
     /* Preferred media type: SELECT */
     PutLabel(fp0, gettext("Preferred media type"), preferred_media_string);
     BeginSelect(fp0, preferred_media_string);
diff --git a/src/LYPrint.c b/src/LYPrint.c
index 9149956e..103a4fd6 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYPrint.c,v 1.105 2014/08/24 10:41:17 tom Exp $
+ * $LynxId: LYPrint.c,v 1.106 2018/03/05 22:38:53 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -153,7 +153,7 @@ static void SetupFilename(bstring **filename,
 	&& (cp = strrchr((*filename)->str, '.')) != NULL) {
 	format = HTFileFormat((*filename)->str, &encoding, NULL);
 	CTRACE((tfp, "... format %s\n", format->name));
-	if (!strcasecomp(format->name, "text/html") ||
+	if (!strcasecomp(format->name, STR_HTML) ||
 	    !IsUnityEnc(encoding)) {
 	    (*filename)->len = (int) (cp - (*filename)->str);
 	    BStrCat0(*filename, TEXT_SUFFIX);
@@ -437,7 +437,8 @@ static void send_file_to_file(DocInfo *newdoc,
 	    strncasecomp(disp_charset, "x-", 2) == 0) {
 	} else {
 	    fprintf(outfile_fp,
-		    "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=%s\">\n\n",
+		    "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"" STR_HTML
+		    "; charset=%s\">\n\n",
 		    disp_charset);
 	}
     }
@@ -592,7 +593,7 @@ static void send_file_to_mail(DocInfo *newdoc,
 	     * Add Content-Type, Content-Location, and Content-Base headers for
 	     * HTML source.  - FM
 	     */
-	    fprintf(hfd, "Content-Type: text/html");
+	    fprintf(hfd, "Content-Type: " STR_HTML);
 	    if (disp_charset != NULL) {
 		fprintf(hfd, "; charset=%s\n", disp_charset);
 	    } else {
@@ -607,7 +608,7 @@ static void send_file_to_mail(DocInfo *newdoc,
 	     */
 	    if (disp_charset != NULL) {
 		fprintf(hfd,
-			"Content-Type: text/plain; charset=%s\n",
+			"Content-Type: " STR_PLAINTEXT "; charset=%s\n",
 			disp_charset);
 	    }
 	}
@@ -733,7 +734,7 @@ static void send_file_to_mail(DocInfo *newdoc,
 	 * Add Content-Type, Content-Location, and Content-Base headers for
 	 * HTML source.  - FM
 	 */
-	fprintf(outfile_fp, "Content-Type: text/html");
+	fprintf(outfile_fp, "Content-Type: " STR_HTML);
 	if (disp_charset != NULL) {
 	    fprintf(outfile_fp, "; charset=%s\n", disp_charset);
 	} else {
@@ -746,7 +747,7 @@ static void send_file_to_mail(DocInfo *newdoc,
 	 */
 	if (disp_charset != NULL) {
 	    fprintf(outfile_fp,
-		    "Content-Type: text/plain; charset=%s\n",
+		    "Content-Type: " STR_PLAINTEXT "; charset=%s\n",
 		    disp_charset);
 	}
     }
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 6552ae57..25c7d469 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYReadCFG.c,v 1.190 2017/07/03 23:21:43 tom Exp $
+ * $LynxId: LYReadCFG.c,v 1.191 2018/03/05 01:57:19 tom Exp $
  */
 #ifndef NO_RULES
 #include <HTRules.h>
@@ -1658,6 +1658,7 @@ static Config_Type Config_Table [] =
      PARSE_STR(RC_PERSONAL_MAILCAP,     personal_type_map),
      PARSE_LST(RC_POSITIONABLE_EDITOR,  positionable_editor),
      PARSE_STR(RC_PREFERRED_CHARSET,    pref_charset),
+     PARSE_ENU(RC_PREFERRED_CONTENT_TYPE, LYContentType, tbl_preferred_content),
      PARSE_ENU(RC_PREFERRED_ENCODING,   LYAcceptEncoding, tbl_preferred_encoding),
      PARSE_STR(RC_PREFERRED_LANGUAGE,   language),
      PARSE_ENU(RC_PREFERRED_MEDIA_TYPES, LYAcceptMedia, tbl_preferred_media),
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index e42d3f65..221fc0bb 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYrcFile.c,v 1.99 2017/07/04 20:30:03 tom Exp $ */
+/* $LynxId: LYrcFile.c,v 1.101 2018/03/05 22:18:05 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <LYUtils.h>
@@ -90,6 +90,13 @@ Config_Enum tbl_multi_bookmarks[] = {
     { NULL,		-1 }
 };
 
+Config_Enum tbl_preferred_content[] = {
+    { STR_BINARY,	contentBINARY },
+    { STR_PLAINTEXT,	contentTEXT },
+    { STR_HTML,		contentHTML },
+    { NULL,		-1 }
+};
+
 /* the names in this table are used as lowercase in HTTP.c */
 Config_Enum tbl_preferred_encoding[] = {
     { "none",		encodingNONE },
@@ -516,6 +523,8 @@ according to the Accept-Charset header, then the server SHOULD send\n\
 an error response, though the sending of an unacceptable response\n\
 is also allowed.\n\
 ")),
+    MAYBE_ENU(RC_PREFERRED_CONTENT_TYPE, LYContentType,     tbl_preferred_content,
+	      MSG_ENABLE_LYNXRC),
     MAYBE_ENU(RC_PREFERRED_ENCODING,    LYAcceptEncoding,   tbl_preferred_encoding,
 	      MSG_ENABLE_LYNXRC),
     PARSE_STR(RC_PREFERRED_LANGUAGE,    language, N_("\
diff --git a/src/LYrcFile.h b/src/LYrcFile.h
index dd2f99d2..0f6e33cc 100644
--- a/src/LYrcFile.h
+++ b/src/LYrcFile.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYrcFile.h,v 1.49 2017/07/03 23:20:33 tom Exp $
+ * $LynxId: LYrcFile.h,v 1.50 2018/03/05 02:00:13 tom Exp $
  */
 #ifndef LYRCFILE_H
 #define LYRCFILE_H
@@ -188,6 +188,7 @@
 #define RC_PERSONAL_MAIL_NAME           "personal_mail_name"
 #define RC_POSITIONABLE_EDITOR          "positionable_editor"
 #define RC_PREFERRED_CHARSET            "preferred_charset"
+#define RC_PREFERRED_CONTENT_TYPE       "preferred_content_type"
 #define RC_PREFERRED_ENCODING           "preferred_encoding"
 #define RC_PREFERRED_LANGUAGE           "preferred_language"
 #define RC_PREFERRED_MEDIA_TYPES        "preferred_media_types"
@@ -290,6 +291,7 @@
 extern Config_Enum tbl_force_prompt[];
 extern Config_Enum tbl_keypad_mode[];
 extern Config_Enum tbl_multi_bookmarks[];
+extern Config_Enum tbl_preferred_content[];
 extern Config_Enum tbl_preferred_encoding[];
 extern Config_Enum tbl_preferred_media[];
 extern Config_Enum tbl_transfer_rate[];