diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-02-15 10:50:52 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-02-15 10:50:52 -0500 |
commit | 923c66ce35dd473a10713d8f44f30d9ad770a99b (patch) | |
tree | 055092b48fbae27a526fe2d104b6d646a9d422e7 /WWW/Library | |
parent | 6f66219647d92d2af2427d416e00e6f2a8f825dc (diff) | |
download | lynx-snapshots-923c66ce35dd473a10713d8f44f30d9ad770a99b.tar.gz |
snapshot of project "lynx", label v2_7
Diffstat (limited to 'WWW/Library')
-rw-r--r-- | WWW/Library/Implementation/HTFinger.c | 28 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTGopher.c | 56 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTML.h | 1 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTNews.c | 199 | ||||
-rw-r--r-- | WWW/Library/Implementation/tcp.h | 16 |
5 files changed, 202 insertions, 98 deletions
diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c index db9dc3dc..d00b57cb 100644 --- a/WWW/Library/Implementation/HTFinger.c +++ b/WWW/Library/Implementation/HTFinger.c @@ -212,18 +212,22 @@ PRIVATE int response ARGS5( */ p = l = line; while (*l) { - if (strncmp (l, "news:", 5) && - strncmp (l, "snews://", 8) && - strncmp (l, "nntp://", 7) && - strncmp (l, "ftp://", 6) && - strncmp (l, "file:/", 6) && - strncmp (l, "finger://", 9) && - strncmp (l, "http://", 7) && - strncmp (l, "https://", 8) && - strncmp (l, "wais://", 7) && - strncmp (l, "mailto:", 7) && - strncmp (l, "cso://", 6) && - strncmp (l, "gopher://", 9)) + if (strncmp(l, "news:", 5) && + strncmp(l, "snews://", 8) && + strncmp(l, "nntp://", 7) && + strncmp(l, "snewspost:", 10) && + strncmp(l, "snewsreply:", 11) && + strncmp(l, "newspost:", 9) && + strncmp(l, "newsreply:", 10) && + strncmp(l, "ftp://", 6) && + strncmp(l, "file:/", 6) && + strncmp(l, "finger://", 9) && + strncmp(l, "http://", 7) && + strncmp(l, "https://", 8) && + strncmp(l, "wais://", 7) && + strncmp(l, "mailto:", 7) && + strncmp(l, "cso://", 6) && + strncmp(l, "gopher://", 9)) PUTC(*l++); else { StrAllocCopy(href, l); diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 6eb93764..84fc9e9a 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -1365,18 +1365,22 @@ PRIVATE int generate_cso_report ARGS2( l++; i += 4; buf[i] = '\0'; - } else if (strncmp (l, "news:", 5) && - strncmp (l, "snews://", 8) && - strncmp (l, "nntp://", 7) && - strncmp (l, "ftp://", 6) && - strncmp (l, "file:/", 6) && - strncmp (l, "finger://", 9) && - strncmp (l, "http://", 7) && - strncmp (l, "https://", 8) && - strncmp (l, "wais://", 7) && - strncmp (l, "mailto:", 7) && - strncmp (l, "cso://", 6) && - strncmp (l, "gopher://", 9)) { + } else if (strncmp(l, "news:", 5) && + strncmp(l, "snews://", 8) && + strncmp(l, "nntp://", 7) && + strncmp(l, "snewspost:", 10) && + strncmp(l, "snewsreply:", 11) && + strncmp(l, "newspost:", 9) && + strncmp(l, "newsreply:", 10) && + strncmp(l, "ftp://", 6) && + strncmp(l, "file:/", 6) && + strncmp(l, "finger://", 9) && + strncmp(l, "http://", 7) && + strncmp(l, "https://", 8) && + strncmp(l, "wais://", 7) && + strncmp(l, "mailto:", 7) && + strncmp(l, "cso://", 6) && + strncmp(l, "gopher://", 9)) { buf[i++] = *l++; buf[i] = '\0'; } else { @@ -1416,18 +1420,22 @@ PRIVATE int generate_cso_report ARGS2( l++; i += 4; buf[i] = '\0'; - } else if (strncmp (l, "news:", 5) && - strncmp (l, "snews://", 8) && - strncmp (l, "nntp://", 7) && - strncmp (l, "ftp://", 6) && - strncmp (l, "file:/", 6) && - strncmp (l, "finger://", 9) && - strncmp (l, "http://", 7) && - strncmp (l, "https://", 8) && - strncmp (l, "wais://", 7) && - strncmp (l, "mailto:", 7) && - strncmp (l, "cso://", 6) && - strncmp (l, "gopher://", 9)) { + } else if (strncmp(l, "news:", 5) && + strncmp(l, "snews://", 8) && + strncmp(l, "nntp://", 7) && + strncmp(l, "snewspost:", 10) && + strncmp(l, "snewsreply:", 11) && + strncmp(l, "newspost:", 9) && + strncmp(l, "newsreply:", 10) && + strncmp(l, "ftp://", 6) && + strncmp(l, "file:/", 6) && + strncmp(l, "finger://", 9) && + strncmp(l, "http://", 7) && + strncmp(l, "https://", 8) && + strncmp(l, "wais://", 7) && + strncmp(l, "mailto:", 7) && + strncmp(l, "cso://", 6) && + strncmp(l, "gopher://", 9)) { buf[i++] = *l++; buf[i] = '\0'; } else { diff --git a/WWW/Library/Implementation/HTML.h b/WWW/Library/Implementation/HTML.h index 23d89e17..c4bd3caf 100644 --- a/WWW/Library/Implementation/HTML.h +++ b/WWW/Library/Implementation/HTML.h @@ -113,6 +113,7 @@ struct _HTStructured { BOOL inA; BOOL inAPPLET; BOOL inAPPLETwithP; + BOOL inBadBASE; BOOL inBadHTML; BOOL inBASE; BOOL inBoldA; diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 5a86151e..1281d2e4 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -22,9 +22,6 @@ /* this define should be in HTFont.h :( */ #define HT_NON_BREAK_SPACE ((char)1) /* For now */ -#define CR FROMASCII('\015') /* Must be converted to ^M for transmission */ -#define LF FROMASCII('\012') /* Must be converted to ^J for transmission */ - #define NEWS_PORT 119 /* See rfc977 */ #define SNEWS_PORT 563 /* See Lou Montulli */ #define APPEND /* Use append methods */ @@ -65,6 +62,7 @@ extern BOOLEAN LYListNewsNumbers; extern BOOLEAN LYListNewsDates; extern HTCJKlang HTCJK; extern int interrupted_in_htgetcharacter; +extern BOOL using_proxy; /* Are we using an NNTP proxy? */ /* ** Module-wide variables. @@ -86,6 +84,13 @@ PRIVATE int diagnostic; /* level: 0=none 2=source */ #define START(e) (*targetClass.start_element)(target, e, 0, 0, 0) #define END(e) (*targetClass.end_element)(target, e, 0) +PRIVATE void free_news_globals NOARGS +{ + FREE(HTNewsHost); + FREE(NewsHost); + FREE(NewsHREF); +} + PUBLIC CONST char * HTGetNewsHost NOARGS { return HTNewsHost; @@ -117,13 +122,21 @@ PUBLIC void HTSetNewsHost ARGS1(CONST char *, value) PRIVATE BOOL initialized = NO; PRIVATE BOOL initialize NOARGS { + char *cp = NULL; + /* ** Get name of Host. */ #ifdef NeXTStep - if ((HTNewsHost = NXGetDefaultValue("WorldWideWeb","NewsHost"))==0) - if ((HTNewsHost = NXGetDefaultValue("News","NewsHost")) == 0) - HTNewsHost = DEFAULT_NEWS_HOST; + if ((cp = NXGetDefaultValue("WorldWideWeb","NewsHost"))==0) { + if ((cp = NXGetDefaultValue("News","NewsHost")) == 0) { + StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST); + } + } + if (cp) { + StrAllocCopy(HTNewsHost, cp); + cp = NULL; + } #else if (getenv("NNTPSERVER")) { StrAllocCopy(HTNewsHost, (char *)getenv("NNTPSERVER")); @@ -143,11 +156,11 @@ PRIVATE BOOL initialize NOARGS } } if (!HTNewsHost) - HTNewsHost = DEFAULT_NEWS_HOST; + StrAllocCopy(HTNewsHost, DEFAULT_NEWS_HOST); #endif /* NeXTStep */ s = -1; /* Disconnected */ - + atexit(free_news_globals); return YES; } @@ -291,7 +304,7 @@ PRIVATE char * author_name ARGS1 (char *,email) ** ** For example, returns "montulli@spaced.out.galaxy.net" if given any of ** " Lou Montulli <montulli@spaced.out.galaxy.net> " -** or " montulli@spacedout.galaxy.net ( Lou "The Stud" Montulli ) " +** or " montulli@spaced.out.galaxy.net ( Lou "The Stud" Montulli ) " */ PRIVATE char * author_address ARGS1(char *,email) { @@ -407,7 +420,7 @@ PRIVATE void start_list ARGS1(int, seqnum) ** On entry, ** HT has a selection of zero length at the end. ** text points to the text to be put into the file, 0 terminated. -** addr points to the hypertext refernce address, +** addr points to the hypertext reference address, ** terminated by white space, comma, NULL or '>' */ PRIVATE void write_anchor ARGS2(CONST char *,text, CONST char *,addr) @@ -609,6 +622,13 @@ PRIVATE void post_article ARGS1( blen = llen; } } + fclose(fd); +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ /* ** Send the nntp EOF and get the server's response. - FM @@ -983,18 +1003,22 @@ PRIVATE int read_article NOARGS p += 7; *p = 0; while (*l) { - if (strncmp (l, "news:", 5) && - strncmp (l, "snews://", 8) && - strncmp (l, "nntp://", 7) && - strncmp (l, "ftp://", 6) && - strncmp (l, "file:/", 6) && - strncmp (l, "finger://", 9) && - strncmp (l, "http://", 7) && - strncmp (l, "https://", 8) && - strncmp (l, "wais://", 7) && - strncmp (l, "mailto:", 7) && - strncmp (l, "cso://", 6) && - strncmp (l, "gopher://", 9)) + if (strncmp(l, "news:", 5) && + strncmp(l, "snews://", 8) && + strncmp(l, "nntp://", 7) && + strncmp(l, "snewspost:", 10) && + strncmp(l, "snewsreply:", 11) && + strncmp(l, "newspost:", 9) && + strncmp(l, "newsreply:", 10) && + strncmp(l, "ftp://", 6) && + strncmp(l, "file:/", 6) && + strncmp(l, "finger://", 9) && + strncmp(l, "http://", 7) && + strncmp(l, "https://", 8) && + strncmp(l, "wais://", 7) && + strncmp(l, "mailto:", 7) && + strncmp(l, "cso://", 6) && + strncmp(l, "gopher://", 9)) PUTC (*l++); else { StrAllocCopy(href, l); @@ -1018,18 +1042,22 @@ PRIVATE int read_article NOARGS } } while (*l) { /* Last bit of the line */ - if (strncmp (l, "news:", 5) && - strncmp (l, "snews://", 8) && - strncmp (l, "nntp://", 7) && - strncmp (l, "ftp://", 6) && - strncmp (l, "file:/", 6) && - strncmp (l, "finger://", 9) && - strncmp (l, "http://", 7) && - strncmp (l, "https://", 8) && - strncmp (l, "wais://", 7) && - strncmp (l, "mailto:", 7) && - strncmp (l, "cso://", 6) && - strncmp (l, "gopher://", 9)) + if (strncmp(l, "news:", 5) && + strncmp(l, "snews://", 8) && + strncmp(l, "nntp://", 7) && + strncmp(l, "snewspost:", 10) && + strncmp(l, "snewsreply:", 11) && + strncmp(l, "newspost:", 9) && + strncmp(l, "newsreply:", 10) && + strncmp(l, "ftp://", 6) && + strncmp(l, "file:/", 6) && + strncmp(l, "finger://", 9) && + strncmp(l, "http://", 7) && + strncmp(l, "https://", 8) && + strncmp(l, "wais://", 7) && + strncmp(l, "mailto:", 7) && + strncmp(l, "cso://", 6) && + strncmp(l, "gopher://", 9)) PUTC (*l++); else { StrAllocCopy(href, l); @@ -1091,10 +1119,10 @@ PRIVATE int read_list ARGS1(char *, arg) } /* - ** Read in the HEADer of the article. + ** Read the server's reply. ** - ** The header fields are either ignored, - ** or formatted and put into the text. + ** The lines are scanned for newsgroup + ** names and descriptions. */ START(HTML_HEAD); PUTC('\n'); @@ -1140,6 +1168,9 @@ PRIVATE int read_list ARGS1(char *, arg) START(HTML_DT); PUTS(&line[1]); } + } else if (line[0] == '#') { /* Comment? */ + p = line; /* Restart at beginning */ + continue; } else { /* ** Normal lines are scanned for references to newsgroups. @@ -1613,6 +1644,8 @@ PUBLIC int HTLoadNews ARGS4( int first, last; /* First and last articles asked for */ char *cp; char *ListArg = NULL; + char *ProxyHost = NULL; + char *ProxyHREF = NULL; char *postfile = NULL; diagnostic = (format_out == WWW_SOURCE || /* set global flag */ @@ -1644,18 +1677,20 @@ PUBLIC int HTLoadNews ARGS4( ** xxxxx News group (no "@") ** group/n1-n2 Articles n1 to n2 in group */ - post_wanted = (strstr(arg, "newspost:") != NULL); - reply_wanted = ((!post_wanted) && + spost_wanted = (strstr(arg, "snewspost:") != NULL); + sreply_wanted = (!(spost_wanted) && + strstr(arg, "snewsreply:") != NULL); + post_wanted = (!(spost_wanted || sreply_wanted) && + strstr(arg, "newspost:") != NULL); + reply_wanted = (!(spost_wanted || sreply_wanted || + post_wanted) && strstr(arg, "newsreply:") != NULL); - spost_wanted = (!(post_wanted || reply_wanted) && - strstr(arg, "snewspost:") != NULL); - sreply_wanted = (!(post_wanted || reply_wanted || - spost_wanted) && - strstr(arg, "newsreply:") != NULL); - group_wanted = (!(post_wanted || reply_wanted || - spost_wanted || sreply_wanted) && + group_wanted = (!(spost_wanted || sreply_wanted || + post_wanted || reply_wanted) && strchr(arg, '@') == NULL) && (strchr(arg, '*') == NULL); - list_wanted = (!(post_wanted || reply_wanted) && + list_wanted = (!(spost_wanted || sreply_wanted || + post_wanted || reply_wanted || + group_wanted) && strchr(arg, '@') == NULL) && (strchr(arg, '*') != NULL); if (!strncasecomp(arg, "snewspost:", 10) || @@ -1806,12 +1841,15 @@ PUBLIC int HTLoadNews ARGS4( ** or followups. - TZ & FM */ if (!strncasecomp(p1, "snews:", 6) || - !strncasecomp(p1, "snewpost:", 10) || + !strncasecomp(p1, "snewspost:", 10) || !strncasecomp(p1, "snewsreply:", 11)) { - if ((cp = HTParse(p1, "", PARSE_HOST)) != NULL && *cp != '\0') + StrAllocCopy(ProxyHost, NewsHost); + if ((cp = HTParse(p1, "", PARSE_HOST)) != NULL && *cp != '\0') { sprintf(command, "snews://%.250s", cp); - else + StrAllocCopy(NewsHost, cp); + } else { sprintf(command, "snews://%.250s", NewsHost); + } command[258] = '\0'; FREE(cp); sprintf(proxycmd, "GET %.251s%c%c%c%c", command, CR, LF, CR, LF); @@ -1820,6 +1858,7 @@ PUBLIC int HTLoadNews ARGS4( "HTNews: Proxy command is '%.*s'\n", (strlen(proxycmd) - 4), proxycmd); strcat(command, "/"); + StrAllocCopy(ProxyHREF, NewsHREF); StrAllocCopy(NewsHREF, command); if (spost_wanted || sreply_wanted) { /* @@ -1890,7 +1929,7 @@ PUBLIC int HTLoadNews ARGS4( { char * p = command + strlen(command); /* - ** Teminate command with CRLF, as in RFC 977. + ** Terminate command with CRLF, as in RFC 977. */ *p++ = CR; /* Macros to be correct on Mac */ *p++ = LF; @@ -1901,6 +1940,8 @@ PUBLIC int HTLoadNews ARGS4( if (!*arg) { FREE(NewsHREF); + FREE(ProxyHost); + FREE(ProxyHREF); FREE(ListArg); return NO; /* Ignore if no name */ } @@ -1921,10 +1962,13 @@ PUBLIC int HTLoadNews ARGS4( if (s < 0) { /* CONNECTING to news host */ char url[260]; - if (!strcmp(NewsHREF, "news:")) + if (!strcmp(NewsHREF, "news:")) { sprintf (url, "lose://%.251s/", NewsHost); - else + } else if (ProxyHREF) { + sprintf (url, "%.259s", ProxyHREF); + } else { sprintf (url, "%.259s", NewsHREF); + } if (TRACE) fprintf (stderr, "News: doing HTDoConnect on '%s'\n", url); @@ -1944,6 +1988,8 @@ PUBLIC int HTLoadNews ARGS4( (*targetClass._abort)(target, NULL); FREE(NewsHost); FREE(NewsHREF); + FREE(ProxyHost); + FREE(ProxyHREF); FREE(ListArg); if (postfile) { #ifdef VMS @@ -1968,6 +2014,8 @@ PUBLIC int HTLoadNews ARGS4( sprintf(message, "Could not access %s.", NewsHost); FREE(NewsHost); FREE(NewsHREF); + FREE(ProxyHost); + FREE(ProxyHREF); FREE(ListArg); if (postfile) { #ifdef VMS @@ -2002,6 +2050,8 @@ PUBLIC int HTLoadNews ARGS4( (*targetClass._abort)(target, NULL); FREE(NewsHost); FREE(NewsHREF); + FREE(ProxyHost); + FREE(ProxyHREF); FREE(ListArg); if (postfile) { #ifdef VMS @@ -2029,6 +2079,11 @@ PUBLIC int HTLoadNews ARGS4( spost_wanted || sreply_wanted) { HTAlert("Cannot POST to this host."); FREE(NewsHREF); + if (ProxyHREF) { + StrAllocCopy(NewsHost, ProxyHost); + FREE(ProxyHost); + FREE(ProxyHREF); + } FREE(ListArg); if (postfile) { #ifdef VMS @@ -2050,6 +2105,11 @@ PUBLIC int HTLoadNews ARGS4( if (!HTCanPost) { HTAlert("Cannot POST to this host."); FREE(NewsHREF); + if (ProxyHREF) { + StrAllocCopy(NewsHost, ProxyHost); + FREE(ProxyHost); + FREE(ProxyHREF); + } FREE(ListArg); if (postfile) { #ifdef VMS @@ -2070,6 +2130,11 @@ PUBLIC int HTLoadNews ARGS4( if (postfile == NULL) { HTProgress("Cancelled!"); FREE(NewsHREF); + if (ProxyHREF) { + StrAllocCopy(NewsHost, ProxyHost); + FREE(ProxyHost); + FREE(ProxyHREF); + } FREE(ListArg); return(HT_NOT_LOADED); } @@ -2077,9 +2142,9 @@ PUBLIC int HTLoadNews ARGS4( /* ** Ensure reader mode, but don't bother checking the ** status for anything but HT_INERRUPTED, because if - ** if the reader mode command is not needed, the server - ** probably return a 500, which is irrelevant at this - ** point. - FM + ** the reader mode command is not needed, the server + ** probably return a 500, which is irrelevant at + ** this point. - FM */ char buffer[20]; @@ -2112,7 +2177,8 @@ Send_NNTP_command: s = -1; /* ** Message might be a leftover "Timeout-disconnected", - ** so try again if retries is not exhausted. + ** so try again if the retries maximum has not been + ** reached. */ continue; } @@ -2123,9 +2189,18 @@ Send_NNTP_command: if (post_wanted || reply_wanted || spost_wanted || sreply_wanted) { if (status != 340) { HTAlert("Cannot POST to this host."); + if (postfile) { +#ifdef VMS + while (remove(postfile) == 0) + ; /* loop through all versions */ +#else + remove(postfile); +#endif /* VMS */ + } } else { post_article(postfile); } + FREE(postfile); status = HT_NOT_LOADED; } else if (list_wanted) { _HTProgress("Reading list of available newsgroups."); @@ -2159,6 +2234,11 @@ Send_NNTP_command: spost_wanted || sreply_wanted)) (*targetClass._free)(target); FREE(NewsHREF); + if (ProxyHREF) { + StrAllocCopy(NewsHost, ProxyHost); + FREE(ProxyHost); + FREE(ProxyHREF); + } FREE(ListArg); if (postfile) { #ifdef VMS @@ -2181,6 +2261,11 @@ Send_NNTP_command: spost_wanted || sreply_wanted)) (*targetClass._abort)(target, NULL); FREE(NewsHREF); + if (ProxyHREF) { + StrAllocCopy(NewsHost, ProxyHost); + FREE(ProxyHost); + FREE(ProxyHREF); + } FREE(ListArg); if (postfile) { #ifdef VMS diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h index b67a1510..d4b00b38 100644 --- a/WWW/Library/Implementation/tcp.h +++ b/WWW/Library/Implementation/tcp.h @@ -127,7 +127,7 @@ VAX/VMS CMU_TCP Available via FTP from sacusr.mp.usbr.gov SOCKETSHR Eckhart Meyer's interface to NETLIB WIN_TCP From Wollongong, now GEC software. - MULTINET From SRI, now from TGV Inv. + MULTINET From SRI, became TGV, then Cisco. DECNET Cern's TCP socket emulation over DECnet The last three do not interfere with the @@ -175,8 +175,10 @@ VAX/VMS #undef IOCTL #undef SOCKET_ERRNO /* -** Remove these socket_foo() prototypes if -** MultiNet someday actually does this. - FM +** Delete these socket_foo() prototypes as MultiNet adds them +** to it's socket library headers. Compiler warnings due to +** the absence of arguments in the generic prototypes here will +** include the names of those which can be deleted. - FM */ extern int socket_read(); extern int socket_write(); @@ -224,8 +226,12 @@ extern int socket_ioctl(); #ifdef MULTINET /* Include from standard Multinet directories */ /* -** Remove these multinet_foo() and associated prototypes -** if MultiNet someday actually does this. - FM +** Delete any of these multinet_foo() and associated prototypes +** as MultiNet adds them to its socket library headers. You'll +** get compiler warnings about them, due the absence of arguments +** in the generic prototyping here, and the warnings will include +** the names of the functions whose prototype entries can be +** deleted here. - FM */ extern int multinet_accept(); extern int multinet_bind(); |