lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev HTTCP.c and HTTP.c tweaks - patch


From: Klaus Weide
Subject: lynx-dev HTTCP.c and HTTP.c tweaks - patch
Date: Tue, 15 Dec 1998 01:14:51 -0600 (CST)

Some tweaks to HTTP.c and HTTCP.c.  The HTDoRead change makes
a non-interactive lynx work within a lynxcgi script - LYLoadCGI
closes fd 0 for GET requests.  Again not sure about other OSs' TCP
stacks, so that's changed only for Unix.

Patches against 2.8.1rel.2, should also work with latest devel code.

    Klaus

* Don't refuse to read from filedescriptor 0 in HTDoRead for Unix
  if it is not a tty.  The socket fd from HTDoConnect can be 0 if
  fd 0 was not open when lynx was started non-interactively.
* Increase INIT_LINE_SIZE in HTTP.c slightly from 1024 to 1536,
  so that for a typical ethernet MTU the first packet of a response
  can more often be read in with a single read().
* Add a missing FREE() in HTTP.c.

*** lynx2-8-1.orig/WWW/Library/Implementation/HTTP.c    Wed Oct 14 07:23:56 1998
--- lynx2-8-1/WWW/Library/Implementation/HTTP.c Mon Dec 14 20:46:02 1998
***************
*** 16,22 ****
  #define HTTPS_PORT  443
  #define SNEWS_PORT  563
  
! #define INIT_LINE_SIZE                1024    /* Start with line buffer this 
big */
  #define LINE_EXTEND_THRESH    256     /* Minimum read size */
  #define VERSION_LENGTH                20      /* for returned protocol 
version */
  
--- 16,22 ----
  #define HTTPS_PORT  443
  #define SNEWS_PORT  563
  
! #define INIT_LINE_SIZE                1536    /* Start with line buffer this 
big */
  #define LINE_EXTEND_THRESH    256     /* Minimum read size */
  #define VERSION_LENGTH                20      /* for returned protocol 
version */
  
***************
*** 440,445 ****
--- 440,446 ----
                    FREE(command);
                    FREE(hostname);
                    FREE(docname);
+                   FREE(abspath);
                    FREE(host2);
                    FREE(path2);
                    status = HT_NOT_LOADED;
*** lynx2-8-1.orig/WWW/Library/Implementation/HTTCP.c   Sat Oct 24 11:49:07 1998
--- lynx2-8-1/WWW/Library/Implementation/HTTCP.c        Mon Dec 14 20:21:59 1998
***************
*** 1099,1104 ****
--- 1099,1116 ----
      int nb;
  #endif /* UCX, BSN */
  
+ #ifdef UNIX
+     if (fildes == 0) {
+       /*
+        *  0 can be a valid socket fd, but if it's a tty something must
+        *  have gone wrong. - kw
+        */
+       if (isatty(fildes)) {
+           CTRACE(tfp, "HTDoRead - refusing to read fd 0 which is a tty!\n");
+           return -1;
+       }
+     } else
+ #endif
      if (fildes <= 0)
        return -1;
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]