diff options
| author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-04-04 14:13:10 -0500 |
|---|---|---|
| committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-04-04 14:13:10 -0500 |
| commit | 36a66292ee2ec3530d776892d22d6c5ace810ae0 (patch) | |
| tree | ac50b496468f774172bdd3b76a6832ede18c44af /src | |
| parent | 923c66ce35dd473a10713d8f44f30d9ad770a99b (diff) | |
| download | lynx-snapshots-36a66292ee2ec3530d776892d22d6c5ace810ae0.tar.gz | |
snapshot of project "lynx", label v2-7-1
Diffstat (limited to 'src')
| -rw-r--r-- | src/HTFWriter.c | 23 | ||||
| -rw-r--r-- | src/HTML.c | 10 | ||||
| -rw-r--r-- | src/LYCharSets.c | 30 | ||||
| -rw-r--r-- | src/LYCharUtils.c | 19 | ||||
| -rw-r--r-- | src/LYCookie.c | 44 | ||||
| -rw-r--r-- | src/LYGetFile.c | 60 | ||||
| -rw-r--r-- | src/LYHistory.c | 4 | ||||
| -rw-r--r-- | src/LYLocal.c | 5 | ||||
| -rw-r--r-- | src/LYMail.c | 4 | ||||
| -rw-r--r-- | src/LYMain.c | 26 | ||||
| -rw-r--r-- | src/LYMainLoop.c | 49 | ||||
| -rw-r--r-- | src/LYNews.c | 1 | ||||
| -rw-r--r-- | src/LYPrint.c | 33 | ||||
| -rw-r--r-- | src/LYReadCFG.c | 12 | ||||
| -rw-r--r-- | src/LYSearch.c | 2 | ||||
| -rw-r--r-- | src/LYShowInfo.c | 5 | ||||
| -rw-r--r-- | src/LYUtils.c | 8 |
17 files changed, 231 insertions, 104 deletions
diff --git a/src/HTFWriter.c b/src/HTFWriter.c index fac0af78..58baaa9f 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -67,7 +67,8 @@ struct _HTStream { FILE * fp; /* The file we've opened */ char * end_command; /* What to do on _free. */ char * remove_command; /* What to do on _abort. */ - HTPresentation * pres; /* Original stream's pres. */ + HTFormat input_format; /* Original pres->rep */ + HTFormat output_format; /* Original pres->rep_out */ HTParentAnchor * anchor; /* Original stream's anchor. */ HTStream * sink; /* Original stream's sink. */ }; @@ -150,7 +151,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) } } else #endif /* VMS */ - if (me->pres->rep == HTAtom_for("www/compressed")) { + if (me->input_format == HTAtom_for("www/compressed")) { /* * It's a compressed file supposedly cached to * a temporary file for uncompression. - FM @@ -210,10 +211,10 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) FREE(me->anchor->content_encoding); status = HTLoadFile(addr, me->anchor, - me->pres->rep_out, + me->output_format, me->sink); if (dump_output_immediately && - me->pres->rep_out == HTAtom_for("www/present")) { + me->output_format == HTAtom_for("www/present")) { FREE(addr); remove(me->anchor->FileCache); FREE(me->anchor->FileCache); @@ -340,7 +341,6 @@ PUBLIC HTStream* HTFWriter_new ARGS1(FILE *, fp) me->fp = fp; me->end_command = NULL; me->remove_command = NULL; - me->pres = NULL; me->anchor = NULL; me->sink = NULL; @@ -421,7 +421,8 @@ PUBLIC HTStream* HTSaveAndExecute ARGS3( if (me == NULL) outofmem(__FILE__, "HTSaveAndExecute"); me->isa = &HTFWriter; - me->pres = pres; + me->input_format = pres->rep; + me->output_format = pres->rep_out; me->anchor = anchor; me->sink = sink; @@ -538,7 +539,8 @@ PUBLIC HTStream* HTSaveToFile ARGS3( ret_obj->isa = &HTFWriter; ret_obj->remove_command = NULL; ret_obj->end_command = NULL; - ret_obj->pres = pres; + ret_obj->input_format = pres->rep; + ret_obj->output_format = pres->rep_out; ret_obj->anchor = anchor; ret_obj->sink = sink; @@ -773,9 +775,7 @@ PUBLIC HTStream* HTCompressed ARGS3( * We have no idea what we're dealing with, * so treat it as a binary stream. - FM */ - StrAllocCopy(type, "application/octet-stream"); - format = HTAtom_for(type); - FREE(type) + format = HTAtom_for("application/octet-stream"); me = HTStreamStack(format, pres->rep_out, sink, anchor); return me; } @@ -841,7 +841,8 @@ PUBLIC HTStream* HTCompressed ARGS3( if (me == NULL) outofmem(__FILE__, "HTCompressed"); me->isa = &HTFWriter; - me->pres = pres; + me->input_format = pres->rep; + me->output_format = pres->rep_out; me->anchor = anchor; me->sink = sink; @@ -2115,7 +2115,7 @@ PRIVATE void HTML_start_element ARGS5( (present && present[HTML_A_TYPE] && value[HTML_A_TYPE]) ? - (HTLinkType*)HTAtom_for(value[HTML_A_TYPE]) : (void *)0); /* Type */ + (HTLinkType*)HTAtom_for(value[HTML_A_TYPE]) : (HTLinkType*)0); /* Type */ /* * Get rid of href since no longer needed. @@ -2309,7 +2309,8 @@ PRIVATE void HTML_start_element ARGS5( StrAllocCopy(alt_string, (title ? title : "[USEMAP]")); - } else if (dest_ismap || present && present[HTML_IMG_ISMAP]) { + } else if ((dest_ismap == TRUE) || + (me->inA && present && present[HTML_IMG_ISMAP])) { StrAllocCopy(alt_string, (title ? title : "[ISMAP]")); @@ -2335,8 +2336,9 @@ PRIVATE void HTML_start_element ARGS5( fprintf(stderr, "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n", map_href ? 1 : 0, - (dest_ismap || - (present && present[HTML_IMG_ISMAP])) ? 1 : 0, + ((dest_ismap == TRUE) || + (me->inA && present && present[HTML_IMG_ISMAP])) ? + 1 : 0, me->inA, me->inP); } diff --git a/src/LYCharSets.c b/src/LYCharSets.c index 7e3b57ae..5b243f35 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -142,7 +142,7 @@ PRIVATE char * ISO_Latin1[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "\376", /* small thorn, Icelandic - thorn */ "\327", /* multiplication sign (×) - times */ - "\256", /* circled R registered sign (®:) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "\372", /* small u, acute accent - uacute */ "\373", /* small u, circumflex accent - ucirc */ "\371", /* small u, grave accent - ugrave */ @@ -261,7 +261,7 @@ PRIVATE char * ISO_Latin2[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "\327", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "\372", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -400,7 +400,7 @@ PRIVATE char * ISO_LatinN[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -523,7 +523,7 @@ PRIVATE char * DEC_Multinational[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "\372", /* small u, acute accent - uacute */ "\373", /* small u, circumflex accent - ucirc */ "\371", /* small u, grave accent - ugrave */ @@ -645,7 +645,7 @@ PRIVATE char * PC_charset[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "\347", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "\243", /* small u, acute accent - uacute */ "\226", /* small u, circumflex accent - ucirc */ "\227", /* small u, grave accent - ugrave */ @@ -767,7 +767,7 @@ PRIVATE char * PC_850_charset[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "\347", /* small thorn, Icelandic - thorn */ "\236", /* multiplication sign (×) - times */ - "\251", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "\243", /* small u, acute accent - uacute */ "\226", /* small u, circumflex accent - ucirc */ "\227", /* small u, grave accent - ugrave */ @@ -888,7 +888,7 @@ PRIVATE char * Macintosh[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "\250", /* circled R registered sign (®) - trade */ + "\252", /* circled TM trade mark sign (™) - trade */ "\234", /* small u, acute accent - uacute */ "\236", /* small u, circumflex accent - ucirc */ "\235", /* small u, grave accent - ugrave*/ @@ -1007,7 +1007,7 @@ PRIVATE char * NeXT_Step[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "\374", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "\363", /* small u, acute accent - uacute */ "\364", /* small u, circumflex accent - ucirc */ "\362", /* small u, grave accent - ugrave*/ @@ -1147,7 +1147,7 @@ PRIVATE char * KOI8_R[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -1290,7 +1290,7 @@ PRIVATE char * Chinese[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -1433,7 +1433,7 @@ PRIVATE char * EUC_JP[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -1576,7 +1576,7 @@ PRIVATE char * Shift_JIS[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -1719,7 +1719,7 @@ PRIVATE char * Korean[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -1862,7 +1862,7 @@ PRIVATE char * Taipei[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ @@ -2005,7 +2005,7 @@ PRIVATE char * SevenBitApproximations[] = { "\002", /* thin space - not collapsed NEVER CHANGE THIS - thinsp */ "p", /* small thorn, Icelandic - thorn */ "*", /* multiplication sign (×) - times */ - "(R)", /* circled R registered sign (®) - trade */ + "(TM)", /* circled TM trade mark sign (™) - trade */ "u", /* small u, acute accent - uacute */ "u", /* small u, circumflex accent - ucirc */ "u", /* small u, grave accent - ugrave */ diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 22085ca5..26f33cc1 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -330,7 +330,7 @@ PUBLIC char * LYUnEscapeEntities ARGS3( continue; /* ** For 8482 (trade) use the character reference if it's - ** a hidden INPUT, otherwise use 174 (reg). - FM + ** a hidden INPUT, otherwise handle as named entify. - FM */ } else if (value == 8482) { if (hidden) { @@ -345,13 +345,14 @@ PUBLIC char * LYUnEscapeEntities ARGS3( p--; *p = cpe; } - cp = (p - 5); + cp = (p - 6); *cp++ = '&'; - *cp++ = '#'; - *cp++ = '1'; - *cp++ = '7'; - *cp++ = '4'; - p -= 5; + *cp++ = 't'; + *cp++ = 'r'; + *cp++ = 'a'; + *cp++ = 'd'; + *cp++ = 'e'; + p -= 6; continue; } /* @@ -857,7 +858,7 @@ PUBLIC void LYExpandString ARGS1( ** set. - FM */ if (((unsigned char)p[i]) == 160 && - HTPassHighCtrlRaw) { + !HTPassHighCtrlRaw) { p[i] = HT_NON_BREAK_SPACE; /* ** Substitute Lynx special character for @@ -865,7 +866,7 @@ PUBLIC void LYExpandString ARGS1( ** set. - FM */ } else if (((unsigned char)p[i]) == 173 && - HTPassHighCtrlRaw) { + !HTPassHighCtrlRaw) { p[i] = LY_SOFT_HYPHEN; /* ** Substitute other 8-bit characters based on diff --git a/src/LYCookie.c b/src/LYCookie.c index 88a4e6fc..14f2ecfc 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -616,7 +616,14 @@ PUBLIC void LYSetCookie ARGS2( attr_end = p; SKIP_SPACES; - if (*p == '=') { + /* + * Check for an '=' delimiter, or an 'expires' name followed + * by white, since Netscape's bogus parser doesn't require + * an '=' delimiter, and 'expires' attributes are being + * encountered without them. - FM + */ + if (*p == '=' || + !strncasecomp(attr_start, "Expires", 7)) { /* * Get the value string. */ @@ -751,10 +758,18 @@ PUBLIC void LYSetCookie ARGS2( } else if (len == 7 && !strncasecomp(attr_start, "expires", 7)) { /* * Convert an 'expires' attribute value for Version 0 - * cookies to the equivalent of a Version 1 (or greater) - * 'max-age' value added to 'time(NULL)'. - FM + * cookies, or for Version 1 if we haven't received a + * 'max-age', to the equivalent of a Version 1 (or greater) + * 'max-age' value added to 'time(NULL)'. Note that + * 'expires' should not be used in Version 1 cookies, + * but, as explained below, it might be used for "backward + * compatibility", and, in turn, ill-informed people + * surely would start using it instead of, rather than + * in addition to, 'max-age'. - FM */ - if (cur_cookie && cur_cookie->version < 1) { + if (((cur_cookie) && cur_cookie->version < 1) || + ((cur_cookie) && + !(cur_cookie->flags & COOKIE_FLAG_EXPIRES_SET))) { known_attr = YES; if (value) { cur_cookie->flags |= COOKIE_FLAG_EXPIRES_SET; @@ -770,17 +785,26 @@ PUBLIC void LYSetCookie ARGS2( } /* * If it's a version 1 (or greater) cookie, then you - * really can set a cookie named 'expires', so we don't - * set known_attr. + * really can set a cookie named 'expires', so we + * perhaps shouldn't set known_attr. However, an + * -06 draft, which hopefully will be shot down as + * bogus, suggests adding (invalidly) 'expires' + * headers for "backward compatibility". So, we'll + * set known-attr, to ignore it, and hope it works + * out. - FM */ + known_attr = YES; } /* - * If none of the above comparisions succeeded, then we have - * an unknown pair of the form 'foo=bar', which means it's - * time to create a new cookie. + * If none of the above comparisions succeeded, and we have + * a value, then we have an unknown pair of the form 'foo=bar', + * which means it's time to create a new cookie. If we don't + * have a non-zero-length value, assume it's an error or a + * new, unknown attribute which doesn't take a value, and + * ignore it. - FM */ - if (!known_attr) { + if (!known_attr && value_end > value_start) { store_cookie(cur_cookie, hostname, path); cur_cookie = newCookie(); length += len; diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 45212601..59c9f0ab 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -116,6 +116,38 @@ Try_Redirected_URL: } /* + * Protect against denial of service attacks + * via the port 19 CHARGEN service, and block + * connections to the port 25 ESMTP service. - FM + */ + if ((temp = HTParse(doc->address, "", PARSE_HOST)) != NULL && + strlen(temp) > 3) { + char *cp1; + + if ((cp1 = strchr(temp, '@')) == NULL) + cp1 = temp; + if ((cp = strrchr(cp1, ':')) != NULL) { + int value; + + cp++; + if (sscanf(cp, "%d", &value) == 1) { + if (value == 19) { + HTAlert(PORT_NINETEEN_INVALID); + FREE(temp); + return(NULLFILE); + } + if (value == 25) { + HTAlert(PORT_TWENTYFIVE_INVALID); + FREE(temp); + return(NULLFILE); + } + } + } + } + cp = NULL; + FREE(temp); + + /* * Check to see if this is a universal document ID * that lib WWW wants to handle. * @@ -709,11 +741,13 @@ Try_Redirected_URL: StrAllocCopy(doc->address, fname); FREE(fname); WWWDoc.address = doc->address; - FREE(WWWDoc.post_data); - FREE(WWWDoc.post_content_type); - WWWDoc.bookmark = doc->bookmark; - WWWDoc.isHEAD = FALSE; - WWWDoc.safe = doc->safe; + FREE(doc->post_data); + WWWDoc.post_data = NULL; + FREE(doc->post_content_type); + WWWDoc.post_content_type = NULL; + WWWDoc.bookmark = doc->bookmark = FALSE; + WWWDoc.isHEAD = doc->isHEAD = FALSE; + WWWDoc.safe = doc->safe = FALSE; HTOutputFormat = WWW_PRESENT; if (!HTLoadAbsolute(&WWWDoc)) return(NOT_FOUND); @@ -1056,7 +1090,12 @@ PRIVATE int fix_http_urls ARGS1( */ if (!strncmp(doc->address, "ftp", 3) && doc->address[strlen(doc->address)-1] == '/') { + char * proxy; char *path = HTParse(doc->address, "", PARSE_PATH|PARSE_PUNCTUATION); + + /* + * If the path is a lone slash, we're done. - FM + */ if (path) { if (path[0] == '/' && path[1] == '\0') { FREE(path); @@ -1064,6 +1103,17 @@ PRIVATE int fix_http_urls ARGS1( } FREE(path); } + + /* + * If we're proxying ftp, don't trim anything. - KW + */ + if (((proxy = (char *)getenv("ftp_proxy")) != NULL) && + *proxy != '\0' && !override_proxy(doc->address)) + return 0; + + /* + * If we get to here, trim the trailing slash. - FM + */ if (TRACE) fprintf(stderr,"LYGetFile: URL %s\n", doc->address); doc->address[strlen(doc->address)-1] = '\0'; diff --git a/src/LYHistory.c b/src/LYHistory.c index eb57db8e..54969ef7 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -399,10 +399,10 @@ PUBLIC BOOLEAN historytarget ARGS1( LYoverride_no_cache == FALSE) || text == NULL) && HTConfirm(CONFIRM_POST_RESUBMISSION) == TRUE) { - LYforce_no_cache == TRUE; + LYforce_no_cache = TRUE; LYoverride_no_cache = FALSE; } else if (text != NULL) { - LYforce_no_cache == FALSE; + LYforce_no_cache = FALSE; LYoverride_no_cache = TRUE; } else { _statusline(CANCELLED); diff --git a/src/LYLocal.c b/src/LYLocal.c index 78c0233f..6ef0ad65 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -1583,7 +1583,10 @@ PUBLIC int dired_options ARGS2( *cp = '.'; } #endif /* NOTDEFINED */ - } else path[0] = '\0'; + } else { + path[0] = '\0'; + StrAllocCopy(path_url, path); + } /*escaped = (char *) HTEscape(path,(unsigned char) 4); path_url instead- kw*/ nothing_tagged = (HTList_isEmpty(tagged)); diff --git a/src/LYMail.c b/src/LYMail.c index 0a2cc1c6..639f0f46 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -384,6 +384,7 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address, fprintf(fd, "Lynx ver. %s", LYNX_VERSION); if ((LynxSigFile != NULL) && (fp = fopen(LynxSigFile, "r")) != NULL) { + fputs("-- \n", fd); while (fgets(cmd, sizeof(cmd), fp) != NULL) fputs(cmd, fd); fclose(fp); @@ -657,7 +658,7 @@ PUBLIC void reply_by_mail ARGS3( cp = cp1; } if (address[(strlen(address) - 1)] == ',') - address[(strlen(address) - 1)] == '\0'; + address[(strlen(address) - 1)] = '\0'; if (*address == '\0') { FREE(address); FREE(body); @@ -1050,6 +1051,7 @@ PUBLIC void reply_by_mail ARGS3( c = LYgetch(); if (TOUPPER(c) == 'Y') { if ((fd = fopen(tmpfile, "a")) != NULL) { + fputs("-- \n", fd); while (fgets(user_input, sizeof(user_input), fp) != NULL) { fputs(user_input, fd); } diff --git a/src/LYMain.c b/src/LYMain.c index f621bf00..ae103c36 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -295,7 +295,7 @@ PUBLIC char *LYUserAgent = NULL; /* Lynx User-Agent header */ PUBLIC char *LYUserAgentDefault = NULL; /* Lynx default User-Agent header */ PUBLIC BOOLEAN LYNoRefererHeader=FALSE; /* Never send Referer header? */ PUBLIC BOOLEAN LYNoRefererForThis=FALSE;/* No Referer header for this URL? */ -PUBLIC BOOLEAN LYNoFromHeader=FALSE; /* Never send From header? */ +PUBLIC BOOLEAN LYNoFromHeader = TRUE; /* Never send From header? */ PUBLIC BOOLEAN LYListNewsNumbers = LIST_NEWS_NUMBERS; PUBLIC BOOLEAN LYListNewsDates = LIST_NEWS_DATES; PUBLIC BOOLEAN LYisConfiguredForX = FALSE; @@ -951,7 +951,7 @@ PUBLIC int main ARGS2( if (dump_output_immediately || LYMBMBlocked || no_multibook) { LYMultiBookmarks = FALSE; LYMBMBlocked = TRUE; - no_multibook == TRUE; + no_multibook = TRUE; } #ifdef VMS @@ -1459,6 +1459,12 @@ PRIVATE void parse_arg ARGS3( break;; #endif /* VMS */ + } else if (strncmp(argv[0], "-from", 5) == 0) { + if (LYNoFromHeader) + LYNoFromHeader = FALSE; + else + LYNoFromHeader = TRUE; + } else if (strncmp(argv[0], "-ftp", 4) == 0) { ftp_ok = FALSE; @@ -1640,9 +1646,6 @@ PRIVATE void parse_arg ARGS3( } else if (strncmp(argv[0], "-nofilereferer", 14) == 0) { no_filereferer = TRUE; - } else if (strncmp(argv[0], "-nofrom", 7) == 0) { - LYNoFromHeader = TRUE; - } else if (strncmp(argv[0], "-nolist", 7) == 0) { nolist = TRUE; @@ -1938,9 +1941,14 @@ PRIVATE void parse_arg ARGS3( parse_restrictions("all"); } else if (strncmp(argv[0], "-version", 8) == 0) { - printf("\n%s Version %s\n(c)1997 GNU General Public License\n\ -<URL:http://lynx.browser.org/>\n\n", - LYNX_NAME, LYNX_VERSION); + printf("\n%s Version %s (1997)\n", LYNX_NAME, LYNX_VERSION); + printf( + "Copyrights held by the University of Kansas, CERN, and other contributors.\n" + ); + printf("Distributed under the GNU General Public License.\n"); + printf( + "See http://lynx.browser.org/ and the online help for more information.\n\n" + ); exit(0); } else if (strncmp(argv[0], "-vikeys", 7) == 0) { @@ -2001,6 +2009,7 @@ Output_Help_List: printf(" -fileversions include all versions of files in local VMS directory\n"); printf(" listings\n"); printf(" -force_html forces the first document to be interpreted as HTML\n"); + printf(" -from toggle transmissions of From headers\n"); printf(" -ftp disable ftp access\n"); printf(" -get_data user data for get forms, read from stdin,\n"); printf(" terminated by '---' on a line\n"); @@ -2018,7 +2027,6 @@ Output_Help_List: printf(" -newsmaxchunk=NUMBER maximum news articles in listings before chunking\n"); printf(" -nobrowse disable directory browsing\n"); printf(" -nofilereferer disable transmissions of Referer headers for file URLs\n"); - printf(" -nofrom disable transmissions of From headers\n"); printf(" -nolist disable the link list feature in dumps\n"); printf(" -nolog disable mailing of error messages to document owners\n"); printf(" -nopause disable forced pauses for statusline messages\n"); diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 72e0d96c..1801682f 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -516,10 +516,15 @@ try_again: if ((cp = (char *)calloc(1, (strlen((char *)&temp[len]) + 2))) == NULL) outofmem(__FILE__, "mainloop"); - if (temp[len] == '/') - sprintf(cp, ".%s", (char *)&temp[len]); - else - strcpy(cp, (char *)&temp[len]); + if (temp[len] == '/') { + if (strchr((char *)&temp[(len + 1)], '/')) { + sprintf(cp, ".%s", (char *)&temp[len]); + } else { + strcpy(cp, (char *)&temp[(len + 1)]); + } + } else { + strcpy(cp, (char *)&temp[len]); + } for (i = 0; i <= MBM_V_MAXFILES; i++) { if (MBM_A_subbookmark[i] && #ifdef VMS @@ -793,11 +798,22 @@ try_again: } } if (startfile) { + /* + * If homepage was not equated to startfile, + * make the homepage URL the first goto + * entry. - FM + */ if (homepage && strcmp(startfile, homepage)) HTAddGotoURL(homepage); - if (strcmp(startfile, newdoc.address) || - newdoc.post_data == NULL); - HTAddGotoURL(startfile); + /* + * If we are not starting up with startfile + * (e.g., had -book), or if we are using the + * startfile and it has no POST content, make + * the startfile URL a goto entry. - FM + */ + if (strcmp(startfile, newdoc.address) || + newdoc.post_data == NULL) + HTAddGotoURL(startfile); } if (TRACE) { refresh_screen = TRUE; @@ -851,8 +867,16 @@ try_again: arrowup = FALSE; } else { curdoc.link = newdoc.link; - if (curdoc.link >= nlinks) - curdoc.link = nlinks - 1; + if (curdoc.link >= nlinks) { + curdoc.link = nlinks - 1; + } else if (curdoc.link < 0 && nlinks > 0) { + /* + * We may have popped a doc (possibly in local_dired) + * which didn't have any links when it was pushed, but + * does have links now (e.g. a file was created) - KW + */ + curdoc.link = 0; + } } show_help = FALSE; /* reset */ @@ -3765,12 +3789,17 @@ check_add_bookmark_to_self: if (lynx_edit_mode && !no_dired_support) { LYUpload_options((char **)&newdoc.address, (char *)curdoc.address); - FREE(curdoc.address); FREE(newdoc.post_data); FREE(newdoc.post_content_type); FREE(newdoc.bookmark); newdoc.isHEAD = FALSE; newdoc.safe = FALSE; + /* + * Uncache the current listing so that it will + * be updated to included the uploaded file if + * placed in the current directory. - FM + */ + HTuncache_current_document(); } break; #endif /* DIRED_SUPPORT */ diff --git a/src/LYNews.c b/src/LYNews.c index 77ef81cc..79ae8e39 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -291,6 +291,7 @@ PUBLIC char *LYNewsPost ARGS2( c = LYgetch(); if (TOUPPER(c) == 'Y') { if ((fd = fopen(tmpfile, "a")) != NULL) { + fputs("-- \n", fd); while (fgets(user_input, sizeof(user_input), fp) != NULL) { fputs(user_input, fd); } diff --git a/src/LYPrint.c b/src/LYPrint.c index 3b3a5fe4..265747a4 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -3,6 +3,7 @@ #include "HTAccess.h" #include "HTList.h" #include "HTAlert.h" +#include "HTFile.h" #include "LYCurses.h" #include "GridText.h" #include "LYUtils.h" @@ -68,6 +69,8 @@ PUBLIC int printfile ARGS1(document *,newdoc) int FnameNum; BOOLEAN FirstRecall = TRUE; char *content_base = NULL, *content_location = NULL; + HTFormat format; + HTAtom *encoding; #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ @@ -189,10 +192,11 @@ PUBLIC int printfile ARGS1(document *,newdoc) retry: strcpy(filename, sug_filename); /* add suggestion info */ /* make the sug_filename conform to system specs */ change_sug_filename(filename); - if (!(HTisDocumentSource()) && (len = strlen(filename)) > 4) { - len -= 5; - if (!strcasecomp((filename + len), ".html")) { - filename[len] = '\0'; + if (!(HTisDocumentSource()) && + (cp = strrchr(filename, '.')) != NULL) { + format = HTFileFormat(filename, &encoding); + if (!strcasecomp(format->name, "text/html")) { + *cp = '\0'; strcat(filename, ".txt"); } } @@ -436,16 +440,16 @@ PUBLIC int printfile ARGS1(document *,newdoc) if (HTisDocumentSource()) { if ((len = strlen(tempfile)) > 3) { len -= 4; - if (!strcasecomp((filename + len), ".txt")) { - filename[len] = '\0'; - strcat(filename, ".html"); + if (!strcasecomp((tempfile + len), ".txt")) { + tempfile[len] = '\0'; + strcat(tempfile, ".html"); } } } else if ((len = strlen(tempfile)) > 4) { len -= 5; - if (!strcasecomp((filename + len), ".html")) { - filename[len] = '\0'; - strcat(filename, ".txt"); + if (!strcasecomp((tempfile + len), ".html")) { + tempfile[len] = '\0'; + strcat(tempfile, ".txt"); } } if((outfile_fp = fopen(tempfile, "w")) == NULL) { @@ -716,10 +720,11 @@ PUBLIC int printfile ARGS1(document *,newdoc) _statusline(FILENAME_PROMPT); again: strcpy(filename, sug_filename); change_sug_filename(filename); - if ((len = strlen(filename)) > 4) { - len -= 5; - if (!strcasecomp((filename + len), ".html")) { - filename[len] = '\0'; + if (!(HTisDocumentSource()) && + (cp = strrchr(filename, '.')) != NULL) { + format = HTFileFormat(filename, &encoding); + if (!strcasecomp(format->name, "text/html")) { + *cp = '\0'; strcat(filename, ".txt"); } } diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 4af58672..f76f08dd 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1107,12 +1107,6 @@ PUBLIC void read_cfg ARGS1( break; case 'W': - if (!strncasecomp(buffer, "XLOADIMAGE_COMMAND:", 19)) { - StrAllocCat(XLoadImageCommand, (char *)&buffer[19]); - } - break; - - case 'X': if (!strncasecomp(buffer, "wais_proxy:", 11)) { if (getenv("wais_proxy") == NULL) { #ifdef VMS @@ -1128,6 +1122,12 @@ PUBLIC void read_cfg ARGS1( } break; + case 'X': + if (!strncasecomp(buffer, "XLOADIMAGE_COMMAND:", 19)) { + StrAllocCat(XLoadImageCommand, (char *)&buffer[19]); + } + break; + default: break; diff --git a/src/LYSearch.c b/src/LYSearch.c index 0aafaa79..52a3e110 100644 --- a/src/LYSearch.c +++ b/src/LYSearch.c @@ -251,7 +251,7 @@ check_recall: * link we are on, or the next page. */ if (nlinks == 0) - offset = display_lines+1; + offset = (display_lines - 1); else offset = links[cur_doc->link].ly; diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index d2ffc786..b02b3a05 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -261,9 +261,8 @@ PUBLIC int showinfo ARGS4( fprintf(fp0, "<dt><em>Last Mod:</em> %s\n", cp); if (doc->post_data) { - StrAllocCopy(Address, doc->post_data); - LYEntify(&Address, FALSE); - fprintf(fp0, "<dt><em>Post Data:</em> <xmp>%s</xmp>\n", Address); + fprintf(fp0, + "<dt><em>Post Data:</em> <xmp>%s</xmp>\n", doc->post_data); fprintf(fp0, "<dt><em>Post Content Type:</em> %s\n", doc->post_content_type); } diff --git a/src/LYUtils.c b/src/LYUtils.c index debb5c33..c45b99a0 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -2241,12 +2241,14 @@ have_VMS_URL: if ((stat(cp, &st) > -1) || (fptemp = fopen(cp, "r")) != NULL) { /* - * It is a subdirectory of file on the local system + * It is a subdirectory or file on the local system * with escaped characters and/or a fragment to be * appended to the URL. - FM */ - *fragment = '#'; - fragment = NULL; + if (fragment != NULL) { + *fragment = '#'; + fragment = NULL; + } StrAllocCat(*AllocatedString, temp); if (TRACE) { fprintf(stderr, "Converted '%s' to '%s'\n", |