diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2007-05-23 00:57:49 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2007-05-23 00:57:49 -0400 |
commit | fa5da88cfe856e4c69d3dfb12e68bb56d0c69c9e (patch) | |
tree | 20ce131d19588fd97676f6d73b4ded257625d2f4 /WWW/Library | |
parent | e43d228f7636bbb423c5bdbd2100d733bcee28d3 (diff) | |
download | lynx-snapshots-fa5da88cfe856e4c69d3dfb12e68bb56d0c69c9e.tar.gz |
snapshot of project "lynx", label v2-8-7dev_5a
Diffstat (limited to 'WWW/Library')
-rw-r--r-- | WWW/Library/Implementation/HTFTP.c | 7 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTCP.c | 151 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTP.c | 3 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTUtils.h | 16 | ||||
-rw-r--r-- | WWW/Library/Implementation/makefile.in | 9 |
5 files changed, 104 insertions, 82 deletions
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index 3dc2698a..d4b9d695 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -1,4 +1,7 @@ -/* File Transfer Protocol (FTP) Client +/* + * $LynxId: HTFTP.c,v 1.78 2007/05/22 23:47:17 tom Exp $ + * + * File Transfer Protocol (FTP) Client * for a WorldWideWeb browser * =================================== * @@ -344,7 +347,7 @@ static int next_data_char(void) if (status == HT_INTERRUPTED) interrupted_in_next_data_char = 1; if (status <= 0) - return -1; + return EOF; data_write_pointer = data_buffer + status; data_read_pointer = data_buffer; } diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index f99397a6..c8f7deb6 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -1,4 +1,7 @@ -/* Generic Communication Code HTTCP.c +/* + * $LynxId: HTTCP.c,v 1.93 2007/05/22 23:54:43 tom Exp $ + * + * Generic Communication Code HTTCP.c * ========================== * * This code is in common between client and server sides. @@ -1527,6 +1530,24 @@ const char *HTHostName(void) return hostname; } +#ifdef _WINDOWS +#define SET_EINTR WSASetLastError(EINTR) +#else +#define SET_EINTR SOCKET_ERRNO = EINTR +#endif + +static BOOL HTWasInterrupted(int *status) +{ + BOOL result = FALSE; + + if (HTCheckForInterrupt()) { + result = TRUE; + *status = HT_INTERRUPTED; + SET_EINTR; + } + return result; +} + #ifndef MULTINET /* SOCKET_ERRNO != errno ? */ #if !defined(UCX) || !defined(VAXC) /* errno not modifiable ? */ #define SOCKET_DEBUG_TRACE /* show errno status after some system calls */ @@ -1874,14 +1895,8 @@ int HTDoConnect(const char *url, break; } } - if (HTCheckForInterrupt()) { + if (HTWasInterrupted(&status)) { CTRACE((tfp, "*** INTERRUPTED in middle of connect.\n")); - status = HT_INTERRUPTED; -#ifdef _WINDOWS - WSASetLastError(EINTR); -#else - SOCKET_ERRNO = EINTR; -#endif break; } } @@ -1947,7 +1962,11 @@ int HTDoRead(int fildes, void *buf, unsigned nbyte) { - int ready, ret; + int result; + BOOL ready; + +#if !defined(NO_IOCTL) + int ret; fd_set readfds; struct timeval select_timeout; int tries = 0; @@ -1955,10 +1974,9 @@ int HTDoRead(int fildes, #ifdef USE_READPROGRESS int otries = 0; time_t otime = time((time_t *) 0); + time_t start = otime; #endif -#if defined(UNIX) || defined(UCX) - int nb; -#endif /* UCX, BSN */ +#endif /* !NO_IOCTL */ #if defined(UNIX) && !defined(__BEOS__) if (fildes == 0) { @@ -1972,34 +1990,28 @@ int HTDoRead(int fildes, } } else #endif - if (fildes <= 0) + if (fildes <= 0) { + CTRACE((tfp, "HTDoRead - no file descriptor!\n")); return -1; + } - if (HTCheckForInterrupt()) { -#ifdef _WINDOWS - WSASetLastError(EINTR); -#else - SOCKET_ERRNO = EINTR; -#endif - return (HT_INTERRUPTED); + if (HTWasInterrupted(&result)) { + CTRACE((tfp, "HTDoRead - interrupted before starting!\n")); + return (result); } -#if !defined(NO_IOCTL) - ready = 0; +#if defined(NO_IOCTL) + ready = TRUE; #else - ready = 1; -#endif /* bypass for NO_IOCTL */ + ready = FALSE; while (!ready) { /* * Protect against an infinite loop. */ if (tries++ >= 180000) { HTAlert(gettext("Socket read failed for 180,000 tries.")); -#ifdef _WINDOWS - WSASetLastError(EINTR); -#else - SOCKET_ERRNO = EINTR; -#endif - return HT_INTERRUPTED; + SET_EINTR; + result = HT_INTERRUPTED; + break; } #ifdef USE_READPROGRESS if (tries - otries > 10) { @@ -2033,55 +2045,56 @@ int HTDoRead(int fildes, } while ((ret == -1) && (errno == EINTR)); if (ret < 0) { - return -1; + result = -1; + break; } else if (ret > 0) { - ready = 1; - } else if (HTCheckForInterrupt()) { -#ifdef _WINDOWS - WSASetLastError(EINTR); -#else - SOCKET_ERRNO = EINTR; -#endif - return HT_INTERRUPTED; + ready = TRUE; + } else if (HTWasInterrupted(&result)) { + break; } } +#endif /* !NO_IOCTL */ -#if !defined(UCX) || !defined(VAXC) + if (ready) { +#if defined(UCX) && defined(VAXC) + /* + * VAXC and UCX problem only. + */ + errno = vaxc$errno = 0; + result = SOCKET_READ(fildes, buf, nbyte); + CTRACE((tfp, + "Read - result,errno,vaxc$errno: %d %d %d\n", result, errno, vaxc$errno)); + if ((result <= 0) && TRACE) + perror("HTTCP.C:HTDoRead:read"); /* RJF */ + /* + * An errno value of EPIPE and result < 0 indicates end-of-file on VAXC. + */ + if ((result <= 0) && (errno == EPIPE)) { + result = 0; + set_errno(0); + } +#else #ifdef UNIX - while ((nb = SOCKET_READ(fildes, buf, nbyte)) == -1) { - if (errno == EINTR) - continue; + while ((result = SOCKET_READ(fildes, buf, nbyte)) == -1) { + if (errno == EINTR) + continue; #ifdef ERESTARTSYS - if (errno == ERESTARTSYS) - continue; + if (errno == ERESTARTSYS) + continue; #endif /* ERESTARTSYS */ - HTInetStatus("read"); - break; - } - return nb; + HTInetStatus("read"); + break; + } #else /* UNIX */ - return SOCKET_READ(fildes, buf, nbyte); + result = SOCKET_READ(fildes, buf, nbyte); #endif /* !UNIX */ - -#else /* UCX && VAXC */ - /* - * VAXC and UCX problem only. - */ - errno = vaxc$errno = 0; - nb = SOCKET_READ(fildes, buf, nbyte); - CTRACE((tfp, - "Read - nb,errno,vaxc$errno: %d %d %d\n", nb, errno, vaxc$errno)); - if ((nb <= 0) && TRACE) - perror("HTTCP.C:HTDoRead:read"); /* RJF */ - /* - * An errno value of EPIPE and nb < 0 indicates end-of-file on VAXC. - */ - if ((nb <= 0) && (errno == EPIPE)) { - nb = 0; - set_errno(0); +#endif /* UCX && VAXC */ } - return nb; -#endif /* UCX, BSN */ +#ifdef USE_READPROGRESS + CTRACE2(TRACE_TIMING, (tfp, "...HTDoRead returns %d (%ld seconds)\n", + result, (long) (time((time_t *) 0) - start))); +#endif + return result; } #ifdef SVR4_BSDSELECT diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index c0cd6e76..5f262bd5 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTP.c,v 1.85 2007/05/13 21:08:19 tom Exp $ + * $LynxId: HTTP.c,v 1.86 2007/05/22 22:42:12 Thorsten.Glaser Exp $ * * HyperText Tranfer Protocol - Client implementation HTTP.c * ========================== @@ -788,7 +788,6 @@ static int HTLoadHTTP(const char *arg, ssl_host, cert_host); _HTProgress(msg); FREE(msg); - show_cert_issuer(SSL_get_peer_certificate(handle)); /* no need to continue the verification loop */ break; } diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index eda975d6..4d30538f 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -1,8 +1,10 @@ -/* Utility macros for the W3 code library - MACROS FOR GENERAL USE - - See also: the system dependent file "www_tcp.h", which is included here. - +/* + * $LynxId: HTUtils.h,v 1.76 2007/05/22 23:51:40 tom Exp $ + * + * Utility macros for the W3 code library + * MACROS FOR GENERAL USE + * + * See also: the system dependent file "www_tcp.h", which is included here. */ #ifndef NO_LYNX_TRACE @@ -523,6 +525,10 @@ extern int WWW_TraceMask; #define TRACE_TRST (TRACE_bit(2)) #define TRACE_CFG (TRACE_bit(3)) #define TRACE_BSTRING (TRACE_bit(4)) +#define TRACE_COOKIES (TRACE_bit(5)) +#define TRACE_CHARSETS (TRACE_bit(6)) +#define TRACE_GRIDTEXT (TRACE_bit(7)) +#define TRACE_TIMING (TRACE_bit(8)) #if defined(USE_VERTRACE) && !defined(LY_TRACELINE) #define LY_TRACELINE __LINE__ diff --git a/WWW/Library/Implementation/makefile.in b/WWW/Library/Implementation/makefile.in index 37e0b4d3..44c94299 100644 --- a/WWW/Library/Implementation/makefile.in +++ b/WWW/Library/Implementation/makefile.in @@ -1,5 +1,6 @@ -# Make WWW under unix for a.n.other unix system (bsd) -# Use this as a template +# $LynxId: makefile.in,v 1.14 2007/05/23 00:57:38 tom Exp $ +# Make WWW under unix for a.n.other unix system (bsd) +# Use this as a template # For W3 distribution, machine type for subdirectories WWW_MACH = Implementation @@ -26,12 +27,12 @@ o = .@OBJEXT@ INTLDIR_CPPFLAGS= @INTLDIR_CPPFLAGS@ -I$(top_srcdir)/intl CPP = @CPP@ -CPPOPTS = $(DEFS) $(EXTRA_CPPFLAGS) $(CPPFLAGS) $(LYFLAGS) \ +CPPOPTS = $(DEFS) $(LYFLAGS) \ -I../../.. \ -I../../../src \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ - $(INTLDIR_CPPFLAGS) -I$(WWWINC) + $(INTLDIR_CPPFLAGS) -I$(WWWINC) $(EXTRA_CPPFLAGS) $(CPPFLAGS) LY_CFLAGS = @CFLAGS@ CFLAGS = $(CPPOPTS) $(LY_CFLAGS) |