about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2009-05-22 00:47:41 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2009-05-22 00:47:41 -0400
commit097b356f6a8fa667d38dd10bb3bca016a7cc4f03 (patch)
tree15595038b1c48a2649417c1293df7185a0fbeb12
parent01859149e85a589e236b320b01197e79c422a729 (diff)
downloadlynx-snapshots-097b356f6a8fa667d38dd10bb3bca016a7cc4f03.tar.gz
snapshot of project "lynx", label v2-8-7pre_2b
-rw-r--r--CHANGES6
-rw-r--r--WWW/Library/Implementation/HTTP.c26
-rw-r--r--lynx.cfg3
-rw-r--r--src/LYGlobalDefs.h3
-rw-r--r--src/LYMain.c3
-rw-r--r--src/LYOptions.c10
-rw-r--r--src/LYrcFile.c3
-rw-r--r--src/LYrcFile.h3
8 files changed, 38 insertions, 19 deletions
diff --git a/CHANGES b/CHANGES
index 708c0338..4d0c5d29 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,13 @@
--- $LynxId: CHANGES,v 1.396 2009/05/10 22:59:22 tom Exp $
+-- $LynxId: CHANGES,v 1.398 2009/05/22 00:29:53 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
 2009-05-?? (2.8.7pre.3)
+* add an Options menu checkbox to tell if Lynx should send a user-agent string. 
+  Unless the useragent restriction is set, the default for this checkbox is
+  off, so that Lynx will not send the string.  The corresponding setting,
+  send_useragent, may be saved to ~/.lynxrc, but normally is not -TD
 * correct type for HTNewsGetCharacter() in HTNews.c, which could return a
   sign-extended character mistaken for EOF (report by Dallas E. Legan II) -TD
 
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 7d8e8601..3b3a2d2c 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.107 2009/04/07 22:45:42 tom Exp $
+ * $LynxId: HTTP.c,v 1.108 2009/05/22 00:47:41 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -1158,18 +1158,20 @@ static int HTLoadHTTP(const char *arg,
 	    HTBprintf(&command, "Cache-Control: no-cache%c%c", CR, LF);
 	}
 
-	if (LYUserAgent && *LYUserAgent) {
-	    char *cp = LYSkipBlanks(LYUserAgent);
+	if (LYSendUserAgent || no_useragent) {
+	    if (!isEmpty(LYUserAgent)) {
+		char *cp = LYSkipBlanks(LYUserAgent);
 
-	    /* Won't send it at all if all blank - kw */
-	    if (*cp != '\0')
-		HTBprintf(&command, "User-Agent: %.*s%c%c",
-			  INIT_LINE_SIZE - 15, LYUserAgent, CR, LF);
-	} else {
-	    HTBprintf(&command, "User-Agent: %s/%s  libwww-FM/%s%c%c",
-		      HTAppName ? HTAppName : "unknown",
-		      HTAppVersion ? HTAppVersion : "0.0",
-		      HTLibraryVersion, CR, LF);
+		/* Won't send it at all if all blank - kw */
+		if (*cp != '\0')
+		    HTBprintf(&command, "User-Agent: %.*s%c%c",
+			      INIT_LINE_SIZE - 15, LYUserAgent, CR, LF);
+	    } else {
+		HTBprintf(&command, "User-Agent: %s/%s  libwww-FM/%s%c%c",
+			  HTAppName ? HTAppName : "unknown",
+			  HTAppVersion ? HTAppVersion : "0.0",
+			  HTLibraryVersion, CR, LF);
+	    }
 	}
 
 	if (personal_mail_address && !LYNoFromHeader) {
diff --git a/lynx.cfg b/lynx.cfg
index 06f0cf25..4ec02f42 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -1,4 +1,4 @@
-# $LynxId: lynx.cfg,v 1.175 2009/04/26 16:24:31 tom Exp $
+# $LynxId: lynx.cfg,v 1.176 2009/05/22 00:27:36 tom Exp $
 # lynx.cfg file.
 # The default placement for this file is /usr/local/lib/lynx.cfg (Unix)
 #                                     or Lynx_Dir:lynx.cfg (VMS)
@@ -3456,6 +3456,7 @@ COLOR:6:brightred:black
 #ENABLE_LYNXRC:run_execution_links_on_local_files:ON
 #ENABLE_LYNXRC:scrollbar:OFF
 #ENABLE_LYNXRC:select_popups:ON
+#ENABLE_LYNXRC:send_useragent:OFF
 #ENABLE_LYNXRC:session_file:OFF
 #ENABLE_LYNXRC:set_cookies:OFF
 #ENABLE_LYNXRC:show_color:ON
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 1b5247d2..d4a643fa 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYGlobalDefs.h,v 1.118 2009/04/07 00:11:01 tom Exp $
+ * $LynxId: LYGlobalDefs.h,v 1.119 2009/05/22 00:18:05 tom Exp $
  *
  * global variable definitions
  */
@@ -452,6 +452,7 @@ extern "C" {
     extern BOOLEAN LYNoRefererHeader;	/* Never send Referer header? */
     extern BOOLEAN LYNoRefererForThis;	/* No Referer header for this URL? */
     extern BOOLEAN LYNoFromHeader;	/* Never send From header?    */
+    extern BOOLEAN LYSendUserAgent;	/* send Lynx User-Agent header? */
     extern BOOLEAN LYListNewsNumbers;
     extern BOOLEAN LYUseMouse;
     extern BOOLEAN LYListNewsDates;
diff --git a/src/LYMain.c b/src/LYMain.c
index 399bc529..1f12fcfe 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.200 2009/04/12 16:57:48 tom Exp $
+ * $LynxId: LYMain.c,v 1.201 2009/05/22 00:18:53 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -372,6 +372,7 @@ BOOLEAN LYNoRefererForThis = FALSE;	/* No Referer header for this URL? */
 BOOLEAN LYNoRefererHeader = FALSE;	/* Never send Referer header?     */
 BOOLEAN LYRawMode;
 BOOLEAN LYSelectPopups = USE_SELECT_POPUPS;
+BOOLEAN LYSendUserAgent = FALSE;	/* send Lynx User-Agent header? */
 BOOLEAN LYSetCookies = SET_COOKIES;	/* Process Set-Cookie headers? */
 BOOLEAN LYUseDefSelPop = TRUE;	/* Command line -popup toggle */
 BOOLEAN LYUseDefaultRawMode = TRUE;
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 96402e87..6e73d227 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYOptions.c,v 1.129 2009/04/07 00:35:49 tom Exp $ */
+/* $LynxId: LYOptions.c,v 1.130 2009/05/22 00:47:15 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <HTTP.h>		/* 'reloading' flag */
@@ -2425,11 +2425,17 @@ static OptValues encoding_values[] =
  */
 static const char *preferred_doc_char_string = RC_PREFERRED_CHARSET;
 static const char *preferred_doc_lang_string = RC_PREFERRED_LANGUAGE;
+static const char *send_user_agent_string = RC_SEND_USERAGENT;
 static const char *user_agent_string = RC_USERAGENT;
 
 #define PutHeader(fp, Name) \
 	fprintf(fp, "\n%s<em>%s</em>\n", MARGIN_STR, LYEntifyTitle(&buffer, Name));
 
+#define PutCheckBox(fp, Name, Value, disable) \
+	fprintf(fp,\
+	"<input type=\"checkbox\" name=\"%s\" value=\"%s\" %s>\n",\
+		Name, Value ? "true" : "false", disable_all?disabled_string:disable)
+
 #define PutTextInput(fp, Name, Value, Size, disable) \
 	fprintf(fp,\
 	"<input size=%d type=\"text\" name=\"%s\" value=\"%s\" %s>\n",\
@@ -3809,6 +3815,8 @@ static int gen_options(char **newfile)
 
     /* User Agent: INPUT */
     if (!no_useragent) {
+	PutLabel(fp0, gettext("Send User-Agent header"), send_user_agent_string);
+	PutCheckBox(fp0, send_user_agent_string, LYSendUserAgent, "");
 	PutLabel(fp0, gettext("User-Agent header"), user_agent_string);
 	PutTextInput(fp0, user_agent_string,
 		     NonNull(LYUserAgent), text_len, "");
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index 7954c336..ccffaa16 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYrcFile.c,v 1.76 2009/04/07 00:20:14 tom Exp $ */
+/* $LynxId: LYrcFile.c,v 1.77 2009/05/22 00:26:25 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <LYUtils.h>
@@ -519,6 +519,7 @@ of checkboxes for the OPTIONs.  A value of \"on\" will set popup menus\n\
 as the default while a value of \"off\" will set use of radio boxes.\n\
 The default can be overridden via the -popup command line toggle.\n\
 ")),
+    MAYBE_SET(RC_SEND_USERAGENT,        LYSendUserAgent,   MSG_ENABLE_LYNXRC),
     MAYBE_SET(RC_SET_COOKIES,           LYSetCookies,      MSG_ENABLE_LYNXRC),
     PARSE_ENU(RC_SHOW_COLOR,            LYrcShowColor,     tbl_show_colors, N_("\
 show_color specifies how to set the color mode at startup.  A value of\n\
diff --git a/src/LYrcFile.h b/src/LYrcFile.h
index 07506bba..56f75c68 100644
--- a/src/LYrcFile.h
+++ b/src/LYrcFile.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYrcFile.h,v 1.30 2009/04/06 23:07:40 tom Exp $
+ * $LynxId: LYrcFile.h,v 1.31 2009/05/22 00:19:45 tom Exp $
  */
 #ifndef LYRCFILE_H
 #define LYRCFILE_H
@@ -201,6 +201,7 @@
 #define RC_SEEK_FRAG_AREA_IN_CUR        "seek_frag_area_in_cur"
 #define RC_SEEK_FRAG_MAP_IN_CUR         "seek_frag_map_in_cur"
 #define RC_SELECT_POPUPS                "select_popups"
+#define RC_SEND_USERAGENT               "send_useragent"
 #define RC_SESSION_FILE                 "session_file"
 #define RC_SESSION_LIMIT                "session_limit"
 #define RC_SET_COOKIES                  "set_cookies"