Fix even more warnings in libwww2
Now that -Wall is turned on, it's possible to remove all sort of unused / unread variables and even fix one case of a missing initialization.
This commit is contained in:
parent
39b76427ae
commit
62396c5250
@ -624,9 +624,6 @@ PRIVATE char *compose_auth_string ARGS2(HTAAScheme, scheme,
|
|||||||
/* for MD5 -- DXP */
|
/* for MD5 -- DXP */
|
||||||
char * nonce; /* Server specified integer value */
|
char * nonce; /* Server specified integer value */
|
||||||
char * opaque; /* more random MD5 junk... */
|
char * opaque; /* more random MD5 junk... */
|
||||||
BOOL stale; /* flag indicating the previous request
|
|
||||||
from the client was rejected because
|
|
||||||
the nonce value was stale */
|
|
||||||
|
|
||||||
|
|
||||||
FREE(result); /* From previous call */
|
FREE(result); /* From previous call */
|
||||||
|
@ -139,7 +139,6 @@ PRIVATE int get_physical ARGS3(
|
|||||||
int, bong)
|
int, bong)
|
||||||
{
|
{
|
||||||
char * access=NULL; /* Name of access method */
|
char * access=NULL; /* Name of access method */
|
||||||
char * physical = NULL;
|
|
||||||
char * host = NULL;
|
char * host = NULL;
|
||||||
struct Proxy *GetNoProxy();
|
struct Proxy *GetNoProxy();
|
||||||
extern int useKeepAlive;
|
extern int useKeepAlive;
|
||||||
@ -181,7 +180,6 @@ PRIVATE int get_physical ARGS3(
|
|||||||
if (!GetNoProxy(tmp_access, tmp_host)) {
|
if (!GetNoProxy(tmp_access, tmp_host)) {
|
||||||
char *gateway_parameter, *gateway, *proxy;
|
char *gateway_parameter, *gateway, *proxy;
|
||||||
struct Proxy *proxent = NULL, *GetProxy();
|
struct Proxy *proxent = NULL, *GetProxy();
|
||||||
extern struct Proxy *proxy_list;
|
|
||||||
char *proxyentry = NULL;
|
char *proxyentry = NULL;
|
||||||
|
|
||||||
proxy_host_fix=strdup(tmp_host);
|
proxy_host_fix=strdup(tmp_host);
|
||||||
@ -214,9 +212,9 @@ PRIVATE int get_physical ARGS3(
|
|||||||
scheme_info = HTParse(HTAnchor_physical(anchor), "", PARSE_PATH);
|
scheme_info = HTParse(HTAnchor_physical(anchor), "", PARSE_PATH);
|
||||||
fMatchEnd = 0; /* match other scheme_info at beginning*/
|
fMatchEnd = 0; /* match other scheme_info at beginning*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bong) { /* this one is bad - disable! */
|
if (bong) { /* this one is bad - disable! */
|
||||||
proxent =
|
proxent =
|
||||||
GetProxy(tmp_access, scheme_info, fMatchEnd);
|
GetProxy(tmp_access, scheme_info, fMatchEnd);
|
||||||
if (proxent != NULL) proxent->alive = bong;
|
if (proxent != NULL) proxent->alive = bong;
|
||||||
}
|
}
|
||||||
@ -282,7 +280,7 @@ PRIVATE int get_physical ARGS3(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Search registered protocols to find suitable one
|
/* Search registered protocols to find suitable one
|
||||||
|
@ -50,7 +50,6 @@ void HTCompressedFileToFile (char *fnam, int compressed)
|
|||||||
{
|
{
|
||||||
char *znam;
|
char *znam;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int len;
|
|
||||||
|
|
||||||
cmd=NULL;
|
cmd=NULL;
|
||||||
|
|
||||||
@ -177,8 +176,6 @@ void HTCompressedFileToFile (char *fnam, int compressed)
|
|||||||
void HTCompressedHText (HText *text, int compressed, int plain)
|
void HTCompressedHText (HText *text, int compressed, int plain)
|
||||||
{
|
{
|
||||||
char *fnam;
|
char *fnam;
|
||||||
char *znam;
|
|
||||||
char *cmd;
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int rv, size_of_data;
|
int rv, size_of_data;
|
||||||
|
|
||||||
|
132
libwww2/HTFTP.c
132
libwww2/HTFTP.c
@ -254,13 +254,12 @@ PRIVATE int response (cmd)
|
|||||||
int messageStarted = 0;
|
int messageStarted = 0;
|
||||||
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char bytestr[256],*byteptr;
|
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
if (!control || control == -1)
|
if (!control || control == -1)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if(www2Trace)
|
if(www2Trace)
|
||||||
fprintf(stderr, "FTP: No control connection set up!!\n");
|
fprintf(stderr, "FTP: No control connection set up!!\n");
|
||||||
#endif
|
#endif
|
||||||
return -99;
|
return -99;
|
||||||
@ -1169,12 +1168,11 @@ ARGS4 (
|
|||||||
HTAtom *pencoding;
|
HTAtom *pencoding;
|
||||||
char *filename = HTParse(address, "", PARSE_PATH + PARSE_PUNCTUATION);
|
char *filename = HTParse(address, "", PARSE_PATH + PARSE_PUNCTUATION);
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ];
|
||||||
char buf[BUFSIZ];
|
|
||||||
char itemtype;
|
char itemtype;
|
||||||
char itemname[BUFSIZ];
|
char itemname[BUFSIZ];
|
||||||
char itemsize[BUFSIZ];
|
char itemsize[BUFSIZ];
|
||||||
char *full_ftp_name, *ptr;
|
char *full_ftp_name, *ptr;
|
||||||
int count, ret, cmpr, c, rv;
|
int count, ret, cmpr, c='\0', rv;
|
||||||
extern char *HTgeticonname(HTFormat, char *);
|
extern char *HTgeticonname(HTFormat, char *);
|
||||||
char *ellipsis_string=(char *)calloc(1024,sizeof(char));
|
char *ellipsis_string=(char *)calloc(1024,sizeof(char));
|
||||||
#ifdef NEW_PARSE
|
#ifdef NEW_PARSE
|
||||||
@ -1182,7 +1180,6 @@ int nTime;
|
|||||||
char szDate[256];
|
char szDate[256];
|
||||||
int nStringLen;
|
int nStringLen;
|
||||||
int nSpaces;
|
int nSpaces;
|
||||||
int nOldSpaces;
|
|
||||||
char szFileInfo[32];
|
char szFileInfo[32];
|
||||||
char szMonth[32];
|
char szMonth[32];
|
||||||
char szDay[16];
|
char szDay[16];
|
||||||
@ -1208,22 +1205,22 @@ char szTime[32];
|
|||||||
HText_appendText(HT,"<DD>");
|
HText_appendText(HT,"<DD>");
|
||||||
|
|
||||||
HText_appendText(HT,"<A HREF=\"");
|
HText_appendText(HT,"<A HREF=\"");
|
||||||
|
|
||||||
strcpy(buffer,filename);
|
strcpy(buffer,filename);
|
||||||
ptr = strrchr(buffer,'/');
|
ptr = strrchr(buffer,'/');
|
||||||
|
|
||||||
if(ptr != NULL) *ptr='\0';
|
if(ptr != NULL) *ptr='\0';
|
||||||
|
|
||||||
if(buffer[0] == '\0')
|
if(buffer[0] == '\0')
|
||||||
HText_appendText(HT,"/");
|
HText_appendText(HT,"/");
|
||||||
else
|
else
|
||||||
HText_appendText(HT, buffer);
|
HText_appendText(HT, buffer);
|
||||||
|
|
||||||
HText_appendText(HT,"\"><IMG SRC=\"");
|
HText_appendText(HT,"\"><IMG SRC=\"");
|
||||||
HText_appendText(HT, HTgeticonname(NULL, "directory"));
|
HText_appendText(HT, HTgeticonname(NULL, "directory"));
|
||||||
HText_appendText(HT,"\"> Parent Directory</a>");
|
HText_appendText(HT,"\"> Parent Directory</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop until we hit EOF */
|
/* Loop until we hit EOF */
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
@ -1239,7 +1236,7 @@ char szTime[32];
|
|||||||
#endif
|
#endif
|
||||||
return HT_INTERRUPTED;
|
return HT_INTERRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\r')
|
if (c == '\r')
|
||||||
{
|
{
|
||||||
c = next_data_char ();
|
c = next_data_char ();
|
||||||
@ -1247,29 +1244,29 @@ char szTime[32];
|
|||||||
{
|
{
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if (www2Trace)
|
if (www2Trace)
|
||||||
fprintf
|
fprintf
|
||||||
(stderr, "FTP: Picked up interrupted_in_next_data_char\n");
|
(stderr, "FTP: Picked up interrupted_in_next_data_char\n");
|
||||||
#endif
|
#endif
|
||||||
return HT_INTERRUPTED;
|
return HT_INTERRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != '\n')
|
if (c != '\n')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\n' || c == (char)EOF)
|
if (c == '\n' || c == (char)EOF)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
buffer[count] = c;
|
buffer[count] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c == (char)EOF)
|
if(c == (char)EOF)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
buffer[count] = 0;
|
buffer[count] = 0;
|
||||||
|
|
||||||
/* Parse the input buffer, extract the item type, and the item size */
|
/* Parse the input buffer, extract the item type, and the item size */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
ret=sscanf(buffer,"%c%*9s%*d %*s %*s %s", &itemtype, itemsize);
|
ret=sscanf(buffer,"%c%*9s%*d %*s %*s %s", &itemtype, itemsize);
|
||||||
|
|
||||||
@ -1310,9 +1307,7 @@ char szTime[32];
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer || !*buffer) {
|
if (!*buffer) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usingNLST==2) { /*only name*/
|
if (usingNLST==2) { /*only name*/
|
||||||
strcpy(itemname,buffer);
|
strcpy(itemname,buffer);
|
||||||
@ -1356,7 +1351,7 @@ char szTime[32];
|
|||||||
|
|
||||||
HText_appendText (HT, "<A HREF=\"");
|
HText_appendText (HT, "<A HREF=\"");
|
||||||
/* Assuming it's a relative reference... */
|
/* Assuming it's a relative reference... */
|
||||||
if (itemname && itemname[0] != '/')
|
if (itemname[0] != '/')
|
||||||
{
|
{
|
||||||
HText_appendText (HT, filename);
|
HText_appendText (HT, filename);
|
||||||
if (filename[strlen(filename)-1] != '/')
|
if (filename[strlen(filename)-1] != '/')
|
||||||
@ -1439,9 +1434,9 @@ char szTime[32];
|
|||||||
sprintf(buffer,"<code>%s</code>",full_ftp_name);
|
sprintf(buffer,"<code>%s</code>",full_ftp_name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
format = HTFileFormat(itemname, &pencoding, WWW_SOURCE, &cmpr);
|
format = HTFileFormat(itemname, &pencoding, WWW_SOURCE, &cmpr);
|
||||||
|
|
||||||
if (1)
|
if (1)
|
||||||
{
|
{
|
||||||
HText_appendText(HT, "<IMG SRC=\"");
|
HText_appendText(HT, "<IMG SRC=\"");
|
||||||
@ -1450,9 +1445,9 @@ char szTime[32];
|
|||||||
kind of file it is by extension, throw up the unknown
|
kind of file it is by extension, throw up the unknown
|
||||||
icon; however, if it isn't a link and we can't figure
|
icon; however, if it isn't a link and we can't figure
|
||||||
out what it is, throw up the text icon...
|
out what it is, throw up the text icon...
|
||||||
|
|
||||||
Unless it's compressed. */
|
Unless it's compressed. */
|
||||||
if(itemtype == 'l' && cmpr == COMPRESSED_NOT)
|
if(itemtype == 'l' && cmpr == COMPRESSED_NOT)
|
||||||
{
|
{
|
||||||
/* If it's unknown, let's call it a menu (since symlinks
|
/* If it's unknown, let's call it a menu (since symlinks
|
||||||
are most commonly used on FTP servers to point to
|
are most commonly used on FTP servers to point to
|
||||||
@ -1463,7 +1458,7 @@ char szTime[32];
|
|||||||
{
|
{
|
||||||
HText_appendText(HT, HTgeticonname(format, "text"));
|
HText_appendText(HT, HTgeticonname(format, "text"));
|
||||||
}
|
}
|
||||||
|
|
||||||
HText_appendText(HT, "\"> ");
|
HText_appendText(HT, "\"> ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1484,7 +1479,6 @@ char szTime[32];
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HText_appendText (HT, buffer);
|
HText_appendText (HT, buffer);
|
||||||
#ifndef NEW_PARSE
|
#ifndef NEW_PARSE
|
||||||
HText_appendText (HT, "</A>\n");
|
HText_appendText (HT, "</A>\n");
|
||||||
@ -1495,42 +1489,22 @@ char szTime[32];
|
|||||||
|
|
||||||
nStringLen = strlen(buffer);
|
nStringLen = strlen(buffer);
|
||||||
nSpaces = ftpFilenameLength - nStringLen;
|
nSpaces = ftpFilenameLength - nStringLen;
|
||||||
/*
|
|
||||||
if (itemtype != 'd') {
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (nTime == 1) {
|
if (nTime == 1) {
|
||||||
struct tm *ptr;
|
struct tm *ptr;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
t=time(0);
|
||||||
t=time(0);
|
ptr=localtime(&t);
|
||||||
ptr=localtime(&t);
|
sprintf(szYear,"%d",1900+ptr->tm_year);
|
||||||
sprintf(szYear,"%d",1900+ptr->tm_year);
|
sprintf(szDate, "%*s%9s %s %s %s %2.2s, %s", nSpaces, " ", itemsize, szFileInfo, szTime, szMonth, szDay, szYear);
|
||||||
sprintf(szDate, "%*s%9s %s %s %s %2.2s, %s", nSpaces, " ", itemsize, szFileInfo, szTime, szMonth, szDay, szYear);
|
}
|
||||||
}
|
else if (nTime == 0) {
|
||||||
else if (nTime == 0) {
|
sprintf(szDate, "%*s%9s %s %s %s %2.2s, %s", nSpaces, " ", itemsize, szFileInfo, " ", szMonth, szDay, szYear);
|
||||||
sprintf(szDate, "%*s%9s %s %s %s %2.2s, %s", nSpaces, " ", itemsize, szFileInfo, " ", szMonth, szDay, szYear);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/*nSpaces += strlen(itemsize); */
|
|
||||||
sprintf(szDate, "%*s %9.9s %s %s", nSpaces, " ", itemsize, szMonth, szTime);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nOldSpaces = nSpaces;
|
/*nSpaces += strlen(itemsize); */
|
||||||
nSpaces += 22;
|
sprintf(szDate, "%*s %9.9s %s %s", nSpaces, " ", itemsize, szMonth, szTime);
|
||||||
if (nTime == 1) {
|
|
||||||
sprintf(szDate, "%*s %s %s %2.2s", nSpaces, szFileInfo, szTime, szMonth, szDay);
|
|
||||||
}
|
|
||||||
else if (nTime == 0) {
|
|
||||||
sprintf(szDate, "%*s %s %s %2.2s, %s", nSpaces, szFileInfo, "00:00", szMonth, szDay, szYear);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sprintf(szDate, "%*s %s %s", nOldSpaces, " ", szMonth, szTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if (usingNLST!=2) {
|
if (usingNLST!=2) {
|
||||||
HText_appendText (HT, szDate);
|
HText_appendText (HT, szDate);
|
||||||
@ -2070,7 +2044,7 @@ PUBLIC int HTFTPMkDir ARGS1 ( char *, name )
|
|||||||
{
|
{
|
||||||
char *curpath, *path;
|
char *curpath, *path;
|
||||||
char command[ LINE_LENGTH+1];
|
char command[ LINE_LENGTH+1];
|
||||||
int status, method = 0;
|
int status = 0;
|
||||||
|
|
||||||
HTProgress ("FTP mkdir in progress");
|
HTProgress ("FTP mkdir in progress");
|
||||||
if(fTimerStarted) {
|
if(fTimerStarted) {
|
||||||
@ -2086,7 +2060,7 @@ PUBLIC int HTFTPMkDir ARGS1 ( char *, name )
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The remote directory name is in the url, so pull it out
|
/* The remote directory name is in the url, so pull it out
|
||||||
i.e. ftp://warez.yomama.com/pub/31337&warez_boy
|
i.e. ftp://warez.yomama.com/pub/31337&warez_boy
|
||||||
means to make the directory warez_boy at ftp://warez.yomama.com/pub/31337
|
means to make the directory warez_boy at ftp://warez.yomama.com/pub/31337
|
||||||
*/
|
*/
|
||||||
@ -2094,14 +2068,14 @@ PUBLIC int HTFTPMkDir ARGS1 ( char *, name )
|
|||||||
close_master_socket ();
|
close_master_socket ();
|
||||||
CLOSE_CONTROL (control);
|
CLOSE_CONTROL (control);
|
||||||
control = -1;
|
control = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*path = '\0'; /* Make the url normal */
|
*path = '\0'; /* Make the url normal */
|
||||||
path++; /* Move to the dirname */
|
path++; /* Move to the dirname */
|
||||||
/* *path is the directory name to create */
|
/* *path is the directory name to create */
|
||||||
|
|
||||||
curpath = HTParse (name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
curpath = HTParse (name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
||||||
if (!curpath || !(*curpath))
|
if (!curpath || !(*curpath))
|
||||||
curpath = strdup ("/");
|
curpath = strdup ("/");
|
||||||
/* *curpath is the remote directory in which to create *path */
|
/* *curpath is the remote directory in which to create *path */
|
||||||
|
|
||||||
@ -2112,7 +2086,7 @@ PUBLIC int HTFTPMkDir ARGS1 ( char *, name )
|
|||||||
close_master_socket ();
|
close_master_socket ();
|
||||||
CLOSE_CONTROL (control);
|
CLOSE_CONTROL (control);
|
||||||
control = -1;
|
control = -1;
|
||||||
if (status = HT_INTERRUPTED)
|
if (status = HT_INTERRUPTED)
|
||||||
HTProgress ("Connection interrupted");
|
HTProgress ("Connection interrupted");
|
||||||
return (status==HT_INTERRUPTED)?-2:-1;
|
return (status==HT_INTERRUPTED)?-2:-1;
|
||||||
}
|
}
|
||||||
@ -2124,7 +2098,7 @@ PUBLIC int HTFTPMkDir ARGS1 ( char *, name )
|
|||||||
close_master_socket ();
|
close_master_socket ();
|
||||||
CLOSE_CONTROL (control);
|
CLOSE_CONTROL (control);
|
||||||
control = -1;
|
control = -1;
|
||||||
if (status = HT_INTERRUPTED)
|
if (status = HT_INTERRUPTED)
|
||||||
HTProgress ("Connection interrupted");
|
HTProgress ("Connection interrupted");
|
||||||
return (status==HT_INTERRUPTED)?-2:-1;
|
return (status==HT_INTERRUPTED)?-2:-1;
|
||||||
}
|
}
|
||||||
@ -2145,7 +2119,7 @@ PUBLIC int HTFTPMkDir ARGS1 ( char *, name )
|
|||||||
*/
|
*/
|
||||||
PUBLIC int HTFTPRemove ARGS1 ( char *, name )
|
PUBLIC int HTFTPRemove ARGS1 ( char *, name )
|
||||||
{
|
{
|
||||||
char *fname, *filename, *path;
|
char *fname, *filename;
|
||||||
char command[ LINE_LENGTH+1];
|
char command[ LINE_LENGTH+1];
|
||||||
int status, method = 0, didIt = 0;
|
int status, method = 0, didIt = 0;
|
||||||
|
|
||||||
@ -2165,7 +2139,7 @@ PUBLIC int HTFTPRemove ARGS1 ( char *, name )
|
|||||||
|
|
||||||
/* Pull out the filename (and path) */
|
/* Pull out the filename (and path) */
|
||||||
fname = HTParse (name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
fname = HTParse (name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
||||||
if(!(*fname))
|
if(!(*fname))
|
||||||
StrAllocCopy (filename, "/");
|
StrAllocCopy (filename, "/");
|
||||||
|
|
||||||
/* Pull out just the filename */
|
/* Pull out just the filename */
|
||||||
@ -2182,7 +2156,7 @@ PUBLIC int HTFTPRemove ARGS1 ( char *, name )
|
|||||||
for (method =0; method < 2; method++ ) {
|
for (method =0; method < 2; method++ ) {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
|
|
||||||
/* First, attempt to CWD to fname, if successful, fname is a directory.
|
/* First, attempt to CWD to fname, if successful, fname is a directory.
|
||||||
So, CDUP to get to the parent and call RMD on filename */
|
So, CDUP to get to the parent and call RMD on filename */
|
||||||
case 0:
|
case 0:
|
||||||
sprintf (command, "CWD %s%c%c", fname, CR, LF);
|
sprintf (command, "CWD %s%c%c", fname, CR, LF);
|
||||||
@ -2194,7 +2168,7 @@ PUBLIC int HTFTPRemove ARGS1 ( char *, name )
|
|||||||
close_master_socket ();
|
close_master_socket ();
|
||||||
CLOSE_CONTROL (control);
|
CLOSE_CONTROL (control);
|
||||||
control = -1;
|
control = -1;
|
||||||
if (status == HT_INTERRUPTED)
|
if (status == HT_INTERRUPTED)
|
||||||
HTProgress ("Connection interrupted.");
|
HTProgress ("Connection interrupted.");
|
||||||
return (status == HT_INTERRUPTED)?-2:-1;
|
return (status == HT_INTERRUPTED)?-2:-1;
|
||||||
}
|
}
|
||||||
@ -2206,7 +2180,7 @@ PUBLIC int HTFTPRemove ARGS1 ( char *, name )
|
|||||||
close_master_socket ();
|
close_master_socket ();
|
||||||
CLOSE_CONTROL (control);
|
CLOSE_CONTROL (control);
|
||||||
control = -1;
|
control = -1;
|
||||||
if (status == HT_INTERRUPTED)
|
if (status == HT_INTERRUPTED)
|
||||||
HTProgress ("Connection interrupted.");
|
HTProgress ("Connection interrupted.");
|
||||||
return (status == HT_INTERRUPTED)?-2:-1;
|
return (status == HT_INTERRUPTED)?-2:-1;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,6 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
|
|||||||
if (binary_transfer)
|
if (binary_transfer)
|
||||||
rename_binary_file (me->fnam);
|
rename_binary_file (me->fnam);
|
||||||
|
|
||||||
really_done:
|
|
||||||
free (me->fnam);
|
free (me->fnam);
|
||||||
if (me->mime_type) {
|
if (me->mime_type) {
|
||||||
free(me->mime_type);
|
free(me->mime_type);
|
||||||
|
146
libwww2/HTFile.c
146
libwww2/HTFile.c
@ -116,23 +116,23 @@ PUBLIC void HTSetSuffix ARGS4(
|
|||||||
WWW_CONST char *, encoding,
|
WWW_CONST char *, encoding,
|
||||||
float, value)
|
float, value)
|
||||||
{
|
{
|
||||||
|
|
||||||
HTSuffix * suff;
|
HTSuffix * suff;
|
||||||
|
|
||||||
if (strcmp(suffix, "*")==0) suff = &no_suffix;
|
if (strcmp(suffix, "*")==0) suff = &no_suffix;
|
||||||
else if (strcmp(suffix, "*.*")==0) suff = &unknown_suffix;
|
else if (strcmp(suffix, "*.*")==0) suff = &unknown_suffix;
|
||||||
else {
|
else {
|
||||||
suff = (HTSuffix*) calloc(1, sizeof(HTSuffix));
|
suff = (HTSuffix*) calloc(1, sizeof(HTSuffix));
|
||||||
|
|
||||||
if (suff == NULL) outofmem(__FILE__, "HTSetSuffix");
|
if (suff == NULL) outofmem(__FILE__, "HTSetSuffix");
|
||||||
|
|
||||||
if (!HTSuffixes) HTSuffixes = HTList_new();
|
if (!HTSuffixes) HTSuffixes = HTList_new();
|
||||||
HTList_addObject(HTSuffixes, suff);
|
HTList_addObject(HTSuffixes, suff);
|
||||||
|
|
||||||
StrAllocCopy(suff->suffix, suffix);
|
StrAllocCopy(suff->suffix, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
suff->rep = HTAtom_for(representation);
|
suff->rep = HTAtom_for(representation);
|
||||||
|
|
||||||
{
|
{
|
||||||
char *enc = NULL, *p;
|
char *enc = NULL, *p;
|
||||||
StrAllocCopy(enc, encoding);
|
StrAllocCopy(enc, encoding);
|
||||||
@ -140,7 +140,7 @@ PUBLIC void HTSetSuffix ARGS4(
|
|||||||
suff->encoding = HTAtom_for(enc);
|
suff->encoding = HTAtom_for(enc);
|
||||||
free (enc);
|
free (enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
suff->quality = value;
|
suff->quality = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,10 +165,9 @@ PRIVATE char * vms_name(WWW_CONST char * nn, WWW_CONST char * fn)
|
|||||||
*/
|
*/
|
||||||
static char vmsname[INFINITY]; /* returned */
|
static char vmsname[INFINITY]; /* returned */
|
||||||
char * filename = (char*)malloc(strlen(fn)+1);
|
char * filename = (char*)malloc(strlen(fn)+1);
|
||||||
char * nodename = (char*)malloc(strlen(nn)+2+1); /* Copies to hack */
|
|
||||||
char *second; /* 2nd slash */
|
char *second; /* 2nd slash */
|
||||||
char *last; /* last slash */
|
char *last; /* last slash */
|
||||||
|
|
||||||
char * hostname = HTHostName();
|
char * hostname = HTHostName();
|
||||||
|
|
||||||
if (!filename || !nodename) outofmem(__FILE__, "vms_name");
|
if (!filename || !nodename) outofmem(__FILE__, "vms_name");
|
||||||
@ -189,7 +188,7 @@ PRIVATE char * vms_name(WWW_CONST char * nn, WWW_CONST char * fn)
|
|||||||
|
|
||||||
second = strchr(filename+1, '/'); /* 2nd slash */
|
second = strchr(filename+1, '/'); /* 2nd slash */
|
||||||
last = strrchr(filename, '/'); /* last slash */
|
last = strrchr(filename, '/'); /* last slash */
|
||||||
|
|
||||||
if (!second) { /* Only one slash */
|
if (!second) { /* Only one slash */
|
||||||
sprintf(vmsname, "%s%s", nodename, filename + 1);
|
sprintf(vmsname, "%s%s", nodename, filename + 1);
|
||||||
} else if(second==last) { /* Exactly two slashes */
|
} else if(second==last) { /* Exactly two slashes */
|
||||||
@ -215,56 +214,6 @@ PRIVATE char * vms_name(WWW_CONST char * nn, WWW_CONST char * fn)
|
|||||||
#endif /* vms */
|
#endif /* vms */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Send README file
|
|
||||||
**
|
|
||||||
** If a README file exists, then it is inserted into the document here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef GOT_READ_DIR
|
|
||||||
PRIVATE void do_readme ARGS2(HTStructured *, target, WWW_CONST char *, localname)
|
|
||||||
{
|
|
||||||
FILE * fp;
|
|
||||||
char * readme_file_name =
|
|
||||||
malloc(strlen(localname)+ 1 + strlen(HT_DIR_README_FILE) + 1);
|
|
||||||
strcpy(readme_file_name, localname);
|
|
||||||
strcat(readme_file_name, "/");
|
|
||||||
strcat(readme_file_name, HT_DIR_README_FILE);
|
|
||||||
|
|
||||||
fp = fopen(readme_file_name, "r");
|
|
||||||
|
|
||||||
if (fp) {
|
|
||||||
HTStructuredClass targetClass;
|
|
||||||
|
|
||||||
targetClass = *target->isa; /* (Can't init agregate in K&R) */
|
|
||||||
START(HTML_PRE);
|
|
||||||
for(;;){
|
|
||||||
char c = fgetc(fp);
|
|
||||||
if (c == (char)EOF) break;
|
|
||||||
switch (c) {
|
|
||||||
case '&':
|
|
||||||
case '<':
|
|
||||||
case '>':
|
|
||||||
PUTC('&');
|
|
||||||
PUTC('#');
|
|
||||||
PUTC((char)(c / 10));
|
|
||||||
PUTC((char) (c % 10));
|
|
||||||
PUTC(';');
|
|
||||||
break;
|
|
||||||
/* case '\n':
|
|
||||||
PUTC('\r');
|
|
||||||
Bug removed thanks to joe@athena.mit.edu */
|
|
||||||
default:
|
|
||||||
PUTC(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
END(HTML_PRE);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Make the cache file name for a W3 document
|
/* Make the cache file name for a W3 document
|
||||||
** ------------------------------------------
|
** ------------------------------------------
|
||||||
** Make up a suitable name for saving the node in
|
** Make up a suitable name for saving the node in
|
||||||
@ -280,7 +229,7 @@ PUBLIC char * HTCacheFileName ARGS1(WWW_CONST char *,name)
|
|||||||
char * access = HTParse(name, "", PARSE_ACCESS);
|
char * access = HTParse(name, "", PARSE_ACCESS);
|
||||||
char * host = HTParse(name, "", PARSE_HOST);
|
char * host = HTParse(name, "", PARSE_HOST);
|
||||||
char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
||||||
|
|
||||||
char * result;
|
char * result;
|
||||||
result = (char *)malloc(
|
result = (char *)malloc(
|
||||||
strlen(HTCacheRoot)+strlen(access)
|
strlen(HTCacheRoot)+strlen(access)
|
||||||
@ -314,14 +263,14 @@ PUBLIC char * HTLocalName ARGS1(WWW_CONST char *,name)
|
|||||||
char * access = HTParse(name, "", PARSE_ACCESS);
|
char * access = HTParse(name, "", PARSE_ACCESS);
|
||||||
char * host = HTParse(name, "", PARSE_HOST);
|
char * host = HTParse(name, "", PARSE_HOST);
|
||||||
char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION);
|
||||||
|
|
||||||
HTUnEscape(path); /* Interpret % signs */
|
HTUnEscape(path); /* Interpret % signs */
|
||||||
|
|
||||||
if (0==strcmp(access, "file"))
|
if (0==strcmp(access, "file"))
|
||||||
{
|
{
|
||||||
free(access);
|
free(access);
|
||||||
if (!host || !*host || (0==my_strcasecmp(host, HTHostName())) ||
|
if (!host || !*host || (0==my_strcasecmp(host, HTHostName())) ||
|
||||||
(0==my_strcasecmp(host, "localhost")))
|
(0==my_strcasecmp(host, "localhost")))
|
||||||
{
|
{
|
||||||
if (host)
|
if (host)
|
||||||
free(host);
|
free(host);
|
||||||
@ -867,7 +816,7 @@ PUBLIC void HTDirTitles ARGS2(HTStructured *, target,
|
|||||||
}
|
}
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Load a document
|
/* Load a document
|
||||||
@ -879,7 +828,7 @@ PUBLIC void HTDirTitles ARGS2(HTStructured *, target,
|
|||||||
**
|
**
|
||||||
** On exit,
|
** On exit,
|
||||||
** returns <0 Error has occured.
|
** returns <0 Error has occured.
|
||||||
** HTLOADED OK
|
** HTLOADED OK
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
PUBLIC int HTLoadFile ARGS4 (
|
PUBLIC int HTLoadFile ARGS4 (
|
||||||
@ -891,20 +840,25 @@ PUBLIC int HTLoadFile ARGS4 (
|
|||||||
{
|
{
|
||||||
char * filename;
|
char * filename;
|
||||||
HTFormat format;
|
HTFormat format;
|
||||||
int fd = -1; /* Unix file descriptor number = INVALID */
|
|
||||||
char * nodename = 0;
|
|
||||||
char * newname=0; /* Simplified name of file */
|
char * newname=0; /* Simplified name of file */
|
||||||
HTAtom * encoding; /* @@ not used yet */
|
HTAtom * encoding; /* @@ not used yet */
|
||||||
|
#ifdef vms
|
||||||
|
char * nodename;
|
||||||
|
int fd = -1; /* Unix file descriptor number = INVALID */
|
||||||
|
#endif
|
||||||
int compressed;
|
int compressed;
|
||||||
extern char *HTgeticonname(HTFormat, char *);
|
extern char *HTgeticonname(HTFormat, char *);
|
||||||
|
|
||||||
/* Reduce the filename to a basic form (hopefully unique!)
|
/* Reduce the filename to a basic form (hopefully unique!)
|
||||||
*/
|
*/
|
||||||
StrAllocCopy(newname, addr);
|
StrAllocCopy(newname, addr);
|
||||||
filename=HTParse(newname, "", PARSE_PATH|PARSE_PUNCTUATION);
|
filename=HTParse(newname, "", PARSE_PATH|PARSE_PUNCTUATION);
|
||||||
nodename=HTParse(newname, "", PARSE_HOST);
|
#ifdef vms
|
||||||
|
nodename=
|
||||||
|
#endif
|
||||||
|
HTParse(newname, "", PARSE_HOST);
|
||||||
free(newname);
|
free(newname);
|
||||||
|
|
||||||
format = HTFileFormat(filename, &encoding, WWW_PLAINTEXT, &compressed);
|
format = HTFileFormat(filename, &encoding, WWW_PLAINTEXT, &compressed);
|
||||||
|
|
||||||
|
|
||||||
@ -915,7 +869,7 @@ PUBLIC int HTLoadFile ARGS4 (
|
|||||||
char * vmsname = strchr(filename + 1, '/') ?
|
char * vmsname = strchr(filename + 1, '/') ?
|
||||||
vms_name(nodename, filename) : filename + 1;
|
vms_name(nodename, filename) : filename + 1;
|
||||||
fd = open(vmsname, O_RDONLY, 0);
|
fd = open(vmsname, O_RDONLY, 0);
|
||||||
|
|
||||||
/* If the file wasn't VMS syntax, then perhaps it is ultrix
|
/* If the file wasn't VMS syntax, then perhaps it is ultrix
|
||||||
*/
|
*/
|
||||||
if (fd<0) {
|
if (fd<0) {
|
||||||
@ -936,7 +890,7 @@ PUBLIC int HTLoadFile ARGS4 (
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
free(filename);
|
free(filename);
|
||||||
|
|
||||||
/* For unix, we try to translate the name into the name of a transparently
|
/* For unix, we try to translate the name into the name of a transparently
|
||||||
** mounted file.
|
** mounted file.
|
||||||
**
|
**
|
||||||
@ -944,14 +898,14 @@ PUBLIC int HTLoadFile ARGS4 (
|
|||||||
*/
|
*/
|
||||||
#ifndef NO_UNIX_IO
|
#ifndef NO_UNIX_IO
|
||||||
/* Need protection here for telnet server but not httpd server */
|
/* Need protection here for telnet server but not httpd server */
|
||||||
|
|
||||||
{ /* try local file system */
|
{ /* try local file system */
|
||||||
char * localname = HTLocalName(addr);
|
char * localname = HTLocalName(addr);
|
||||||
struct stat dir_info;
|
struct stat dir_info;
|
||||||
|
|
||||||
if (!localname)
|
if (!localname)
|
||||||
goto suicide;
|
goto suicide;
|
||||||
|
|
||||||
#ifdef GOT_READ_DIR
|
#ifdef GOT_READ_DIR
|
||||||
|
|
||||||
/* Multiformat handling
|
/* Multiformat handling
|
||||||
@ -984,13 +938,12 @@ forget_multi:
|
|||||||
return HTLoadError(sink, 500,
|
return HTLoadError(sink, 500,
|
||||||
"Multiformat: directory scan failed.");
|
"Multiformat: directory scan failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (dirbuf = readdir(dp)) {
|
while (dirbuf = readdir(dp)) {
|
||||||
/* while there are directory entries to be read */
|
/* while there are directory entries to be read */
|
||||||
if (dirbuf->d_ino == 0) continue;
|
if (dirbuf->d_ino == 0) continue;
|
||||||
/* if the entry is not being used, skip it */
|
/* if the entry is not being used, skip it */
|
||||||
|
|
||||||
if (!strncmp(dirbuf->d_name, base, baselen)) {
|
if (!strncmp(dirbuf->d_name, base, baselen)) {
|
||||||
HTFormat rep = HTFileFormat(dirbuf->d_name, &encoding,
|
HTFormat rep = HTFileFormat(dirbuf->d_name, &encoding,
|
||||||
WWW_PLAINTEXT, &compressed);
|
WWW_PLAINTEXT, &compressed);
|
||||||
float value = HTStackValue(rep, format_out,
|
float value = HTStackValue(rep, format_out,
|
||||||
@ -1007,19 +960,18 @@ forget_multi:
|
|||||||
best = value;
|
best = value;
|
||||||
best_dirbuf = *dirbuf;
|
best_dirbuf = *dirbuf;
|
||||||
}
|
}
|
||||||
} /* if best so far */
|
} /* if best so far */
|
||||||
} /* if match */
|
} /* if match */
|
||||||
|
|
||||||
} /* end while directory entries left to read */
|
} /* end while directory entries left to read */
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
|
|
||||||
if (best_rep) {
|
if (best_rep) {
|
||||||
format = best_rep;
|
format = best_rep;
|
||||||
base[-1] = '/'; /* Restore directory name */
|
base[-1] = '/'; /* Restore directory name */
|
||||||
base[0] = 0;
|
base[0] = 0;
|
||||||
StrAllocCat(localname, best_dirbuf.d_name);
|
StrAllocCat(localname, best_dirbuf.d_name);
|
||||||
goto open_file;
|
goto open_file;
|
||||||
|
|
||||||
} else { /* If not found suitable file */
|
} else { /* If not found suitable file */
|
||||||
free(localname);
|
free(localname);
|
||||||
return HTLoadError(sink, 403, /* List formats? */
|
return HTLoadError(sink, 403, /* List formats? */
|
||||||
@ -1029,25 +981,25 @@ forget_multi:
|
|||||||
} /* if multi suffix */
|
} /* if multi suffix */
|
||||||
/*
|
/*
|
||||||
** Check to see if the 'localname' is in fact a directory. If it is
|
** Check to see if the 'localname' is in fact a directory. If it is
|
||||||
** create a new hypertext object containing a list of files and
|
** create a new hypertext object containing a list of files and
|
||||||
** subdirectories contained in the directory. All of these are links
|
** subdirectories contained in the directory. All of these are links
|
||||||
** to the directories or files listed.
|
** to the directories or files listed.
|
||||||
** NB This assumes the existance of a type 'STRUCT_DIRENT', which will
|
** NB This assumes the existance of a type 'STRUCT_DIRENT', which will
|
||||||
** hold the directory entry, and a type 'DIR' which is used to point to
|
** hold the directory entry, and a type 'DIR' which is used to point to
|
||||||
** the current directory being read.
|
** the current directory being read.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (stat(localname,&dir_info) == -1) { /* get file information */
|
if (stat(localname,&dir_info) == -1) { /* get file information */
|
||||||
/* if can't read file information */
|
/* if can't read file information */
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if (www2Trace) fprintf(stderr, "HTFile: can't stat %s\n", localname);
|
if (www2Trace) fprintf(stderr, "HTFile: can't stat %s\n", localname);
|
||||||
#endif
|
#endif
|
||||||
} else { /* Stat was OK */
|
} else { /* Stat was OK */
|
||||||
|
|
||||||
|
|
||||||
if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) {
|
if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) {
|
||||||
/* if localname is a directory */
|
/* if localname is a directory */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**
|
**
|
||||||
@ -1073,7 +1025,7 @@ forget_multi:
|
|||||||
|
|
||||||
char filepath[MAXPATHLEN];
|
char filepath[MAXPATHLEN];
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char *dataptr;
|
char *dataptr;
|
||||||
|
|
||||||
@ -1091,7 +1043,7 @@ forget_multi:
|
|||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if (www2Trace)
|
if (www2Trace)
|
||||||
fprintf(stderr,"%s is a directory\n",localname);
|
fprintf(stderr,"%s is a directory\n",localname);
|
||||||
#endif
|
#endif
|
||||||
/* Check directory access.
|
/* Check directory access.
|
||||||
** Selective access means only those directories containing a
|
** Selective access means only those directories containing a
|
||||||
** marker file can be browsed
|
** marker file can be browsed
|
||||||
@ -1104,7 +1056,7 @@ forget_multi:
|
|||||||
|
|
||||||
|
|
||||||
if (HTDirAccess == HT_DIR_SELECTIVE) {
|
if (HTDirAccess == HT_DIR_SELECTIVE) {
|
||||||
char * enable_file_name =
|
char * enable_file_name =
|
||||||
malloc(strlen(localname)+ 1 +
|
malloc(strlen(localname)+ 1 +
|
||||||
strlen(HT_DIR_ENABLE_FILE) + 1);
|
strlen(HT_DIR_ENABLE_FILE) + 1);
|
||||||
strcpy(enable_file_name, localname);
|
strcpy(enable_file_name, localname);
|
||||||
@ -1117,7 +1069,7 @@ forget_multi:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dfp = opendir(localname);
|
dfp = opendir(localname);
|
||||||
if (!dfp) {
|
if (!dfp) {
|
||||||
free(localname);
|
free(localname);
|
||||||
@ -1136,7 +1088,7 @@ forget_multi:
|
|||||||
return HTLoadError(sink, 403, "Ran out of memory in directory read!");
|
return HTLoadError(sink, 403, "Ran out of memory in directory read!");
|
||||||
}
|
}
|
||||||
strcpy(ptr,dp->d_name);
|
strcpy(ptr,dp->d_name);
|
||||||
|
|
||||||
HTSortAdd(ptr);
|
HTSortAdd(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,14 +1105,14 @@ forget_multi:
|
|||||||
HText_appendText(HT, "<H1>Local Directory ");
|
HText_appendText(HT, "<H1>Local Directory ");
|
||||||
HText_appendText(HT, localname);
|
HText_appendText(HT, localname);
|
||||||
HText_appendText(HT, "</H1>\n");
|
HText_appendText(HT, "</H1>\n");
|
||||||
HText_appendText(HT,"<DL>\n");
|
HText_appendText(HT,"<DL>\n");
|
||||||
|
|
||||||
/* Sort the list and then spit it out in a nice form */
|
/* Sort the list and then spit it out in a nice form */
|
||||||
|
|
||||||
/* How this for a disgusting loop :) */
|
/* How this for a disgusting loop :) */
|
||||||
|
|
||||||
for(count=0,dataptr=HTSortFetch(count);
|
for(count=0,dataptr=HTSortFetch(count);
|
||||||
dataptr != NULL;
|
dataptr != NULL;
|
||||||
free(dataptr), count++, dataptr=HTSortFetch(count))
|
free(dataptr), count++, dataptr=HTSortFetch(count))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1180,7 +1132,7 @@ forget_multi:
|
|||||||
|
|
||||||
ptr = strrchr(buffer, '/');
|
ptr = strrchr(buffer, '/');
|
||||||
|
|
||||||
if(ptr != NULL) *ptr='\0';
|
if(ptr != NULL) *ptr='\0';
|
||||||
|
|
||||||
if(buffer[0] == '\0') strcpy(buffer,"/");
|
if(buffer[0] == '\0') strcpy(buffer,"/");
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ PRIVATE BOOL acceptable_inited = NO;
|
|||||||
PRIVATE void init_acceptable NOARGS
|
PRIVATE void init_acceptable NOARGS
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char * good =
|
char * good =
|
||||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$";
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$";
|
||||||
for(i=0; i<256; i++) acceptable[i] = NO;
|
for(i=0; i<256; i++) acceptable[i] = NO;
|
||||||
for(;*good; good++) acceptable[(unsigned int)*good] = YES;
|
for(;*good; good++) acceptable[(unsigned int)*good] = YES;
|
||||||
@ -100,18 +100,6 @@ PRIVATE void init_acceptable NOARGS
|
|||||||
|
|
||||||
PRIVATE WWW_CONST char hex[17] = "0123456789abcdef";
|
PRIVATE WWW_CONST char hex[17] = "0123456789abcdef";
|
||||||
|
|
||||||
/* Decode one hex character
|
|
||||||
*/
|
|
||||||
|
|
||||||
PRIVATE char from_hex ARGS1(char, c)
|
|
||||||
{
|
|
||||||
return (c>='0')&&(c<='9') ? c-'0'
|
|
||||||
: (c>='A')&&(c<='F') ? c-'A'+10
|
|
||||||
: (c>='a')&&(c<='f') ? c-'a'+10
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Paste in an Anchor
|
/* Paste in an Anchor
|
||||||
** ------------------
|
** ------------------
|
||||||
@ -138,7 +126,7 @@ PRIVATE void write_anchor ARGS3(WWW_CONST char *,text, WWW_CONST char *,addr,
|
|||||||
PUTS (image_text);
|
PUTS (image_text);
|
||||||
PUTS ("\"> ");
|
PUTS ("\"> ");
|
||||||
}
|
}
|
||||||
|
|
||||||
PUTS(text);
|
PUTS(text);
|
||||||
PUTS("</A>");
|
PUTS("</A>");
|
||||||
}
|
}
|
||||||
@ -171,20 +159,19 @@ PRIVATE int parse_menu ARGS2 (
|
|||||||
char ch;
|
char ch;
|
||||||
char line[BIG];
|
char line[BIG];
|
||||||
char address[BIG];
|
char address[BIG];
|
||||||
char *name, *selector; /* Gopher menu fields */
|
char *name, *selector = NULL; /* Gopher menu fields */
|
||||||
char *host;
|
char *host;
|
||||||
char *port;
|
char *port;
|
||||||
char *p = line;
|
char *p = line;
|
||||||
extern int interrupted_in_htgetcharacter;
|
extern int interrupted_in_htgetcharacter;
|
||||||
WWW_CONST char *title;
|
|
||||||
|
|
||||||
#define TAB '\t'
|
#define TAB '\t'
|
||||||
#define HEX_ESCAPE '%'
|
#define HEX_ESCAPE '%'
|
||||||
|
|
||||||
HTProgress ("Retrieving Gopher menu.");
|
HTProgress ("Retrieving Gopher menu.");
|
||||||
|
|
||||||
PUTS("<H1>Gopher Menu</H1>\n");
|
PUTS("<H1>Gopher Menu</H1>\n");
|
||||||
|
|
||||||
START(HTML_DL);
|
START(HTML_DL);
|
||||||
while ((ch=HTGetCharacter ()) != (char)EOF)
|
while ((ch=HTGetCharacter ()) != (char)EOF)
|
||||||
{
|
{
|
||||||
|
@ -31,10 +31,8 @@ struct _HTStructured
|
|||||||
|
|
||||||
|
|
||||||
/* Module-wide variables
|
/* Module-wide variables
|
||||||
*/
|
*/
|
||||||
PRIVATE int s; /* Socket for FingerHost */
|
PRIVATE int s; /* Socket for FingerHost */
|
||||||
PRIVATE HTStructured * target; /* The output sink */
|
|
||||||
PRIVATE HTStructuredClass targetClass; /* Copy of fn addresses */
|
|
||||||
|
|
||||||
extern int GetMailtoKludgeInfo();
|
extern int GetMailtoKludgeInfo();
|
||||||
|
|
||||||
|
249
libwww2/HTNews.c
249
libwww2/HTNews.c
@ -246,13 +246,12 @@ PRIVATE BOOL match ARGS2 (WWW_CONST char *,unknown, WWW_CONST char *,template)
|
|||||||
Returns: pointer to em
|
Returns: pointer to em
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
Parse str for an email address and author name in the email@host (name)
|
Parse str for an email address and author name in the email@host (name)
|
||||||
or name <email@host> forms. This destroys the source string. If
|
or name <email@host> forms. This destroys the source string. If
|
||||||
either name of em is NULL, the value will not be returned.
|
either name of em is NULL, the value will not be returned.
|
||||||
*/
|
*/
|
||||||
char *parseemail (char *str, char *name, char *em)
|
char *parseemail (char *str, char *name, char *em)
|
||||||
{
|
{
|
||||||
char *c, d;
|
|
||||||
char *email, *end;
|
char *email, *end;
|
||||||
|
|
||||||
/* Pull out email address */
|
/* Pull out email address */
|
||||||
@ -400,14 +399,13 @@ static char b64_tab[256] = {
|
|||||||
|
|
||||||
int base64line(FILE *fp, char *buf)
|
int base64line(FILE *fp, char *buf)
|
||||||
{
|
{
|
||||||
int last_data = 0;
|
|
||||||
unsigned char *p = (unsigned char *) buf;
|
unsigned char *p = (unsigned char *) buf;
|
||||||
|
|
||||||
if(!buf || !*buf || isspace(*buf)){
|
if(!buf || !*buf || isspace(*buf)){
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following implementation of the base64 decoding might look
|
/* The following implementation of the base64 decoding might look
|
||||||
a bit clumsy but I only try to follow the POSIX standard:
|
a bit clumsy but I only try to follow the POSIX standard:
|
||||||
``All line breaks or other characters not found in the table
|
``All line breaks or other characters not found in the table
|
||||||
@ -416,35 +414,34 @@ int base64line(FILE *fp, char *buf)
|
|||||||
while (*p){
|
while (*p){
|
||||||
char c1, c2, c3;
|
char c1, c2, c3;
|
||||||
|
|
||||||
while ((b64_tab[*p] & '\100') != 0)
|
while ((b64_tab[*p] & '\100') != 0)
|
||||||
if (!*p || *p++ == '=') break;
|
if (!*p || *p++ == '=') break;
|
||||||
|
|
||||||
if (!*p) continue; /* This leaves the loop. */
|
if (!*p) continue; /* This leaves the loop. */
|
||||||
|
|
||||||
c1 = b64_tab[*p++];
|
c1 = b64_tab[*p++];
|
||||||
|
|
||||||
while ((b64_tab[*p] & '\100') != 0) {
|
while ((b64_tab[*p] & '\100') != 0) {
|
||||||
if (!*p || *p++ == '=') {
|
if (!*p || *p++ == '=') {
|
||||||
HTProgress("illegal base64 line");
|
HTProgress("illegal base64 line");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c2 = b64_tab[*p++];
|
c2 = b64_tab[*p++];
|
||||||
|
|
||||||
while (b64_tab[*p] == '\177') {
|
while (b64_tab[*p] == '\177') {
|
||||||
if (!*p++) {
|
if (!*p++) {
|
||||||
HTProgress("illegal base64 line");
|
HTProgress("illegal base64 line");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p == '=') {
|
if (*p == '=') {
|
||||||
fputc(c1 << 2 | c2 >> 4,fp);
|
fputc(c1 << 2 | c2 >> 4,fp);
|
||||||
last_data = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
c3 = b64_tab[*p++];
|
c3 = b64_tab[*p++];
|
||||||
|
|
||||||
while (b64_tab[*p] == '\177') {
|
while (b64_tab[*p] == '\177') {
|
||||||
@ -453,7 +450,7 @@ int base64line(FILE *fp, char *buf)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fputc(c1 << 2 | c2 >> 4,fp);
|
fputc(c1 << 2 | c2 >> 4,fp);
|
||||||
fputc(c2 << 4 | c3 >> 2,fp);
|
fputc(c2 << 4 | c3 >> 2,fp);
|
||||||
if (*p == '=') {
|
if (*p == '=') {
|
||||||
@ -464,7 +461,7 @@ int base64line(FILE *fp, char *buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
@ -491,7 +488,7 @@ void freeart(NewsArt *art)
|
|||||||
PRIVATE void ClearArtList NOARGS
|
PRIVATE void ClearArtList NOARGS
|
||||||
{
|
{
|
||||||
NewsArt *temp,*tnext,*temp2,*tnext2;
|
NewsArt *temp,*tnext,*temp2,*tnext2;
|
||||||
|
|
||||||
temp = FirstArt;
|
temp = FirstArt;
|
||||||
while(temp) {
|
while(temp) {
|
||||||
tnext = temp->nextt;
|
tnext = temp->nextt;
|
||||||
@ -539,7 +536,7 @@ PRIVATE NewsArt *NewArt NOARGS
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* AddArtTop ()
|
/* AddArtTop ()
|
||||||
Add an Article to the thread chain
|
Add an Article to the thread chain
|
||||||
*/
|
*/
|
||||||
PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
|
PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
|
||||||
{
|
{
|
||||||
@ -574,7 +571,7 @@ PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
|
|||||||
add->prevt = add->nextt = NULL;
|
add->prevt = add->nextt = NULL;
|
||||||
add->next = NULL;
|
add->next = NULL;
|
||||||
add->prev = temp;
|
add->prev = temp;
|
||||||
|
|
||||||
temp->next = add;
|
temp->next = add;
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise, tack it onto the back of the list */
|
/* Otherwise, tack it onto the back of the list */
|
||||||
@ -846,12 +843,12 @@ PRIVATE int OpenNNTP NOARGS
|
|||||||
if ((response(NULL) / 100) !=2) {
|
if ((response(NULL) / 100) !=2) {
|
||||||
NETCLOSE(s);
|
NETCLOSE(s);
|
||||||
s = -1;
|
s = -1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Interface with news-gui.c and various others... */
|
/* Interface with news-gui.c and various others... */
|
||||||
@ -865,7 +862,7 @@ static char qline[LINE_LENGTH+1];
|
|||||||
char *NNTPgetquoteline(char *art)
|
char *NNTPgetquoteline(char *art)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int i,f,status ;
|
int i,status;
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
initialized = initialize();
|
initialized = initialize();
|
||||||
@ -876,7 +873,7 @@ char *NNTPgetquoteline(char *art)
|
|||||||
HTProgress ("Could not set up news connection.");
|
HTProgress ("Could not set up news connection.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s < 0) {
|
if(s < 0) {
|
||||||
HTProgress("Attempting to connect to news server");
|
HTProgress("Attempting to connect to news server");
|
||||||
if(OpenNNTP()){
|
if(OpenNNTP()){
|
||||||
@ -893,7 +890,7 @@ char *NNTPgetquoteline(char *art)
|
|||||||
HTInitInput(s);
|
HTInitInput(s);
|
||||||
sprintf(qline, "BODY <%s>%c%c", art, CR, LF);
|
sprintf(qline, "BODY <%s>%c%c", art, CR, LF);
|
||||||
status = response(qline);
|
status = response(qline);
|
||||||
|
|
||||||
if (status != 222) return NULL;
|
if (status != 222) return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -957,9 +954,9 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|||||||
HTInitInput(s);
|
HTInitInput(s);
|
||||||
sprintf(buffer, "HEAD <%s>%c%c", art, CR, LF);
|
sprintf(buffer, "HEAD <%s>%c%c", art, CR, LF);
|
||||||
status = response(buffer);
|
status = response(buffer);
|
||||||
|
|
||||||
if (status == 221) { /* Head follows - parse it:*/
|
if (status == 221) { /* Head follows - parse it:*/
|
||||||
|
|
||||||
p = line; /* Write pointer */
|
p = line; /* Write pointer */
|
||||||
done = NO;
|
done = NO;
|
||||||
while(!done){
|
while(!done){
|
||||||
@ -968,27 +965,27 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|||||||
abort_socket(); /* End of file, close socket */
|
abort_socket(); /* End of file, close socket */
|
||||||
return -1; /* End of file on response */
|
return -1; /* End of file on response */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ch == LF)
|
if ((ch == LF)
|
||||||
|| (p == &line[LINE_LENGTH]) ) {
|
|| (p == &line[LINE_LENGTH]) ) {
|
||||||
|
|
||||||
*--p=0; /* Terminate & chop LF*/
|
*--p=0; /* Terminate & chop LF*/
|
||||||
p = line; /* Restart at beginning */
|
p = line; /* Restart at beginning */
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if (www2Trace) fprintf(stderr, "G %s\n", line);
|
if (www2Trace) fprintf(stderr, "G %s\n", line);
|
||||||
#endif
|
#endif
|
||||||
switch(line[0]) {
|
switch(line[0]) {
|
||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
done = (line[1]<' '); /* End of article? */
|
done = (line[1]<' '); /* End of article? */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
case 's':
|
case 's':
|
||||||
if (match(line, "SUBJECT:"))
|
if (match(line, "SUBJECT:"))
|
||||||
StrAllocCopy(*subj, line+9);/* Save subject */
|
StrAllocCopy(*subj, line+9);/* Save subject */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
case 'r':
|
case 'r':
|
||||||
if (match(line, "REFERENCES:")) {
|
if (match(line, "REFERENCES:")) {
|
||||||
@ -996,7 +993,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|||||||
StrAllocCopy(*ref,p+1);
|
StrAllocCopy(*ref,p+1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
case 'n':
|
case 'n':
|
||||||
if (match(line, "NEWSGROUPS:")) {
|
if (match(line, "NEWSGROUPS:")) {
|
||||||
@ -1004,7 +1001,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|||||||
StrAllocCopy(*grp,p+1);
|
StrAllocCopy(*grp,p+1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
case 'F':
|
case 'F':
|
||||||
if (match(line, "FROM:")) {
|
if (match(line, "FROM:")) {
|
||||||
@ -1020,9 +1017,9 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} /* end switch on first character */
|
} /* end switch on first character */
|
||||||
|
|
||||||
p = line; /* Restart at beginning */
|
p = line; /* Restart at beginning */
|
||||||
} /* if end of line */
|
} /* if end of line */
|
||||||
} /* Loop over characters */
|
} /* Loop over characters */
|
||||||
@ -1034,7 +1031,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|||||||
int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
initialized = initialize();
|
initialized = initialize();
|
||||||
if (!initialized){
|
if (!initialized){
|
||||||
@ -1044,7 +1041,7 @@ int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
|||||||
HTProgress ("Could not set up news connection.");
|
HTProgress ("Could not set up news connection.");
|
||||||
return HT_NOT_LOADED; /* FAIL */
|
return HT_NOT_LOADED; /* FAIL */
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s < 0) {
|
if(s < 0) {
|
||||||
HTProgress("Attempting to connect to news server");
|
HTProgress("Attempting to connect to news server");
|
||||||
if(OpenNNTP()){
|
if(OpenNNTP()){
|
||||||
@ -1055,7 +1052,7 @@ int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
|||||||
return HT_NOT_LOADED; /* FAIL */
|
return HT_NOT_LOADED; /* FAIL */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response("POST\r\n") != 340) {
|
if(response("POST\r\n") != 340) {
|
||||||
HTProgress("Server does not allow posting.");
|
HTProgress("Server does not allow posting.");
|
||||||
return 0;
|
return 0;
|
||||||
@ -1113,10 +1110,10 @@ NewsArt *is_news_url(char *s)
|
|||||||
/* These are called by their gui_news_* counterparts in gui-news.c */
|
/* These are called by their gui_news_* counterparts in gui-news.c */
|
||||||
|
|
||||||
/* Beginning in 2.7b4, these now return the next/prev unread article/thread ,
|
/* Beginning in 2.7b4, these now return the next/prev unread article/thread ,
|
||||||
unless newsShowAllArticles is True. The previous unread article/thread
|
unless newsShowAllArticles is True. The previous unread article/thread
|
||||||
is set in the news_next functions.
|
is set in the news_next functions.
|
||||||
|
|
||||||
news_next will now continue onto the next thread unless newsNoThreadJumping
|
news_next will now continue onto the next thread unless newsNoThreadJumping
|
||||||
is True.
|
is True.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1124,7 +1121,7 @@ NewsArt *nextUnreadThread (NewsArt *art);
|
|||||||
NewsArt *prevUnreadThread (NewsArt *art);
|
NewsArt *prevUnreadThread (NewsArt *art);
|
||||||
|
|
||||||
/* Return first unread article in list (thread) */
|
/* Return first unread article in list (thread) */
|
||||||
NewsArt *firstUnread (NewsArt *art)
|
NewsArt *firstUnread (NewsArt *art)
|
||||||
{
|
{
|
||||||
NewsArt *a;
|
NewsArt *a;
|
||||||
newsgroup_t *tempNewsGroupS = NULL;
|
newsgroup_t *tempNewsGroupS = NULL;
|
||||||
@ -1148,7 +1145,7 @@ NewsArt *firstUnread (NewsArt *art)
|
|||||||
|
|
||||||
|
|
||||||
/* return next unread article after art */
|
/* return next unread article after art */
|
||||||
NewsArt *nextUnread (NewsArt *art, int probe)
|
NewsArt *nextUnread (NewsArt *art, int probe)
|
||||||
{
|
{
|
||||||
NewsArt *a;
|
NewsArt *a;
|
||||||
newsgroup_t *tempNewsGroupS = NULL;
|
newsgroup_t *tempNewsGroupS = NULL;
|
||||||
@ -1175,11 +1172,11 @@ NewsArt *nextUnread (NewsArt *art, int probe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return first unread thread in list */
|
/* Return first unread thread in list */
|
||||||
NewsArt *firstUnreadThread (NewsArt *art)
|
NewsArt *firstUnreadThread (NewsArt *art)
|
||||||
{
|
{
|
||||||
NewsArt *t, *a;
|
NewsArt *t, *a;
|
||||||
|
|
||||||
if (!art)
|
if (!art)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!newsUseNewsRC || newsShowAllArticles || !newsNextIsUnread)
|
if (!newsUseNewsRC || newsShowAllArticles || !newsNextIsUnread)
|
||||||
@ -1196,7 +1193,7 @@ NewsArt *firstUnreadThread (NewsArt *art)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return next unread thread in list */
|
/* Return next unread thread in list */
|
||||||
NewsArt *nextUnreadThread (NewsArt *art)
|
NewsArt *nextUnreadThread (NewsArt *art)
|
||||||
{
|
{
|
||||||
NewsArt *t;
|
NewsArt *t;
|
||||||
|
|
||||||
@ -1265,15 +1262,15 @@ NewsArt *prevUnreadThread (NewsArt *art)
|
|||||||
|
|
||||||
/* Goto the previous (unread) thread */
|
/* Goto the previous (unread) thread */
|
||||||
void news_prevt(char *url)
|
void news_prevt(char *url)
|
||||||
{
|
{
|
||||||
NewsArt *art, *p;
|
NewsArt *art, *p;
|
||||||
|
|
||||||
if (art = is_news_url (url)) {
|
if (art = is_news_url (url)) {
|
||||||
if ((p = prevUnreadThread (art)) != NULL) {
|
if ((p = prevUnreadThread (art)) != NULL) {
|
||||||
sprintf (url, "news:%s", p->ID);
|
sprintf (url, "news:%s", p->ID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
url[0] = 0;
|
url[0] = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1282,7 +1279,7 @@ void news_prevt(char *url)
|
|||||||
void news_nextt(char *url)
|
void news_nextt(char *url)
|
||||||
{
|
{
|
||||||
NewsArt *art, *p;
|
NewsArt *art, *p;
|
||||||
|
|
||||||
if ((art = is_news_url(url)) != NULL) {
|
if ((art = is_news_url(url)) != NULL) {
|
||||||
if ((p=nextUnreadThread (art))) {
|
if ((p=nextUnreadThread (art))) {
|
||||||
sprintf (url, "news:%s", p->ID);
|
sprintf (url, "news:%s", p->ID);
|
||||||
@ -1299,7 +1296,7 @@ void news_prev(char *url)
|
|||||||
{
|
{
|
||||||
NewsArt *art, *p;
|
NewsArt *art, *p;
|
||||||
|
|
||||||
if ((art = is_news_url(url)) == NULL) {
|
if ((art = is_news_url(url)) == NULL) {
|
||||||
url[0] = 0;
|
url[0] = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1347,24 +1344,24 @@ void news_index(char *url)
|
|||||||
/* Returns the status of the news buttons */
|
/* Returns the status of the news buttons */
|
||||||
void news_status(char *url, int *prevt, int *nextt, int *prev, int *next, int *follow)
|
void news_status(char *url, int *prevt, int *nextt, int *prev, int *next, int *follow)
|
||||||
{
|
{
|
||||||
NewsArt *art,*tmp;
|
NewsArt *art;
|
||||||
|
|
||||||
if( art = is_news_url(url) ) {
|
if( art = is_news_url(url) ) {
|
||||||
if(prevUnread(art,!newsNoThreadJumping))
|
if(prevUnread(art,!newsNoThreadJumping))
|
||||||
*prev = 1;
|
*prev = 1;
|
||||||
else
|
else
|
||||||
*prev = 0;
|
*prev = 0;
|
||||||
|
|
||||||
if(prevUnreadThread(art))
|
if(prevUnreadThread(art))
|
||||||
*prevt = 1;
|
*prevt = 1;
|
||||||
else
|
else
|
||||||
*prevt = 0;
|
*prevt = 0;
|
||||||
|
|
||||||
if (nextUnread (art,!newsNoThreadJumping))
|
if (nextUnread (art,!newsNoThreadJumping))
|
||||||
*next = 1;
|
*next = 1;
|
||||||
else
|
else
|
||||||
*next = 0;
|
*next = 0;
|
||||||
|
|
||||||
if (nextUnreadThread (art))
|
if (nextUnreadThread (art))
|
||||||
*nextt = 1;
|
*nextt = 1;
|
||||||
else
|
else
|
||||||
@ -1389,7 +1386,7 @@ void news_status(char *url, int *prevt, int *nextt, int *prev, int *next, int *f
|
|||||||
|
|
||||||
Returns: pointer to a static spaces string, each call to make spaces will
|
Returns: pointer to a static spaces string, each call to make spaces will
|
||||||
overwrite this buffer.
|
overwrite this buffer.
|
||||||
|
|
||||||
Notes: this takes the string in str and makes a string of spaces that will
|
Notes: this takes the string in str and makes a string of spaces that will
|
||||||
(when concatenated with str) form a string len spaces long.
|
(when concatenated with str) form a string len spaces long.
|
||||||
*/
|
*/
|
||||||
@ -1435,21 +1432,21 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
char *references=NULL; /* Hrefs for other articles */
|
char *references=NULL; /* Hrefs for other articles */
|
||||||
char *newsgroups=NULL; /* Newsgroups list */
|
char *newsgroups=NULL; /* Newsgroups list */
|
||||||
char *from=NULL,*subj=NULL,*org=NULL,*date=NULL;
|
char *from=NULL,*subj=NULL,*org=NULL,*date=NULL;
|
||||||
char *filename;
|
char *filename=NULL;
|
||||||
char *l = line;
|
char *l = line;
|
||||||
int f; /* ':' flag */
|
int f; /* ':' flag */
|
||||||
int decode=0; /*uudecoding...*/
|
int decode=0; /*uudecoding...*/
|
||||||
FILE *fp;
|
FILE *fp = NULL;
|
||||||
|
|
||||||
char *p = line,*pp,*m;
|
char *p = line,*pp,*m;
|
||||||
BOOL done = NO;
|
BOOL done = NO;
|
||||||
|
|
||||||
NewsArt *art,*art2,*art_t, *next;
|
NewsArt *art,*art2,*next;
|
||||||
int ll;
|
int ll;
|
||||||
|
|
||||||
|
|
||||||
HTMeter(0,NULL);
|
HTMeter(0,NULL);
|
||||||
|
|
||||||
ll= strlen(artID)-3; /* ">\n\r" should be stripped outside !!! */
|
ll= strlen(artID)-3; /* ">\n\r" should be stripped outside !!! */
|
||||||
for(art = FirstArt; art; art = art -> nextt){
|
for(art = FirstArt; art; art = art -> nextt){
|
||||||
if(!strncmp(art->ID,artID,ll)) break;
|
if(!strncmp(art->ID,artID,ll)) break;
|
||||||
@ -1462,16 +1459,16 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(art) {
|
if(art) {
|
||||||
CurrentArt = art;
|
CurrentArt = art;
|
||||||
} else {
|
} else {
|
||||||
CurrentArt = NULL;
|
CurrentArt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in the HEADer of the article:
|
/* Read in the HEADer of the article:
|
||||||
**
|
**
|
||||||
** The header fields are either ignored, or formatted
|
** The header fields are either ignored, or formatted
|
||||||
** and put into the text.
|
** and put into the text.
|
||||||
*/
|
*/
|
||||||
while(!done){
|
while(!done){
|
||||||
@ -1480,7 +1477,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
abort_socket(); /* End of file, close socket */
|
abort_socket(); /* End of file, close socket */
|
||||||
return; /* End of file on response */
|
return; /* End of file on response */
|
||||||
}
|
}
|
||||||
if ((ch == LF) || (p == &line[LINE_LENGTH])) {
|
if ((ch == LF) || (p == &line[LINE_LENGTH])) {
|
||||||
*--p=0; /* Terminate the string */
|
*--p=0; /* Terminate the string */
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if (www2Trace) fprintf(stderr, "H %s\n", line);
|
if (www2Trace) fprintf(stderr, "H %s\n", line);
|
||||||
@ -1529,16 +1526,16 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
references = strdup(&line[11]);
|
references = strdup(&line[11]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* unknown headers ignored */
|
/* unknown headers ignored */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = line; /* Restart at beginning */
|
p = line; /* Restart at beginning */
|
||||||
} /* if end of line */
|
} /* if end of line */
|
||||||
} /* Loop over characters */
|
} /* Loop over characters */
|
||||||
|
|
||||||
if(subj) {
|
if(subj) {
|
||||||
PUTS("<H2>");
|
PUTS("<H2>");
|
||||||
PUTS(subj);
|
PUTS(subj);
|
||||||
@ -1557,15 +1554,15 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
PUTS(", ");
|
PUTS(", ");
|
||||||
PUTS(org);
|
PUTS(org);
|
||||||
free(org);
|
free(org);
|
||||||
}
|
}
|
||||||
PUTS("</I><BR>\n");
|
PUTS("</I><BR>\n");
|
||||||
}
|
}
|
||||||
if(from) {
|
if(from) {
|
||||||
PUTS("<B>From:</B> <I>");
|
PUTS("<B>From:</B> <I>");
|
||||||
if (parseemail (from,duff,buf)) {
|
if (parseemail (from,duff,buf)) {
|
||||||
sprintf (line, "<A HREF=\"mailto:%s\"> %s </A> ", buf, duff);
|
sprintf (line, "<A HREF=\"mailto:%s\"> %s </A> ", buf, duff);
|
||||||
PUTS (line);
|
PUTS (line);
|
||||||
} else
|
} else
|
||||||
PUTS (from);
|
PUTS (from);
|
||||||
PUTS("</I><BR>");
|
PUTS("</I><BR>");
|
||||||
free(from);
|
free(from);
|
||||||
@ -1592,7 +1589,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
PUTS(line);
|
PUTS(line);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!*p) break;
|
if(!*p) break;
|
||||||
@ -1601,18 +1598,18 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
free(references);
|
free(references);
|
||||||
PUTS("</I><BR>\n");
|
PUTS("</I><BR>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(linecount) {
|
if(linecount) {
|
||||||
lineinc = linecount/100;
|
lineinc = linecount/100;
|
||||||
if(lineinc < 1) lineinc = 1;
|
if(lineinc < 1) lineinc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUTS("<HR>\n");
|
PUTS("<HR>\n");
|
||||||
|
|
||||||
/* Read in the BODY of the Article:
|
/* Read in the BODY of the Article:
|
||||||
*/
|
*/
|
||||||
(*targetClass.start_element)(target, HTML_PRE , 0, 0);
|
(*targetClass.start_element)(target, HTML_PRE , 0, 0);
|
||||||
|
|
||||||
p = line;
|
p = line;
|
||||||
done = 0;
|
done = 0;
|
||||||
while(!done){
|
while(!done){
|
||||||
@ -1808,15 +1805,15 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
#endif
|
#endif
|
||||||
p = line; /* Restart at beginning */
|
p = line; /* Restart at beginning */
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* Loop over characters */
|
} /* Loop over characters */
|
||||||
|
|
||||||
(*targetClass.end_element)(target, HTML_PRE);
|
(*targetClass.end_element)(target, HTML_PRE);
|
||||||
|
|
||||||
/* Mark this article read in all the groups we care about
|
/* Mark this article read in all the groups we care about
|
||||||
Also figure out the next article to read
|
Also figure out the next article to read
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((next = nextUnread (CurrentArt,0)) == NULL) {
|
if ((next = nextUnread (CurrentArt,0)) == NULL) {
|
||||||
if ((next = nextUnreadThread (CurrentArt)) == NULL) {
|
if ((next = nextUnreadThread (CurrentArt)) == NULL) {
|
||||||
next = CurrentArt;
|
next = CurrentArt;
|
||||||
@ -1828,7 +1825,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
|
|
||||||
NextArt = next;
|
NextArt = next;
|
||||||
if (CurrentArt) {
|
if (CurrentArt) {
|
||||||
char *tok, d, *last;
|
char *tok;
|
||||||
newsgroup_t *ng;
|
newsgroup_t *ng;
|
||||||
|
|
||||||
if (newsgroups) {
|
if (newsgroups) {
|
||||||
@ -1840,12 +1837,12 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
tok = strtok (NULL, ", ;:\t\n");
|
tok = strtok (NULL, ", ;:\t\n");
|
||||||
}
|
}
|
||||||
} else if (NewsGroup) {
|
} else if (NewsGroup) {
|
||||||
if (ng = findgroup (NewsGroup)) {
|
if (ng = findgroup (NewsGroup)) {
|
||||||
markread (ng, CurrentArt->num);
|
markread (ng, CurrentArt->num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMeter(100,NULL);
|
HTMeter(100,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1861,19 +1858,18 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|||||||
do not handle it here.
|
do not handle it here.
|
||||||
2.7b4: Added support for newsrc and subscribed news.
|
2.7b4: Added support for newsrc and subscribed news.
|
||||||
2.7b5: Made it faster.
|
2.7b5: Made it faster.
|
||||||
*/
|
*/
|
||||||
PRIVATE void read_list NOARGS
|
PRIVATE void read_list NOARGS
|
||||||
{
|
{
|
||||||
char line[LINE_LENGTH+1], group[LINE_LENGTH], elgroup[LINE_LENGTH],
|
char line[LINE_LENGTH+1], group[LINE_LENGTH], elgroup[LINE_LENGTH],
|
||||||
postable, *p;
|
postable, *p;
|
||||||
int first, last, junk, m=0, next_m=20, done=0, intr, g=0, next_g = 50, l=0, lastg=0,mark=0;
|
int first, last, junk, m=0, next_m=20, done=0, intr, g=0, next_g = 50, l=0, lastg=0,mark=0;
|
||||||
newsgroup_t *n=NULL, *nn=NULL;
|
newsgroup_t *n=NULL, *nn=NULL;
|
||||||
extern int twirl_increment;
|
|
||||||
|
|
||||||
START (HTML_TITLE);
|
START (HTML_TITLE);
|
||||||
PUTS ("Newsgroup Listing");
|
PUTS ("Newsgroup Listing");
|
||||||
END (HTML_TITLE);
|
END (HTML_TITLE);
|
||||||
|
|
||||||
HTMeter (0,NULL);
|
HTMeter (0,NULL);
|
||||||
HTProgress ("Getting newsgroup information from NNTP server");
|
HTProgress ("Getting newsgroup information from NNTP server");
|
||||||
|
|
||||||
@ -2111,20 +2107,18 @@ PRIVATE void XBuildArtList ARGS3(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
NewsArt *art;
|
NewsArt *art;
|
||||||
char *p,*aname=NULL, *author=NULL, *aref, abuf[1024+1];
|
char *p,*aname=NULL, *aref, abuf[1024+1];
|
||||||
BOOL done;
|
|
||||||
|
|
||||||
char *num,*title,*date,*msgid,*ref,*bytes,*lines,*from=NULL;
|
char *num,*title,*date,*msgid,*ref,*bytes,*lines,*from=NULL;
|
||||||
|
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
|
||||||
char *reference=0; /* Href for article */
|
|
||||||
int status, count, first, last; /* Response fields */
|
int status, count, first, last; /* Response fields */
|
||||||
/* count is only an upper limit */
|
/* count is only an upper limit */
|
||||||
int c,i,lineinc;
|
int lineinc;
|
||||||
|
|
||||||
HTMeter(0,NULL);
|
HTMeter(0,NULL);
|
||||||
|
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if(www2Trace) fprintf(stderr,"[%s]\n",response_text);
|
if(www2Trace) fprintf(stderr,"[%s]\n",response_text);
|
||||||
#endif
|
#endif
|
||||||
@ -2250,12 +2244,11 @@ PRIVATE void BuildArtList ARGS3(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
NewsArt *art;
|
NewsArt *art;
|
||||||
char *p,*aname, *author, *aref, abuf[1024+1];
|
|
||||||
BOOL done;
|
BOOL done;
|
||||||
|
char *p,*aname, *aref, abuf[1024+1];
|
||||||
|
|
||||||
char buffer[LINE_LENGTH];
|
char buffer[LINE_LENGTH];
|
||||||
char line[LINE_LENGTH];
|
char line[LINE_LENGTH];
|
||||||
char *reference=0; /* Href for article */
|
|
||||||
int artno; /* Article number WITHIN GROUP */
|
int artno; /* Article number WITHIN GROUP */
|
||||||
int status, count, first, last; /* Response fields */
|
int status, count, first, last; /* Response fields */
|
||||||
/* count is only an upper limit */
|
/* count is only an upper limit */
|
||||||
@ -2266,6 +2259,7 @@ PRIVATE void BuildArtList ARGS3(
|
|||||||
if(www2Trace) fprintf(stderr,"[%s]",response_text);
|
if(www2Trace) fprintf(stderr,"[%s]",response_text);
|
||||||
#endif
|
#endif
|
||||||
sscanf(response_text, "%d %d %d %d", &status, &count, &first, &last);
|
sscanf(response_text, "%d %d %d %d", &status, &count, &first, &last);
|
||||||
|
|
||||||
#ifndef DISABLE_TRACE
|
#ifndef DISABLE_TRACE
|
||||||
if(www2Trace) fprintf(stderr,"Newsgroup status=%d, count=%d, (%d-%d)",
|
if(www2Trace) fprintf(stderr,"Newsgroup status=%d, count=%d, (%d-%d)",
|
||||||
status, count, first, last);
|
status, count, first, last);
|
||||||
@ -2475,18 +2469,11 @@ PRIVATE void read_group ARGS3(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
NewsArt *art,*art2, *f;
|
NewsArt *art,*art2, *f;
|
||||||
char *p;
|
|
||||||
BOOL done;
|
|
||||||
char buffer[LINE_LENGTH], subj[LINE_LENGTH];
|
char buffer[LINE_LENGTH], subj[LINE_LENGTH];
|
||||||
char line[LINE_LENGTH], from[LINE_LENGTH];
|
char from[LINE_LENGTH];
|
||||||
char efrom[LINE_LENGTH], esubj[LINE_LENGTH];
|
char efrom[LINE_LENGTH], esubj[LINE_LENGTH];
|
||||||
char *reference=0;
|
int i,mark=0;
|
||||||
int i,artno, mark=0;
|
|
||||||
int tc=0;
|
|
||||||
int status, count; /* Response fields */
|
|
||||||
/* count is only an upper limit */
|
|
||||||
char em[255+1];
|
|
||||||
|
|
||||||
if ((NewsGroupS = findgroup (groupName)) == NULL) {
|
if ((NewsGroupS = findgroup (groupName)) == NULL) {
|
||||||
/* Add group unsub'd to hash table */
|
/* Add group unsub'd to hash table */
|
||||||
if((NewsGroupS = addgroup (groupName, first, last, 1))==NULL) {
|
if((NewsGroupS = addgroup (groupName, first, last, 1))==NULL) {
|
||||||
@ -2605,7 +2592,7 @@ PUBLIC int HTLoadNews ARGS4(
|
|||||||
{
|
{
|
||||||
char command[257]; /* The whole command */
|
char command[257]; /* The whole command */
|
||||||
char groupName[GROUP_NAME_LENGTH]; /* Just the group name */
|
char groupName[GROUP_NAME_LENGTH]; /* Just the group name */
|
||||||
char buf[LINE_LENGTH+1], *pt, *p1;
|
char buf[LINE_LENGTH+1], *p1;
|
||||||
int status; /* tcp return */
|
int status; /* tcp return */
|
||||||
int retries; /* A count of how hard we have tried */
|
int retries; /* A count of how hard we have tried */
|
||||||
BOOL group_wanted; /* Flag: group was asked for, not article */
|
BOOL group_wanted; /* Flag: group was asked for, not article */
|
||||||
@ -2652,16 +2639,18 @@ PUBLIC int HTLoadNews ARGS4(
|
|||||||
** xxx@yyy Article
|
** xxx@yyy Article
|
||||||
** <xxx@yyy> Same article
|
** <xxx@yyy> Same article
|
||||||
** xxxxx News group (no "@")
|
** xxxxx News group (no "@")
|
||||||
*/
|
*/
|
||||||
group_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')==0);
|
group_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')==0);
|
||||||
list_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')!=0);
|
list_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')!=0);
|
||||||
|
|
||||||
/* Don't use HTParse because news: access doesn't follow traditional
|
/* Don't use HTParse because news: access doesn't follow traditional
|
||||||
rules. For instance, if the article reference contains a '#',
|
rules. For instance, if the article reference contains a '#',
|
||||||
the rest of it is lost -- JFG 10/7/92, from a bug report
|
the rest of it is lost -- JFG 10/7/92, from a bug report
|
||||||
*/
|
*/
|
||||||
if (!my_strncasecmp (arg, "news:", 5))
|
if (!my_strncasecmp (arg, "news:", 5))
|
||||||
p1 = arg + 5; /* Skip "news:" prefix */
|
p1 = arg + 5; /* Skip "news:" prefix */
|
||||||
|
else
|
||||||
|
p1 = arg;
|
||||||
if (group_wanted) {
|
if (group_wanted) {
|
||||||
strcpy (command, "GROUP ");
|
strcpy (command, "GROUP ");
|
||||||
first = 0;
|
first = 0;
|
||||||
@ -2670,37 +2659,37 @@ PUBLIC int HTLoadNews ARGS4(
|
|||||||
strcat (command, groupName);
|
strcat (command, groupName);
|
||||||
} else if (!list_wanted) {
|
} else if (!list_wanted) {
|
||||||
strcpy (command, "ARTICLE ");
|
strcpy (command, "ARTICLE ");
|
||||||
if (strchr(p1, '<')==0)
|
if (strchr(p1, '<')==0)
|
||||||
strcat(command,"<");
|
strcat(command,"<");
|
||||||
strcat(command, p1);
|
strcat(command, p1);
|
||||||
if (strchr(p1, '>')==0)
|
if (strchr(p1, '>')==0)
|
||||||
strcat(command,">");
|
strcat(command,">");
|
||||||
} else {
|
} else {
|
||||||
command[0] = 0;
|
command[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
char * p = command + strlen(command);
|
char * p = command + strlen(command);
|
||||||
*p++ = CR; /* Macros to be correct on Mac */
|
*p++ = CR; /* Macros to be correct on Mac */
|
||||||
*p++ = LF;
|
*p++ = LF;
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
HTProgress ("Could not load data.");
|
HTProgress ("Could not load data.");
|
||||||
return HT_NOT_LOADED; /* Ignore if no name */
|
return HT_NOT_LOADED; /* Ignore if no name */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a hypertext object with an anchor list. */
|
/* Make a hypertext object with an anchor list. */
|
||||||
node_anchor = anAnchor;
|
node_anchor = anAnchor;
|
||||||
target = HTML_new(anAnchor, format_out, stream);
|
target = HTML_new(anAnchor, format_out, stream);
|
||||||
targetClass = *target->isa;
|
targetClass = *target->isa;
|
||||||
|
|
||||||
/* Now, let's get a stream setup up from the NewsHost: */
|
/* Now, let's get a stream setup up from the NewsHost: */
|
||||||
for (retries=0; retries<2; retries++) {
|
for (retries=0; retries<2; retries++) {
|
||||||
target = HTML_new(anAnchor, format_out, stream);
|
target = HTML_new(anAnchor, format_out, stream);
|
||||||
targetClass = *target->isa; /* Copy routine entry points */
|
targetClass = *target->isa; /* Copy routine entry points */
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
if(status = OpenNNTP()){
|
if(status = OpenNNTP()){
|
||||||
char message[256];
|
char message[256];
|
||||||
switch(status){
|
switch(status){
|
||||||
@ -2724,21 +2713,21 @@ PUBLIC int HTLoadNews ARGS4(
|
|||||||
HTProgress ("Could not access news host.");
|
HTProgress ("Could not access news host.");
|
||||||
sprintf(message,"\nCould not access news host %s. "
|
sprintf(message,"\nCould not access news host %s. "
|
||||||
"Try setting environment variable <code>NNTPSERVER</code> "
|
"Try setting environment variable <code>NNTPSERVER</code> "
|
||||||
"to the name of your news host, and restart Mosaic.",
|
"to the name of your news host, and restart Mosaic.",
|
||||||
HTNewsHost);
|
HTNewsHost);
|
||||||
|
|
||||||
PUTS(message);
|
PUTS(message);
|
||||||
(*targetClass.end_document)(target);
|
(*targetClass.end_document)(target);
|
||||||
(*targetClass.free)(target);
|
(*targetClass.free)(target);
|
||||||
return HT_LOADED;
|
return HT_LOADED;
|
||||||
case 3:
|
case 3:
|
||||||
HTProgress ("Connection interrupted.");
|
HTProgress ("Connection interrupted.");
|
||||||
(*targetClass.handle_interrupt)(target);
|
(*targetClass.handle_interrupt)(target);
|
||||||
|
|
||||||
return HT_INTERRUPTED;
|
return HT_INTERRUPTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = response("XOVER\r\n");
|
status = response("XOVER\r\n");
|
||||||
if(status != 500)
|
if(status != 500)
|
||||||
has_xover = 1;
|
has_xover = 1;
|
||||||
|
@ -115,8 +115,7 @@ PUBLIC int HTLoadHTTP ARGS4 (
|
|||||||
char crlf[3]; /* A CR LF equivalent string */
|
char crlf[3]; /* A CR LF equivalent string */
|
||||||
HTStream *target; /* Unconverted data */
|
HTStream *target; /* Unconverted data */
|
||||||
HTFormat format_in; /* Format arriving in the message */
|
HTFormat format_in; /* Format arriving in the message */
|
||||||
|
|
||||||
BOOL had_header; /* Have we had at least one header? */
|
|
||||||
char *line_buffer;
|
char *line_buffer;
|
||||||
char *line_kept_clean;
|
char *line_kept_clean;
|
||||||
BOOL extensions; /* Assume good HTTP server */
|
BOOL extensions; /* Assume good HTTP server */
|
||||||
@ -133,10 +132,6 @@ PUBLIC int HTLoadHTTP ARGS4 (
|
|||||||
|
|
||||||
/*SWP*/
|
/*SWP*/
|
||||||
int statusError=0;
|
int statusError=0;
|
||||||
char tmpbuf[4096];
|
|
||||||
|
|
||||||
char *begin_ptr,*tmp_ptr;
|
|
||||||
int env_length;
|
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
{
|
{
|
||||||
@ -161,7 +156,6 @@ PUBLIC int HTLoadHTTP ARGS4 (
|
|||||||
so we can start over here... */
|
so we can start over here... */
|
||||||
eol = 0;
|
eol = 0;
|
||||||
bytes_already_read = 0;
|
bytes_already_read = 0;
|
||||||
had_header = NO;
|
|
||||||
length = 0;
|
length = 0;
|
||||||
doing_redirect = 0;
|
doing_redirect = 0;
|
||||||
compressed = 0;
|
compressed = 0;
|
||||||
@ -621,7 +615,6 @@ PUBLIC int HTLoadHTTP ARGS4 (
|
|||||||
{
|
{
|
||||||
/* Get numeric status etc */
|
/* Get numeric status etc */
|
||||||
BOOL end_of_file = NO;
|
BOOL end_of_file = NO;
|
||||||
HTAtom * encoding = HTAtom_for("8bit");
|
|
||||||
int buffer_length = INIT_LINE_SIZE;
|
int buffer_length = INIT_LINE_SIZE;
|
||||||
|
|
||||||
line_buffer = (char *) malloc(buffer_length * sizeof(char));
|
line_buffer = (char *) malloc(buffer_length * sizeof(char));
|
||||||
|
@ -226,8 +226,13 @@ customflags =
|
|||||||
# ---------------------- END OF CUSTOMIZABLE OPTIONS -------------------------
|
# ---------------------- END OF CUSTOMIZABLE OPTIONS -------------------------
|
||||||
|
|
||||||
# Disable certain warnings as we don't care for them
|
# Disable certain warnings as we don't care for them
|
||||||
CWARNINGS = -Wno-parentheses -Wno-switch-enum
|
CWARNINGS = -Wall \
|
||||||
CFLAGS = -g $(sysconfigflags) $(prereleaseflags) $(CWARNINGS)
|
-Wno-parentheses \
|
||||||
|
-Wno-switch -Wno-switch-enum \
|
||||||
|
-Wno-char-subscripts \
|
||||||
|
-Wno-unused-result
|
||||||
|
|
||||||
|
CFLAGS = -g $(sysconfigflags) $(prereleaseflags) $(CWARNINGS) $(customflags)
|
||||||
|
|
||||||
# Don't worry about these -- for development purposes only.
|
# Don't worry about these -- for development purposes only.
|
||||||
PURIFY = purify
|
PURIFY = purify
|
||||||
|
Loading…
Reference in New Issue
Block a user