diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 41 | ||||
-rw-r--r-- | src/HTFWriter.c | 8 | ||||
-rw-r--r-- | src/LYCookie.c | 64 | ||||
-rw-r--r-- | src/LYGetFile.c | 27 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 5 | ||||
-rw-r--r-- | src/LYMail.c | 73 | ||||
-rw-r--r-- | src/LYMain.c | 22 | ||||
-rw-r--r-- | src/LYMainLoop.c | 17 | ||||
-rw-r--r-- | src/LYReadCFG.c | 5 | ||||
-rw-r--r-- | src/LYShowInfo.c | 2 |
10 files changed, 196 insertions, 68 deletions
diff --git a/src/GridText.c b/src/GridText.c index 493e66cc..e057c95f 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -932,8 +932,25 @@ PRIVATE void display_page ARGS3( for (i = 0, line = text->last_line->next; /* Find line */ i < line_number && (line != text->last_line); - i++, line = line->next) /* Loop */ + i++, line = line->next) { /* Loop */ +#ifndef VMS + if (!LYNoCore) { + assert(line->next != NULL); + } else if (line->next == NULL) { + if (enable_scrollback) { + addch('*'); + refresh(); + clear(); + } + addstr("\n\nError drawing page!\nBad HText structure!\n"); + refresh(); + nlinks = 0; /* set number of links to 0 */ + return; + } +#else assert(line->next != NULL); +#endif /* !VMS */ + } #ifdef EXP_CHARTRANS if (LYlowest_eightbit[current_char_set] <= 255 && @@ -997,7 +1014,23 @@ PRIVATE void display_page ARGS3( /* * Verify and display each line. */ +#ifndef VMS + if (!LYNoCore) { + assert(line != NULL); + } else if (line == NULL) { + if (enable_scrollback) { + addch('*'); + refresh(); + clear(); + } + addstr("\n\nError drawing page!\nBad HText structure!\n"); + refresh(); + nlinks = 0; /* set number of links to 0 */ + return; + } +#else assert(line != NULL); +#endif /* !VMS */ display_line(line, text); #if defined(FANCY_CURSES) || defined(USE_SLANG) @@ -1466,6 +1499,8 @@ PRIVATE void split_line ARGS2( int ctrl_chars_on_previous_line = 0; char * cp; HTLine * line = (HTLine *)calloc(1, LINE_SIZE(MAX_LINE)); + if (line == NULL) + outofmem(__FILE__, "split_line"); ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/ text->LastChar = ' '; @@ -1473,8 +1508,6 @@ PRIVATE void split_line ARGS2( if (TRACE) fprintf(stderr,"GridText: split_line called\n"); - if (line == NULL) - outofmem(__FILE__, "split_line"); text->Lines++; previous->next->prev = line; @@ -2459,7 +2492,7 @@ PUBLIC void HText_endAnchor ARGS2( * without needing to close any anchor with an HREF * within which that link might be embedded. - FM */ - if (number <= 0 || text->last_anchor->number == number) { + if (number <= 0 || number == text->last_anchor->number) { a = text->last_anchor; } else { for (a = text->first_anchor; a; a = a->next) { diff --git a/src/HTFWriter.c b/src/HTFWriter.c index 711774b1..93e75a68 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -180,7 +180,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) /* * Tell user what's happening. - FM */ - _HTProgress(me->end_command); + _HTProgress(me->end_command); } /* * Uncompress it. - FM @@ -235,6 +235,12 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * Now have HTLoadFile() handle the uncompressed * file as if it were the original reply. - FM */ + if (!dump_output_immediately) { + /* + * Tell user what's happening. - FM + */ + _user_message(WWW_USING_MESSAGE, addr); + } status = HTLoadFile(addr, me->anchor, me->output_format, diff --git a/src/LYCookie.c b/src/LYCookie.c index 008797e3..07d51595 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -611,9 +611,9 @@ PRIVATE char * scan_cookie_sublist ARGS6( len += (strlen(co->name) + strlen(co->value) + 1); /* * For Version 1 (or greater) cookies, add - * $PATH and/or $DOMAIN attributes for the - * cookie if they were specified via a server - * reply header. - FM + * $PATH, $PORT and/or $DOMAIN attributes for + * the cookie if they were specified via a + * server reply header. - FM */ if (co->version > 0) { if (co->path && (co->flags & COOKIE_FLAG_PATH_SET)) { @@ -623,7 +623,16 @@ PRIVATE char * scan_cookie_sublist ARGS6( StrAllocCat(header, "; $Path=\""); StrAllocCat(header, co->path); StrAllocCat(header, "\""); - len != (strlen(co->path) + 8); + len += (strlen(co->path) + 10); + } + if (co->PortList && isdigit((unsigned char)*co->PortList)) { + /* + * Append the port attribute. - FM + */ + StrAllocCat(header, "; $Port=\""); + StrAllocCat(header, co->PortList); + StrAllocCat(header, "\""); + len += (strlen(co->PortList) + 10); } if (co->domain && (co->flags & COOKIE_FLAG_DOMAIN_SET)) { /* @@ -632,7 +641,7 @@ PRIVATE char * scan_cookie_sublist ARGS6( StrAllocCat(header, "; $Domain=\""); StrAllocCat(header, co->domain); StrAllocCat(header, "\""); - len != (strlen(co->domain) + 10); + len += (strlen(co->domain) + 12); } } } @@ -672,15 +681,22 @@ PRIVATE void LYProcessSetCookies ARGS6( } /* - * If we have both Set-Cookie and Set-Cookie2 headers, - * and must combine them because the Set-Cookie2 headers - * are not required to have complete cookies if Set-Cookie - * headers are present. So set up a list for the cookies - * we process out of the header(s). Note that if more than - * one instance of a valued attribute for the same cookie - * is encountered, the value for the first instance is - * retained, with preference to that in a Set-Cookie2 - * header. We only accept up to 50 cookies from either + * If we have both Set-Cookie and Set-Cookie2 headers. + * process the Set-Cookie2 header, then the Set-Cookie + * header. The most current draft has abandoned the + * the earlier requirement to combine them, but we'll + * keep doing that for now, until we're sure that holds + * up, since we never replace anything that was in the + * Set-Cookie2 headers with it's equivalent in the + * Set-Cookie header. If we have only a Set-Cookie2 + * or only a Set-Cookie header, that's what we use. So + * set up a list for the cookies we process out of the + * header(s). Note that if more than one instance of a + * valued attribute for the same cookie is encountered, + * even within the same header, the value for the first + * instance is retained, with consequent preference to + * that in a Set-Cookie2 header, since that was processed + * first. We only accept up to 50 cookies from either * header, and only if a cookie's values do not exceed * the 4096 byte limit on overall size. - FM */ @@ -688,7 +704,7 @@ PRIVATE void LYProcessSetCookies ARGS6( /* * First process the Set-Cookie2 header, if present, adding - * each cookie to the CombinedCoookies list. - FM + * each cookie to the CombinedCookies list. - FM */ p = (SetCookie2 ? SetCookie2 : ""); while (NumCookies <= 50 && *p) { @@ -712,7 +728,11 @@ PRIVATE void LYProcessSetCookies ARGS6( * 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 + * encountered without them. These shouldn't be in a + * Set-Cookie2 header, but we'll assume it's an expires + * attribute rather a cookie with that name, since the + * attribute mistake rather than name mistake seems more + * likely to be made by providers. - FM */ if (*p == '=' || !strncasecomp(attr_start, "Expires", 7)) { @@ -1393,11 +1413,13 @@ PRIVATE void LYProcessSetCookies ARGS6( address, PARSE_ALL); /* - * Accept only URLs for servers. - FM + * Accept only URLs for servers. The most + * recent draft says just http, so the others + * are commented out here. - FM */ if ((url_type = is_url(cur_cookie->commentURL)) && (url_type == HTTP_URL_TYPE || - url_type == HTTPS_URL_TYPE || + url_type == HTTPS_URL_TYPE/* || url_type == FTP_URL_TYPE || url_type == GOPHER_URL_TYPE || url_type == HTML_GOPHER_URL_TYPE || @@ -1407,7 +1429,7 @@ PRIVATE void LYProcessSetCookies ARGS6( url_type == SNEWS_URL_TYPE || url_type == WAIS_URL_TYPE || url_type == CSO_URL_TYPE || - url_type == FINGER_URL_TYPE)) { + url_type == FINGER_URL_TYPE */)) { length += strlen(cur_cookie->commentURL); } else { FREE(cur_cookie->commentURL); @@ -1570,7 +1592,7 @@ PRIVATE void LYProcessSetCookies ARGS6( (cur_cookie->flags & COOKIE_FLAG_PATH_SET)) { StrAllocCopy(co->path, cur_cookie->path); co->pathlen = cur_cookie->pathlen; - co->flags |= COOKIE_FLAG_DOMAIN_SET; + co->flags |= COOKIE_FLAG_PATH_SET; } /* * If the Set-Cookie2 header didn't include @@ -1711,7 +1733,7 @@ PRIVATE void LYProcessSetCookies ARGS6( (cur_cookie->flags & COOKIE_FLAG_PATH_SET)) { StrAllocCopy(co->path, cur_cookie->path); co->pathlen = cur_cookie->pathlen; - co->flags |= COOKIE_FLAG_DOMAIN_SET; + co->flags |= COOKIE_FLAG_PATH_SET; } /* * If the Set-Cookie2 header didn't include diff --git a/src/LYGetFile.c b/src/LYGetFile.c index e51f714f..f58fcd84 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -47,6 +47,7 @@ PRIVATE int fix_http_urls PARAMS((document *doc)); extern char * WWW_Download_File; +extern char LYCancelDownload; #ifdef VMS extern BOOLEAN LYDidRename; #endif /* VMS */ @@ -94,6 +95,16 @@ PUBLIC BOOLEAN getfile ARGS1( char *temp = NULL; DocAddress WWWDoc; /* a WWW absolute doc address struct */ + /* + * Reset LYCancelDownload to prevent unwanted delayed effect. - KW + */ + if (LYCancelDownload) { + if (TRACE) + fprintf(stderr, + "getfile: resetting LYCancelDownload to FALSE\n"); + LYCancelDownload = FALSE; + } + Try_Redirected_URL: /* * Load the WWWDoc struct in case we need to use it. @@ -131,10 +142,15 @@ Try_Redirected_URL: if ((cp1 = strchr(temp, '@')) == NULL) cp1 = temp; if ((cp = strrchr(cp1, ':')) != NULL) { - int value; + long int value; cp++; - if (sscanf(cp, "%d", &value) == 1) { + if (sscanf(cp, "%ld", &value) == 1) { + if (value > 65535 || value < 0) { + HTAlert(PORT_INVALID); + FREE(temp); + return(NULLFILE); + } if (value == 19) { HTAlert(PORT_NINETEEN_INVALID); FREE(temp); @@ -767,7 +783,7 @@ Try_Redirected_URL: */ HTAlert(ILLEGAL_REDIRECTION_URL); if (LYCursesON) { - _user_message("Illegal URL: %s", + _user_message(WWW_ILLEGAL_URL_MESSAGE, use_this_url_instead); sleep(AlertSecs); } else { @@ -780,7 +796,8 @@ Try_Redirected_URL: } if (TRACE) sleep(MessageSecs); - _user_message("Using %s", use_this_url_instead); + _user_message(WWW_USING_MESSAGE, + use_this_url_instead); sleep(InfoSecs); if (TRACE) fprintf(stderr, "\n"); @@ -909,7 +926,7 @@ Try_Redirected_URL: } else { if (TRACE) sleep(MessageSecs); - _user_message("Badly formed address %s",doc->address); + _user_message(WWW_BAD_ADDR_MESSAGE, doc->address); if (TRACE) fprintf(stderr,"\n"); sleep(MessageSecs); diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 81ffbfa2..d811b74f 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -318,5 +318,10 @@ extern BOOLEAN LYSeekFragMAPinCur; extern BOOLEAN LYSeekFragAREAinCur; extern BOOLEAN LYStripDotDotURLs; /* Try to fix ../ in some URLs? */ extern BOOLEAN LYForceSSLCookiesSecure; +extern BOOLEAN LYNoCc; + +#ifndef VMS +extern BOOLEAN LYNoCore; +#endif /* !VMS */ #endif /* LYGLOBALDEFS_H */ diff --git a/src/LYMail.c b/src/LYMail.c index 474f1a3a..849bb5d7 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -145,8 +145,7 @@ PUBLIC void mailform ARGS4( } /* - * Allow user to edit the default Subject - * and enter a cc to self. - FM + * Allow user to edit the default Subject - FM */ if (subject[0] == '\0') { if (mailto_subject && *mailto_subject) { @@ -167,18 +166,25 @@ PUBLIC void mailform ARGS4( FREE(address); return; } - sprintf(self,"%.79s", (personal_mail_address ? - personal_mail_address : "")); - self[79] = '\0'; - _statusline("Cc: "); - if ((ch = LYgetstr(self, VISIBLE, sizeof(self), NORECALL)) < 0) { - /* - * User cancelled via ^G. - FM - */ - _statusline(FORM_MAILTO_CANCELLED); - sleep(InfoSecs); - FREE(address); - return; + + /* + * Allow user to specify a self copy via a CC: + * entry, if permitted. - FM + */ + if (!LYNoCc) { + sprintf(self,"%.79s", (personal_mail_address ? + personal_mail_address : "")); + self[79] = '\0'; + _statusline("Cc: "); + if ((ch = LYgetstr(self, VISIBLE, sizeof(self), NORECALL)) < 0) { + /* + * User cancelled via ^G. - FM + */ + _statusline(FORM_MAILTO_CANCELLED); + sleep(InfoSecs); + FREE(address); + return; + } } #if defined(VMS) || defined(DOSPATH) @@ -901,26 +907,31 @@ PUBLIC void reply_by_mail ARGS3( #endif /* VMS */ /* - * Offer a CC line. + * Offer a CC line, if permitted. - FM */ - addstr(ENTER_ADDRESS_FOR_CC); - if (personal_mail_address) - addstr(CTRL_U_TO_ERASE); - addstr(BLANK_FOR_NO_COPY); - addstr("Cc: "); - /* Add the mail address if there is one. */ - sprintf(user_input,"%s", (personal_mail_address ? - personal_mail_address : "")); - if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || - term_letter) { + user_input[0] = '\0'; + if (!LYNoCc) { + addstr(ENTER_ADDRESS_FOR_CC); + if (personal_mail_address) + addstr(CTRL_U_TO_ERASE); + addstr(BLANK_FOR_NO_COPY); + addstr("Cc: "); + /* + * Add the mail address if there is one. + */ + sprintf(user_input,"%s", (personal_mail_address ? + personal_mail_address : "")); + if (LYgetstr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 || + term_letter) { + addstr("\n"); + _statusline(COMMENT_REQUEST_CANCELLED); + sleep(InfoSecs); + fclose(fd); /* Close the tmpfile. */ + scrollok(stdscr,FALSE); /* Stop scrolling. */ + goto cleanup; + } addstr("\n"); - _statusline(COMMENT_REQUEST_CANCELLED); - sleep(InfoSecs); - fclose(fd); /* Close the tmpfile. */ - scrollok(stdscr,FALSE); /* Stop scrolling. */ - goto cleanup; } - addstr("\n"); remove_tildes(user_input); #if defined (VMS) || defined (DOSPATH) if (*user_input) { diff --git a/src/LYMain.c b/src/LYMain.c index b939f01d..ff473d5d 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -359,6 +359,7 @@ PUBLIC BOOLEAN LYSeekFragAREAinCur = TRUE; PUBLIC BOOLEAN LYStripDotDotURLs = TRUE; /* Try to fix ../ in some URLs? */ PUBLIC BOOLEAN LYForceSSLCookiesSecure = FALSE; +PUBLIC BOOLEAN LYNoCc = FALSE; /* These are declared in cutil.h for current freeWAIS libraries. - FM */ #ifdef DECLARE_WAIS_LOGFILES @@ -379,6 +380,7 @@ PRIVATE HTList *LYStdinArgs = NULL; PRIVATE void parse_arg PARAMS((char **arg, int *i, int argc)); #ifndef VMS +PUBLIC BOOLEAN LYNoCore = NO_FORCED_CORE_DUMP; PRIVATE void FatalProblem PARAMS((int sig)); #endif /* !VMS */ @@ -1894,6 +1896,14 @@ PRIVATE void parse_arg ARGS3( else LYSetCookies = TRUE; +#ifndef VMS + } else if (strncmp(argv[0], "-core", 5) == 0) { + if (LYNoCore) + LYNoCore = FALSE; + else + LYNoCore = TRUE; +#endif /* !VMS */ + } else { goto Output_Error_and_Help_List; } @@ -2187,6 +2197,9 @@ PRIVATE void parse_arg ARGS3( } else if (strncmp(argv[0], "-nobrowse", 9) == 0) { HTDirAccess = HT_DIR_FORBID; + } else if (strncmp(argv[0], "-nocc", 5) == 0) { + LYNoCc = TRUE; + } else if (strncmp(argv[0], "-nocolor", 8) == 0) { LYShowColor = SHOW_COLOR_NEVER; #ifdef USE_SLANG @@ -2606,6 +2619,9 @@ Output_Help_List: printf(" -blink force high intensity bg colors in color mode\n"); #endif /* USE_SLANG */ printf(" -cookies toggles handling of Set-Cookie headers\n"); +#ifndef VMS + printf(" -core toggles forced core dumps on fatal errors\n"); +#endif /* !VMS */ printf(" -crawl with -traversal, output each page to a file\n"); printf(" with -dump, format output as with -traversal, but to stdout\n"); printf(" -display=DISPLAY set the display variable for X execed programs\n"); @@ -2649,6 +2665,7 @@ Output_Help_List: printf(" -newschunksize=NUMBER number of articles in chunked news listings\n"); printf(" -newsmaxchunk=NUMBER maximum news articles in listings before chunking\n"); printf(" -nobrowse disable directory browsing\n"); + printf(" -nocc disable Cc: prompts for self copies of mailings\n"); printf(" -nofilereferer disable transmissions of Referer headers for file URLs\n"); printf(" -nolist disable the link list feature in dumps\n"); printf(" -nolog disable mailing of error messages to document owners\n"); @@ -2771,8 +2788,11 @@ Do NOT mail the core file if one was generated.\r\n"); Lynx now exiting with signal: %d\r\n\r\n", sig); /* - * Exit and dump core. + * Exit and possibly dump core. */ + if (LYNoCore) { + exit(-1); + } abort(); } else { diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index b8ecfb02..cdaedb29 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -4643,7 +4643,7 @@ check_add_bookmark_to_self: */ if ((curdoc.post_data != NULL && curdoc.safe != TRUE) && - HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) { + HTConfirm(CONFIRM_POST_DOC_HEAD) == FALSE) { _statusline(CANCELLED); sleep(InfoSecs); break; @@ -4653,6 +4653,8 @@ check_add_bookmark_to_self: if (HTLoadedDocumentIsHEAD()) { HTuncache_current_document(); FREE(curdoc.address); + } else { + StrAllocCat(newdoc.title, " - HEAD"); } } break; @@ -4673,9 +4675,15 @@ check_add_bookmark_to_self: "http", 4)) { _statusline(FORM_ACTION_NOT_HTTP_URL); sleep(MessageSecs); + } else if (links[curdoc.link].type == WWW_FORM_LINK_TYPE && + links[curdoc.link].form->submit_method == URL_POST_METHOD && + HTConfirm(CONFIRM_POST_LINK_HEAD) == FALSE) { + _statusline(CANCELLED); + sleep(InfoSecs); } else { HEAD_request = TRUE; LYforce_no_cache = TRUE; + StrAllocCat(newdoc.title, " - HEAD"); cmd = LYK_ACTIVATE; goto new_cmd; } @@ -4689,12 +4697,11 @@ check_add_bookmark_to_self: */ if ((curdoc.post_data != NULL && curdoc.safe != TRUE) && - HTConfirm(CONFIRM_POST_RESUBMISSION) == FALSE) { + HTConfirm(CONFIRM_POST_DOC_HEAD) == FALSE) { _statusline(CANCELLED); sleep(InfoSecs); break; - } - if (nlinks > 0) { + } else if (nlinks > 0) { _statusline(HEAD_D_OR_CANCEL); c = LYgetch(); } else { @@ -4710,6 +4717,8 @@ check_add_bookmark_to_self: if (HTLoadedDocumentIsHEAD()) { HTuncache_current_document(); FREE(curdoc.address); + } else { + StrAllocCat(newdoc.title, " - HEAD"); } } } diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 18f0c1d5..60f80410 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -987,6 +987,11 @@ PUBLIC void read_cfg ARGS1( } else if (!strncasecomp(buffer, "NO_FILE_REFERER:", 16)) { no_filereferer = is_true(buffer+16); +#ifndef VMS + } else if (!strncasecomp(buffer, "NO_FORCED_CORE_DUMP:", 20)) { + LYNoCore = is_true(buffer+20); +#endif /* !VMS */ + } else if (!strncasecomp(buffer, "NO_FROM_HEADER:", 15)) { LYNoFromHeader = is_true(buffer+15); diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index 7c17df72..156e4baf 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -295,7 +295,7 @@ PUBLIC int showinfo ARGS4( fprintf(fp0, "<dt> <em>mode:</em> %s%s%s\n", (lynx_mode == FORMS_LYNX_MODE ? "forms mode" : "normal"), - ((lynx_mode == FORMS_LYNX_MODE && doc->safe) ? ", safe" : ""), + (doc->safe ? ", safe" : ""), (doc->internal_link ? ", internal link" : "") ); |