aboutsummaryrefslogtreecommitdiffstats
path: root/WWW/Library
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2022-04-01 07:55:02 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2022-04-01 07:55:02 +0000
commit4a784a7f73d7e06d92fcd4b8844dc0ef00f41050 (patch)
tree0c5c31f1170d5599f11f19a889ba495ce1ebd340 /WWW/Library
parent04fd5be50c369e986053e7bfcc4b9eb2fa5ac937 (diff)
downloadlynx-snapshots-4a784a7f73d7e06d92fcd4b8844dc0ef00f41050.tar.gz
snapshot of project "lynx", label v2-9-0dev_10e
Diffstat (limited to 'WWW/Library')
-rw-r--r--WWW/Library/Implementation/HTFTP.c10
-rw-r--r--WWW/Library/Implementation/HTFile.c17
-rw-r--r--WWW/Library/Implementation/HTFormat.c18
-rw-r--r--WWW/Library/Implementation/HTFormat.h24
-rw-r--r--WWW/Library/Implementation/HTGopher.c4
-rw-r--r--WWW/Library/Implementation/HTNews.c6
-rw-r--r--WWW/Library/Implementation/HTTP.c16
7 files changed, 54 insertions, 41 deletions
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index cb058cc9..241f27cc 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFTP.c,v 1.144 2022/03/17 20:04:17 tom Exp $
+ * $LynxId: HTFTP.c,v 1.147 2022/04/01 00:18:09 tom Exp $
*
* File Transfer Protocol (FTP) Client
* for a WorldWideWeb browser
@@ -3589,8 +3589,8 @@ int HTFTPLoad(const char *name,
format = HTFileFormat(filename, &encoding, NULL);
}
format = HTCharsetFormat(format, anchor, -1);
- binary = (BOOL) (encoding != HTAtom_for("8bit") &&
- encoding != HTAtom_for("7bit"));
+ binary = (BOOL) (encoding != WWW_ENC_8BIT &&
+ encoding != WWW_ENC_7BIT);
if (!binary &&
/*
* Force binary if we're in source, download or dump mode and this is
@@ -3599,8 +3599,8 @@ int HTFTPLoad(const char *name,
* EBCDIC. - FM
*/
(format_out == WWW_SOURCE ||
- format_out == HTAtom_for("www/download") ||
- format_out == HTAtom_for("www/dump")) &&
+ format_out == WWW_DOWNLOAD ||
+ format_out == WWW_DUMP) &&
(server_type != CMS_SERVER))
binary = TRUE;
if (!binary && type && *type == 'I') {
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 4da14c1a..33d10ff7 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFile.c,v 1.153 2022/03/29 23:48:38 tom Exp $
+ * $LynxId: HTFile.c,v 1.156 2022/04/01 00:17:51 tom Exp $
*
* File Access HTFile.c
* ===========
@@ -1583,7 +1583,7 @@ static BOOL view_structured(HTFormat format_out)
#ifdef USE_PRETTYSRC
if (psrc_view
- || (format_out == HTAtom_for("www/dump")))
+ || (format_out == WWW_DUMP))
result = TRUE;
#else
if (format_out == WWW_SOURCE)
@@ -2440,8 +2440,7 @@ static BOOL isBzip2Stream(FILE *fp)
#endif
#ifdef USE_BROTLI
-static FILE *
-brotli_open(const char *localname, const char *mode)
+static FILE *brotli_open(const char *localname, const char *mode)
{
CTRACE((tfp, "brotli_open file=%s, mode=%s\n", localname, mode));
return fopen(localname, mode);
@@ -2531,7 +2530,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
CompressFileType method = HTEncodingToCompressType(HTAtom_name(myEncoding));
#endif
-#define isDOWNLOAD(m) (strcmp(format_out->name, "www/download") && (method == m))
+#define isDOWNLOAD(m) (strcmp(format_out->name, STR_DOWNLOAD) && (method == m))
#ifdef USE_ZLIB
if (isDOWNLOAD(cftGzip)) {
if (isGzipStream(fp)) {
@@ -2606,7 +2605,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
case cftDeflate:
StrAllocCopy(anchor->content_encoding, "x-deflate");
#ifdef USE_ZLIB
- if (strcmp(format_out->name, "www/download") != 0) {
+ if (strcmp(format_out->name, STR_DOWNLOAD) != 0) {
if (isDeflateStream(fp)) {
zzfp = fp;
fp = 0;
@@ -2623,7 +2622,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
case cftGzip:
StrAllocCopy(anchor->content_encoding, "x-gzip");
#ifdef USE_ZLIB
- if (strcmp(format_out->name, "www/download") != 0) {
+ if (strcmp(format_out->name, STR_DOWNLOAD) != 0) {
if (isGzipStream(fp)) {
fclose(fp);
fp = 0;
@@ -2641,7 +2640,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
case cftBzip2:
StrAllocCopy(anchor->content_encoding, "x-bzip2");
#ifdef USE_BZLIB
- if (strcmp(format_out->name, "www/download") != 0) {
+ if (strcmp(format_out->name, STR_DOWNLOAD) != 0) {
if (isBzip2Stream(fp)) {
fclose(fp);
fp = 0;
@@ -2659,7 +2658,7 @@ static int decompressAndParse(HTParentAnchor *anchor,
case cftBrotli:
StrAllocCopy(anchor->content_encoding, "x-brotli");
#ifdef USE_BROTLI
- if (strcmp(format_out->name, "www/download") != 0) {
+ if (strcmp(format_out->name, STR_DOWNLOAD) != 0) {
fclose(fp);
fp = 0;
brfp = brotli_open(localname, BIN_R);
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index 4f48e5d5..a8303878 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFormat.c,v 1.95 2022/03/30 00:29:50 tom Exp $
+ * $LynxId: HTFormat.c,v 1.96 2022/03/31 23:39:38 tom Exp $
*
* Manage different file formats HTFormat.c
* =============================
@@ -1173,6 +1173,8 @@ static const char *zError(int status)
*/
static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
{
+#undef THIS_FUNC
+#define THIS_FUNC "HTZzFileCopy"
static char dummy_head[1 + 1] =
{
0x8 + 0x7 * 0x10,
@@ -1196,7 +1198,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
memset(&s, 0, sizeof(s));
status = inflateInit(&s);
if (status != Z_OK) {
- CTRACE((tfp, "HTZzFileCopy inflateInit() %s\n", zError(status)));
+ CTRACE((tfp, THIS_FUNC " inflateInit() %s\n", zError(status)));
exit_immediately(EXIT_FAILURE);
}
s.avail_in = 0;
@@ -1229,7 +1231,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
} else if (status == Z_DATA_ERROR && !retry++) {
status = inflateReset(&s);
if (status != Z_OK) {
- CTRACE((tfp, "HTZzFileCopy inflateReset() %s\n", zError(status)));
+ CTRACE((tfp, THIS_FUNC " inflateReset() %s\n", zError(status)));
rv = -1;
break;
}
@@ -1240,7 +1242,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
s.avail_in = (unsigned) len;
continue;
} else if (status != Z_OK) {
- CTRACE((tfp, "HTZzFileCopy inflate() %s\n", zError(status)));
+ CTRACE((tfp, THIS_FUNC " inflate() %s\n", zError(status)));
rv = bytes ? HT_PARTIAL_CONTENT : -1;
break;
} else if (s.avail_out == 0) {
@@ -1265,6 +1267,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
inflateEnd(&s);
HTFinishDisplayPartial();
return rv;
+#undef THIS_FUNC
}
#endif /* USE_ZLIB */
@@ -1978,7 +1981,7 @@ int HTParseBzFile(HTFormat rep_in,
* HT_LOADED Normal end of file indication on reading.
*
* State of file and target stream on return:
- * always bzfp closed; target freed, aborted, or NULL.
+ * always brfp closed; target freed, aborted, or NULL.
*/
int HTParseBrFile(HTFormat rep_in,
HTFormat format_out,
@@ -1986,6 +1989,8 @@ int HTParseBrFile(HTFormat rep_in,
FILE *brfp,
HTStream *sink)
{
+#undef THIS_FUNC
+#define THIS_FUNC "HTParseBrFile"
HTStream *stream;
HTStreamClass targetClass;
int rv;
@@ -2003,7 +2008,7 @@ int HTParseBrFile(HTFormat rep_in,
} else {
HTSprintf0(&buffer, CANNOT_CONVERT_I_TO_O,
HTAtom_name(rep_in), HTAtom_name(format_out));
- CTRACE((tfp, "HTFormat(in HTParseBzFile): %s\n", buffer));
+ CTRACE((tfp, "HTFormat(in " THIS_FUNC "): %s\n", buffer));
rv = HTLoadError(sink, 501, buffer);
FREE(buffer);
result = rv;
@@ -2035,6 +2040,7 @@ int HTParseBrFile(HTFormat rep_in,
}
}
return result;
+#undef THIS_FUNC
}
#endif /* USE_BROTLI */
diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h
index 76a8b253..835daef3 100644
--- a/WWW/Library/Implementation/HTFormat.h
+++ b/WWW/Library/Implementation/HTFormat.h
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTFormat.h,v 1.38 2022/03/28 08:09:44 tom Exp $
+ * $LynxId: HTFormat.h,v 1.42 2022/04/01 07:54:14 tom Exp $
*
* HTFormat: The format manager in the WWW Library
* MANAGE DIFFERENT DOCUMENT FORMATS
@@ -46,10 +46,8 @@ extern "C" {
*/
/* Internal ones */
-/* #define WWW_SOURCE HTAtom_for("www/source") */
-/* Whatever it was originally */
- extern HTAtom *WWW_SOURCE;
- /* calculated once, heavy used */
+#define STR_SOURCE "www/source"
+ extern HTAtom *WWW_SOURCE; /* calculated once, heavy used */
/*
@@ -57,7 +55,8 @@ extern "C" {
convert to www/present, you present the material to the user.
*/
-#define WWW_PRESENT HTAtom_for("www/present") /* The user's perception */
+#define STR_PRESENT "www/present"
+#define WWW_PRESENT HTAtom_for(STR_PRESENT) /* The user's perception */
#define WWW_DEBUG HTAtom_for("www/debug")
/*
@@ -102,6 +101,15 @@ extern "C" {
#endif
/*
+ * Miscellaneous internal MIME types.
+ */
+#define STR_DOWNLOAD "www/download"
+#define WWW_DOWNLOAD HTAtom_for(STR_DOWNLOAD)
+
+#define STR_DUMP "www/dump"
+#define WWW_DUMP HTAtom_for(STR_DUMP)
+
+/*
These are regular MIME types. HTML is assumed to be added by the W3 code.
application/octet-stream was mistakenly application/binary in earlier libwww
@@ -527,7 +535,7 @@ HTParseBzFile: Parse a bzip2'ed File through a file pointer
#ifdef USE_BROTLI
/*
-HTParseBzFile: Parse a brotli'ed File through a file pointer
+HTParseBrFile: Parse a brotli'ed File through a file pointer
This routine is called by protocols modules to load an object. uses
HTStreamStack and HTBrFileCopy. Returns HT_LOADED if successful, can also
@@ -536,7 +544,7 @@ HTParseBzFile: Parse a brotli'ed File through a file pointer
extern int HTParseBrFile(HTFormat format_in,
HTFormat format_out,
HTParentAnchor *anchor,
- FILE * brfp,
+ FILE *brfp,
HTStream *sink);
#endif /* USE_BROTLI */
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 4f9e02ba..03141790 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTGopher.c,v 1.76 2021/07/25 23:51:30 tom Exp $
+ * $LynxId: HTGopher.c,v 1.77 2022/04/01 00:18:09 tom Exp $
*
* GOPHER ACCESS HTGopher.c
* =============
@@ -279,7 +279,7 @@ static void parse_menu(const char *arg GCC_UNUSED,
* Gopher menu.
*/
if (dump_output_immediately
- && HTOutputFormat == HTAtom_for("www/dump")) {
+ && HTOutputFormat == WWW_DUMP) {
if (ich == '<') {
ss = "&lt;";
} else if (ich == '>') {
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index ad528eae..a1b94dc1 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTNews.c,v 1.79 2022/03/12 15:45:16 tom Exp $
+ * $LynxId: HTNews.c,v 1.81 2022/04/01 00:18:22 tom Exp $
*
* NEWS ACCESS HTNews.c
* ===========
@@ -2176,8 +2176,8 @@ static int HTLoadNews(const char *arg,
#endif /* USE_SSL */
diagnostic = (format_out == WWW_SOURCE || /* set global flag */
- format_out == HTAtom_for("www/download") ||
- format_out == HTAtom_for("www/dump"));
+ format_out == WWW_DOWNLOAD ||
+ format_out == WWW_DUMP);
rawtext = NO;
CTRACE((tfp, "HTNews: Looking for %s\n", arg));
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 46f1924e..e3c5a4ae 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
/*
- * $LynxId: HTTP.c,v 1.182 2022/03/17 20:02:41 tom Exp $
+ * $LynxId: HTTP.c,v 1.183 2022/04/01 00:10:19 tom Exp $
*
* HyperText Transfer Protocol - Client implementation HTTP.c
* ===========================
@@ -2244,7 +2244,7 @@ static int HTLoadHTTP(const char *arg,
goto clean_up;
}
if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation request
* for interactive users. - FM
@@ -2279,7 +2279,7 @@ static int HTLoadHTTP(const char *arg,
goto clean_up;
}
if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation request
* for interactive users. - FM
@@ -2442,7 +2442,7 @@ static int HTLoadHTTP(const char *arg,
} else if (!(traversal || dump_output_immediately) &&
HTConfirm(gettext("Show the 407 message body?"))) {
if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation
* request for interactive users. - FM
@@ -2495,7 +2495,7 @@ static int HTLoadHTTP(const char *arg,
goto clean_up;
}
if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation request
* for interactive users. - FM
@@ -2526,7 +2526,7 @@ static int HTLoadHTTP(const char *arg,
goto clean_up;
}
if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation request for
* interactive users. - FM
@@ -2548,7 +2548,7 @@ static int HTLoadHTTP(const char *arg,
goto clean_up;
}
if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation request for
* interactive users. - FM
@@ -2606,7 +2606,7 @@ static int HTLoadHTTP(const char *arg,
if (!sink)
sink = HTErrorStream();
} else if (!dump_output_immediately &&
- format_out == HTAtom_for("www/download")) {
+ format_out == WWW_DOWNLOAD) {
/*
* Convert a download request to a presentation request for
* interactive users. - FM