diff options
| author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-04-01 07:55:02 +0000 |
|---|---|---|
| committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-04-01 07:55:02 +0000 |
| commit | 4a784a7f73d7e06d92fcd4b8844dc0ef00f41050 (patch) | |
| tree | 0c5c31f1170d5599f11f19a889ba495ce1ebd340 | |
| parent | 04fd5be50c369e986053e7bfcc4b9eb2fa5ac937 (diff) | |
| download | lynx-snapshots-4a784a7f73d7e06d92fcd4b8844dc0ef00f41050.tar.gz | |
snapshot of project "lynx", label v2-9-0dev_10e
| -rw-r--r-- | CHANGES | 5 | ||||
| -rwxr-xr-x | PACKAGE/debian/rules | 3 | ||||
| -rw-r--r-- | PACKAGE/lynx.spec | 6 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTFTP.c | 10 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTFile.c | 17 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTFormat.c | 18 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTFormat.h | 24 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTGopher.c | 4 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTNews.c | 6 | ||||
| -rw-r--r-- | WWW/Library/Implementation/HTTP.c | 16 | ||||
| -rw-r--r-- | src/HTFWriter.c | 19 | ||||
| -rw-r--r-- | src/HTInit.c | 79 | ||||
| -rw-r--r-- | src/LYMain.c | 12 | ||||
| -rw-r--r-- | src/LYMainLoop.c | 12 |
14 files changed, 126 insertions, 105 deletions
@@ -1,9 +1,10 @@ --- $LynxId: CHANGES,v 1.1106 2022/03/29 23:53:57 tom Exp $ +-- $LynxId: CHANGES,v 1.1107 2022/03/31 23:30:44 tom Exp $ =============================================================================== Changes since Lynx 2.8 release =============================================================================== -2022-03-29 (2.9.0dev.11) +2022-03-31 (2.9.0dev.11) +* add ".br", ".lz", ".lzip", and ".xz" to binary-suffixes list -TD * changes for using brotli stream decompression -TD * changes for working with SOCKS5 on Windows 10 -GV, -TD * fix a few coverity and clang warnings -TD diff --git a/PACKAGE/debian/rules b/PACKAGE/debian/rules index 4d024eae..92dc7fc4 100755 --- a/PACKAGE/debian/rules +++ b/PACKAGE/debian/rules @@ -1,5 +1,5 @@ #!/usr/bin/make -f -# $LynxId: rules,v 1.16 2021/07/31 10:23:45 tom Exp $ +# $LynxId: rules,v 1.17 2022/03/30 00:33:39 tom Exp $ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -99,6 +99,7 @@ configure-stamp: --enable-source-cache \ --enable-syslog \ --enable-warnings \ + --with-brotli \ --with-bzlib \ --with-gnutls=/usr \ --with-screen=ncursesw6dev \ diff --git a/PACKAGE/lynx.spec b/PACKAGE/lynx.spec index bd0dfe5b..4c75cf5f 100644 --- a/PACKAGE/lynx.spec +++ b/PACKAGE/lynx.spec @@ -1,4 +1,4 @@ -# $LynxId: lynx.spec,v 1.65 2021/11/04 20:00:16 tom Exp $ +# $LynxId: lynx.spec,v 1.66 2022/03/30 00:34:53 tom Exp $ Summary: A text-based Web browser Name: lynx-dev Version: 2.9.0 @@ -79,6 +79,7 @@ HTTP, FTP, WAIS, and NNTP servers. --enable-source-cache \ --enable-syslog \ --enable-warnings \ + --with-brotli \ --with-bzlib \ --with-screen=ncursesw6dev \ --with-ssl \ @@ -113,6 +114,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Mar 29 2022 Thomas E. Dickey +- add brotli compression + * Sat Jul 31 2021 Thomas E. Dickey - align configure-options with Debian package, removing some which are not needed because they correspond to the default settings. 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 = "<"; } 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 diff --git a/src/HTFWriter.c b/src/HTFWriter.c index cf5226ad..9ec2bb55 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFWriter.c,v 1.120 2022/03/28 00:04:50 tom Exp $ + * $LynxId: HTFWriter.c,v 1.123 2022/04/01 00:15:05 tom Exp $ * * FILE WRITER HTFWrite.h * =========== @@ -317,14 +317,9 @@ static void HTFWriter_free(HTStream *me) } else #endif /* USE_BROTLI */ { - char FIXME[1024]; - - sprintf(FIXME, "brotli -d -j -f %s", path); path[len - 3] = '\0'; (void) remove(path); - system(FIXME); } - CTRACE((tfp, "FIXME %s@%d\n", __FILE__, __LINE__)); } else if (len > 2 && !strcasecomp(&path[len - 1], "Z")) { path[len - 2] = '\0'; (void) remove(path); @@ -339,7 +334,7 @@ static void HTFWriter_free(HTStream *me) /* * Uncompress it. - FM */ - if (me->end_command && me->end_command[0]) + if (!isEmpty(me->end_command)) LYSystem(me->end_command); found = LYCanReadFile(me->anchor->FileCache); } @@ -480,7 +475,7 @@ static void HTFWriter_free(HTStream *me) me->sink); } if (dump_output_immediately && - me->output_format == HTAtom_for("www/present")) { + me->output_format == WWW_PRESENT) { FREE(addr); (void) remove(me->anchor->FileCache); FREE(me->anchor->FileCache); @@ -881,13 +876,13 @@ HTStream *HTSaveToFile(HTPresentation *pres, if (dump_output_immediately) { ret_obj->fp = stdout; /* stdout */ - if (HTOutputFormat == HTAtom_for("www/download")) + if (HTOutputFormat == WWW_DOWNLOAD) goto Prepend_BASE; return ret_obj; } LYCancelDownload = FALSE; - if (HTOutputFormat != HTAtom_for("www/download")) { + if (HTOutputFormat != WWW_DOWNLOAD) { if (traversal || (no_download && !override_no_download && no_disk_save)) { if (!traversal) { @@ -1196,8 +1191,8 @@ HTStream *HTCompressed(HTPresentation *pres, if (can_present == FALSE || /* no presentation mapping */ uncompress_mask == NULL || /* not gzip or compress */ StrChr(anchor->content_type, ';') || /* wrong charset */ - HTOutputFormat == HTAtom_for("www/download") || /* download */ - !strcasecomp(pres->rep_out->name, "www/download") || /* download */ + HTOutputFormat == WWW_DOWNLOAD || /* download */ + !strcasecomp(pres->rep_out->name, STR_DOWNLOAD) || /* download */ (traversal && /* only handle html or plain text for traversals */ strcasecomp(anchor->content_type, STR_HTML) && strcasecomp(anchor->content_type, STR_PLAINTEXT))) { diff --git a/src/HTInit.c b/src/HTInit.c index c4517625..4aa38e0c 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTInit.c,v 1.92 2020/01/21 22:20:09 tom Exp $ + * $LynxId: HTInit.c,v 1.97 2022/04/01 07:55:02 tom Exp $ * * Configuration-specific Initialization HTInit.c * ---------------------------------------- @@ -99,46 +99,46 @@ void HTFormatInit(void) * Add our header handlers. */ SET_INTERNL("message/x-http-redirection", "*", HTMIMERedirect, 2.0); - SET_INTERNL("message/x-http-redirection", "www/present", HTMIMERedirect, 2.0); + SET_INTERNL("message/x-http-redirection", STR_PRESENT, HTMIMERedirect, 2.0); SET_INTERNL("message/x-http-redirection", "www/debug", HTMIMERedirect, 1.0); - SET_INTERNL("www/mime", "www/present", HTMIMEConvert, 1.0); - SET_INTERNL("www/mime", "www/download", HTMIMEConvert, 1.0); - SET_INTERNL("www/mime", "www/source", HTMIMEConvert, 1.0); - SET_INTERNL("www/mime", "www/dump", HTMIMEConvert, 1.0); + SET_INTERNL("www/mime", STR_PRESENT, HTMIMEConvert, 1.0); + SET_INTERNL("www/mime", STR_DOWNLOAD, HTMIMEConvert, 1.0); + SET_INTERNL("www/mime", STR_SOURCE, HTMIMEConvert, 1.0); + SET_INTERNL("www/mime", STR_DUMP, HTMIMEConvert, 1.0); /* * Add our compressed file handlers. */ - SET_INTERNL("www/compressed", "www/download", HTCompressed, 1.0); - SET_INTERNL("www/compressed", "www/present", HTCompressed, 1.0); - SET_INTERNL("www/compressed", "www/source", HTCompressed, 1.0); - SET_INTERNL("www/compressed", "www/dump", HTCompressed, 1.0); + SET_INTERNL("www/compressed", STR_DOWNLOAD, HTCompressed, 1.0); + SET_INTERNL("www/compressed", STR_PRESENT, HTCompressed, 1.0); + SET_INTERNL("www/compressed", STR_SOURCE, HTCompressed, 1.0); + SET_INTERNL("www/compressed", STR_DUMP, HTCompressed, 1.0); /* * The following support some content types seen here/there: */ SET_INTERNL("application/html", "text/x-c", HTMLToC, 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); - SET_INTERNL("application/x-wais-source", "www/source", HTPlainPresent, 1.0); - SET_INTERNL("application/x-wais-source", "www/present", HTWSRCConvert, 2.0); - SET_INTERNL("application/x-wais-source", "www/download", HTWSRCConvert, 1.0); - SET_INTERNL("application/x-wais-source", "www/dump", HTWSRCConvert, 1.0); + SET_INTERNL("application/html", STR_PRESENT, HTMLPresent, 2.0); + SET_INTERNL("application/html", STR_SOURCE, HTPlainPresent, 1.0); + SET_INTERNL("application/xml", STR_PRESENT, HTMLPresent, 2.0); + SET_INTERNL("application/x-wais-source", STR_SOURCE, HTPlainPresent, 1.0); + SET_INTERNL("application/x-wais-source", STR_PRESENT, HTWSRCConvert, 2.0); + SET_INTERNL("application/x-wais-source", STR_DOWNLOAD, HTWSRCConvert, 1.0); + SET_INTERNL("application/x-wais-source", STR_DUMP, HTWSRCConvert, 1.0); /* * Save all unknown mime types to disk. */ - SET_EXTERNL("www/source", "www/present", HTSaveToFile, 1.0); - SET_EXTERNL("www/source", "www/source", HTSaveToFile, 1.0); - SET_EXTERNL("www/source", "www/download", HTSaveToFile, 1.0); - SET_EXTERNL("www/source", "*", HTSaveToFile, 1.0); + SET_EXTERNL(STR_SOURCE, STR_PRESENT, HTSaveToFile, 1.0); + SET_EXTERNL(STR_SOURCE, STR_SOURCE, HTSaveToFile, 1.0); + SET_EXTERNL(STR_SOURCE, STR_DOWNLOAD, HTSaveToFile, 1.0); + SET_EXTERNL(STR_SOURCE, "*", HTSaveToFile, 1.0); /* * Output all www/dump presentations to stdout. */ - SET_EXTERNL("www/source", "www/dump", HTDumpToStdout, 1.0); + SET_EXTERNL(STR_SOURCE, STR_DUMP, HTDumpToStdout, 1.0); /* * Other internal types, which must precede the "www/present" entries @@ -147,10 +147,10 @@ void HTFormatInit(void) 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); + SET_INTERNL(STR_HTML, STR_SOURCE, HTPlainPresent, 1.0); + SET_INTERNL(STR_PLAINTEXT, STR_SOURCE, HTPlainPresent, 1.0); + SET_INTERNL("text/sgml", STR_SOURCE, HTPlainPresent, 1.0); + SET_INTERNL("text/x-sgml", STR_SOURCE, HTPlainPresent, 1.0); /* * Now add our basic conversions. These include the types which will @@ -178,14 +178,14 @@ void HTFormatInit(void) * application/xhtml+xml * text/html */ - SET_INTERNL("application/xhtml+xml", "www/present", HTMLPresent, 1.0); - SET_INTERNL("application/xhtml+xml", "www/source", HTPlainPresent, 1.0); - SET_INTERNL("text/css", "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); + SET_INTERNL("application/xhtml+xml", STR_PRESENT, HTMLPresent, 1.0); + SET_INTERNL("application/xhtml+xml", STR_SOURCE, HTPlainPresent, 1.0); + SET_INTERNL("text/css", STR_PRESENT, HTPlainPresent, 1.0); + SET_INTERNL(STR_HTML, STR_PRESENT, HTMLPresent, 1.0); + SET_INTERNL(STR_PLAINTEXT, STR_PRESENT, HTPlainPresent, 1.0); + SET_INTERNL("text/sgml", STR_PRESENT, HTMLPresent, 1.0); + SET_INTERNL("text/x-sgml", STR_PRESENT, HTMLPresent, 2.0); + SET_INTERNL("text/xml", STR_PRESENT, HTMLPresent, 2.0); if (LYisAbsPath(global_type_map)) { /* These should override the default types as necessary. */ @@ -218,8 +218,8 @@ void HTPreparsedFormatInit(void) { CTrace((tfp, "HTPreparsedFormatInit\n")); if (LYPreparsedSource) { - SET_INTERNL(STR_HTML, "www/source", HTMLParsedPresent, 1.0); - SET_INTERNL(STR_HTML, "www/dump", HTMLParsedPresent, 1.0); + SET_INTERNL(STR_HTML, STR_SOURCE, HTMLParsedPresent, 1.0); + SET_INTERNL(STR_HTML, STR_DUMP, HTMLParsedPresent, 1.0); } } @@ -1140,6 +1140,13 @@ void HTFileInit(void) SET_SUFFIX1(".bz2", "application/x-bzip2", "binary"); SET_SUFFIX1(".bz2", "application/bzip2", "binary"); + SET_SUFFIX1(".br", "application/x-brotli", "binary"); + + SET_SUFFIX1(".xz", "application/x-xz", "binary"); + + SET_SUFFIX1(".lz", "application/x-lzip", "binary"); + SET_SUFFIX1(".lzma", "application/x-lzma", "binary"); + #ifdef TRADITIONAL_SUFFIXES SET_SUFFIX1(".uu", "application/x-UUencoded", "8bit"); diff --git a/src/LYMain.c b/src/LYMain.c index af78ef78..eef3ff76 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMain.c,v 1.295 2021/07/05 20:26:11 tom Exp $ + * $LynxId: LYMain.c,v 1.298 2022/04/01 07:50:45 tom Exp $ */ #include <HTUtils.h> #include <HTTP.h> @@ -1932,7 +1932,7 @@ int main(int argc, /* * Check the -base command line switch with -source. - FM */ - if (LYPrependBase && HTOutputFormat == HTAtom_for("www/download")) { + if (LYPrependBase && HTOutputFormat == WWW_DOWNLOAD) { LYPrependBaseToSource = TRUE; } @@ -2582,8 +2582,8 @@ static int base_fun(char *next_arg GCC_UNUSED) * later, if LYPrependBase is set TRUE here. - FM */ LYPrependBase = TRUE; - if (HTOutputFormat == HTAtom_for("www/dump")) - HTOutputFormat = HTAtom_for("www/download"); + if (HTOutputFormat == WWW_DUMP) + HTOutputFormat = WWW_DOWNLOAD; return 0; } @@ -2832,7 +2832,7 @@ static int mime_header_fun(char *next_arg GCC_UNUSED) keep_mime_headers = TRUE; force_dump_mode(); HTOutputFormat = (LYPrependBase ? - HTAtom_for("www/download") : HTAtom_for("www/dump")); + WWW_DOWNLOAD : WWW_DUMP); LYcols = MAX_COLS; return 0; } @@ -3193,7 +3193,7 @@ static int source_fun(char *next_arg GCC_UNUSED) { force_dump_mode(); HTOutputFormat = (LYPrependBase ? - HTAtom_for("www/download") : HTAtom_for("www/dump")); + WWW_DOWNLOAD : WWW_DUMP); LYcols = MAX_COLS; return 0; } diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 7a3df1c4..01d5b874 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMainLoop.c,v 1.244 2021/07/29 20:33:05 tom Exp $ + * $LynxId: LYMainLoop.c,v 1.246 2022/04/01 07:55:02 tom Exp $ */ #include <HTUtils.h> #include <HTAccess.h> @@ -1207,7 +1207,7 @@ static int handle_LYK_ACTIVATE(int *c, } } } else { - if (HTOutputFormat == HTAtom_for("www/download") && + if (HTOutputFormat == WWW_DOWNLOAD && newdoc.post_data != NULL && newdoc.safe == FALSE) { @@ -2173,7 +2173,7 @@ static int handle_LYK_DOWNLOAD(int *cmd, } return 0; } - HTOutputFormat = HTAtom_for("www/download"); + HTOutputFormat = WWW_DOWNLOAD; LYforce_no_cache = TRUE; *cmd = LYK_ACTIVATE; return 2; @@ -2254,7 +2254,7 @@ static int handle_LYK_DOWNLOAD(int *cmd, newdoc.safe = HDOC(number).safe; newdoc.internal_link = FALSE; newdoc.link = (user_mode == NOVICE_MODE) ? 1 : 0; - HTOutputFormat = HTAtom_for("www/download"); + HTOutputFormat = WWW_DOWNLOAD; LYUserSpecifiedURL = TRUE; /* * Force the document to be reloaded. @@ -2330,7 +2330,7 @@ static int handle_LYK_DOWNLOAD(int *cmd, } newdoc.internal_link = FALSE; newdoc.link = (user_mode == NOVICE_MODE) ? 1 : 0; - HTOutputFormat = HTAtom_for("www/download"); + HTOutputFormat = WWW_DOWNLOAD; /* * Force the document to be reloaded. */ @@ -5541,7 +5541,7 @@ int mainloop(void) HTInternalLink = HTAtom_for("internal link"); /* init, used as const */ #ifndef WWW_SOURCE - WWW_SOURCE = HTAtom_for("www/source"); /* init, used as const */ + WWW_SOURCE = HTAtom_for(STR_SOURCE); /* init, used as const */ #endif /* |