aboutsummaryrefslogtreecommitdiffstats
path: root/WWW/Library
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2018-03-05 22:52:26 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2018-03-05 22:52:26 +0000
commit9b7b3896381522f1b70c8e7d803db8103cccd7a1 (patch)
tree4ba8face05ba92aa301627ee2f1709494b7f4fad /WWW/Library
parent2c91be6158b3242e323e3c52fd585d0658cbf4be (diff)
downloadlynx-snapshots-9b7b3896381522f1b70c8e7d803db8103cccd7a1.tar.gz
snapshot of project "lynx", label v2-8-9dev_16o
Diffstat (limited to 'WWW/Library')
-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
6 files changed, 35 insertions, 37 deletions
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") &&