[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev lynx2.8.2dev.19 patch #7 (Options menu!)
From: |
Leonid Pauzner |
Subject: |
Re: lynx-dev lynx2.8.2dev.19 patch #7 (Options menu!) |
Date: |
Mon, 15 Mar 1999 20:16:51 +0300 (MSK) |
* Forms-based options menu: fix reloading of previous document *only* when
necessary (was always, since early forms-based options menu days).
Still have a bug - while submitting the options menu lynx reload menu again,
but this is much faster to load small local file twice than fetch previous
(possible large) document over the net. - LP
To see this new bug try toggle trace log before submitting form option menu,
or probably by eyes if change (links and form fiels are numbered) option.
I still thik this patch is a real improvement over the old bevaviour.
Please test whether the prev document updated when changing
your favourite options - I test it but probably forget 'need_reload' flag
somethere.
The patch is against dev.19
(Tom: please discard my LYOptions.c changes in #6 patch).
diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c Thu Mar 11 20:14:22 1999
+++ ./lymainlo.c Mon Mar 15 16:35:50 1999
@@ -4019,9 +4019,8 @@
#endif /* !NO_OPTION_MENU */
#ifndef NO_OPTION_FORMS
/*
- * FIXME: Blatantly stolen from LYK_PRINT below.
- * how much is really valid here? I don't know the
- * innards well enough. MRC
+ * FIXME: Blatantly stolen from LYK_PRINT below,
+ * except ForcePush special.
*/
/*
* Don't do if already viewing options page.
@@ -4042,12 +4041,12 @@
refresh_screen = TRUE; /* redisplay */
/*
- * FIXME: this is a temporary solution until we find the
- * correct place for this command to reload the document
+ * FIXME: this was a temporary solution until we found the
+ * correct place in postoptions() to reload the document
* before the 'options menu' only when (few) important options
* were changed.
*/
- HTuncache_current_document();
+/* HTuncache_current_document(); */
}
#endif /* !NO_OPTION_FORMS */
break;
diff -u old/lyoption.c ./lyoption.c
--- old/lyoption.c Mon Jan 18 04:29:20 1999
+++ ./lyoption.c Mon Mar 15 19:33:36 1999
@@ -1,5 +1,6 @@
#include <HTUtils.h>
#include <HTFTP.h>
+#include <HTTP.h> /* 'reloading' flag */
#include <HTML.h>
#include <LYCurses.h>
#include <LYUtils.h>
@@ -3495,14 +3496,6 @@
* post_data here, but bring along everything just in case. It's only a
* pointer. MRC
*
- * By changing the certain options value (like preferred language or
- * fake browser name) we need to inform the remote server and reload
- * (uncache on a proxy) the document which was active just before
- * the Options menu was invoked. Another values (like display_char_set
- * or assume_char_set) used by lynx initial rendering stages
- * and can only be changed after reloading :-(
- * So we introduce boolean flag 'need_reload' (currently dummy).
- *
* Options are processed in order according to gen_options(), we should not
* depend on it and add boolean flags where the order is essential (save,
* character sets...)
@@ -3511,13 +3504,30 @@
* conditions. We *should* duplicate the same conditions here in postoptions()
* to prevent user with a limited access from editing HTML options code
* manually (e.g., doing 'e'dit in 'o'ptions) and submit it to access the
- * restricted items. Prevent spoofing attempts from index overrun. - LP
+ * restricted items. Prevent spoofing attempts from index overrun. - LP
+ *
+ * Exit status: NULLFILE (reloading) or NORMAL (from HText cache).
+ *
+ * On exit, got the document which was current before the Options menu:
+ *
+ * (from cache) nothing changed or no visual effect supposed:
+ * editor name, e-mail, etc.
+ *
+ * (reload locally) to see the effect of certain changes:
+ * display_char_set, assume_charset, etc.
+ * (use 'need_reload' flag where necessary).
+ *
+ * (reload from remote server and uncache on a proxy)
+ * few options changes should be transferred to remote server:
+ * preferred language, fake browser name, etc.
+ * (use 'need_end_reload' flag).
*/
PUBLIC int postoptions ARGS1(
document *, newdoc)
{
PostPair *data = 0;
+ DocAddress WWWDoc; /* need on exit */
int i;
int code;
BOOLEAN save_all = FALSE;
@@ -3525,6 +3535,7 @@
BOOLEAN raw_mode_old = LYRawMode;
BOOLEAN assume_char_set_changed = FALSE;
BOOLEAN need_reload = FALSE;
+ BOOLEAN need_end_reload = FALSE;
#if defined(USE_SLANG) || defined(COLOR_CURSES)
int CurrentShowColor = LYShowColor;
#endif
@@ -3613,7 +3624,12 @@
/* Keypad Mode: SELECT */
if (!strcmp(data[i].tag, keypad_mode_string)) {
- GetOptValues(keypad_mode_values, data[i].value, &keypad_mode);
+ int newval;
+ if (GetOptValues(keypad_mode_values, data[i].value, &newval)
+ && keypad_mode != newval) {
+ keypad_mode = newval;
+ need_reload = TRUE;
+ }
}
/* Line edit style: SELECT */
@@ -3653,8 +3669,11 @@
/* HTML error tolerance: SELECT */
if (!strcmp(data[i].tag, DTD_recovery_string)
&& GetOptValues(DTD_type_values, data[i].value, &code)) {
- Old_DTD = code;
- HTSwitchDTD(!Old_DTD);
+ if (Old_DTD != code) {
+ Old_DTD = code;
+ HTSwitchDTD(!Old_DTD);
+ need_reload = TRUE;
+ }
}
/* Select Popups: ON/OFF */
@@ -3696,21 +3715,30 @@
/* Show Images: SELECT */
if (!strcmp(data[i].tag, images_string)) {
- if (!strcmp(data[i].value, images_ignore_all_string)) {
+ if (!strcmp(data[i].value, images_ignore_all_string)
+ && !(pseudo_inline_alts == FALSE && clickable_images ==
FALSE)) {
pseudo_inline_alts = FALSE;
clickable_images = FALSE;
- } else if (!strcmp(data[i].value, images_use_label_string)) {
+ need_reload = TRUE;
+ } else if (!strcmp(data[i].value, images_use_label_string)
+ && !(pseudo_inline_alts == TRUE && clickable_images ==
FALSE)) {
pseudo_inline_alts = TRUE;
clickable_images = FALSE;
- } else if (!strcmp(data[i].value, images_use_links_string)) {
+ need_reload = TRUE;
+ } else if (!strcmp(data[i].value, images_use_links_string)
+ && !(clickable_images == TRUE)) {
clickable_images = TRUE;
+ need_reload = TRUE;
}
}
/* Verbose Images: ON/OFF */
if (!strcmp(data[i].tag, verbose_images_string)
&& GetOptValues(verbose_images_type_values, data[i].value, &code)) {
- verbose_img = code;
+ if (verbose_img != code) {
+ verbose_img = code;
+ need_reload = TRUE;
+ }
}
/* VI Keys: ON/OFF */
@@ -3799,28 +3827,37 @@
/* Preferred Document Character Set: INPUT */
if (!strcmp(data[i].tag, preferred_doc_char_string)) {
- FREE(pref_charset);
- StrAllocCopy(pref_charset, data[i].value);
+ if (strcmp(pref_charset, data[i].value)) {
+ FREE(pref_charset);
+ StrAllocCopy(pref_charset, data[i].value);
+ need_end_reload = TRUE;
+ }
}
/* Preferred Document Language: INPUT */
if (!strcmp(data[i].tag, preferred_doc_lang_string)) {
- FREE(language);
- StrAllocCopy(language, data[i].value);
+ if (strcmp(language, data[i].value)) {
+ FREE(language);
+ StrAllocCopy(language, data[i].value);
+ need_end_reload = TRUE;
+ }
}
/* User Agent: INPUT */
if (!strcmp(data[i].tag, user_agent_string) && (!no_useragent)) {
- FREE(LYUserAgent);
- /* ignore Copyright warning ? */
- StrAllocCopy(LYUserAgent,
- *(data[i].value)
- ? data[i].value
- : LYUserAgentDefault);
- if (LYUserAgent && *LYUserAgent &&
- !strstr(LYUserAgent, "Lynx") &&
- !strstr(LYUserAgent, "lynx")) {
- HTAlert(UA_COPYRIGHT_WARNING);
+ if (strcmp(LYUserAgent, data[i].value)) {
+ need_end_reload = TRUE;
+ FREE(LYUserAgent);
+ /* ignore Copyright warning ? */
+ StrAllocCopy(LYUserAgent,
+ *(data[i].value)
+ ? data[i].value
+ : LYUserAgentDefault);
+ if (LYUserAgent && *LYUserAgent &&
+ !strstr(LYUserAgent, "Lynx") &&
+ !strstr(LYUserAgent, "lynx")) {
+ HTAlert(UA_COPYRIGHT_WARNING);
+ }
}
}
} /* end of loop */
@@ -3870,12 +3907,68 @@
HTAlert(OPTIONS_NOT_SAVED);
}
}
- LYpop(newdoc); /* return to previous doc, not to options menu! */
- if (need_reload == TRUE) {
- /* FIXME: currently dummy */
+ /*
+ * Exit: working around the previous document.
+ */
+
+ /* Options menu was pushed before postoptions(), so pop-up. */
+ LYpop(newdoc);
+ WWWDoc.address = newdoc->address;
+ WWWDoc.post_data = newdoc->post_data;
+ WWWDoc.post_content_type = newdoc->post_content_type;
+ WWWDoc.bookmark = newdoc->bookmark;
+ WWWDoc.isHEAD = newdoc->isHEAD;
+ WWWDoc.safe = newdoc->safe;
+ if (!HTLoadAbsolute(&WWWDoc))
+ /* HTLoadAbsolute seems redundant here but allow things work correctly
*/
+ return(NOT_FOUND);
+
+ /*
+ * Return to previous doc, not to options menu!
+ * Reload the document we had before the options menu:
+ */
+ LYpop(newdoc);
+ WWWDoc.address = newdoc->address;
+ WWWDoc.post_data = newdoc->post_data;
+ WWWDoc.post_content_type = newdoc->post_content_type;
+ WWWDoc.bookmark = newdoc->bookmark;
+ WWWDoc.isHEAD = newdoc->isHEAD;
+ WWWDoc.safe = newdoc->safe;
+ if (!HTLoadAbsolute(&WWWDoc))
+ return(NOT_FOUND);
+
+ /* force end-to-end reload from remote server if change LYUserAgent
+ * or language or pref_charset (marked by need_end_reload flag above),
+ * from old-style LYK_OPTIONS (mainloop):
+ */
+ if ((need_end_reload == TRUE &&
+ (strncmp(newdoc->address, "http", 4) == 0 ||
+ strncmp(newdoc->address, "lynxcgi:", 8) == 0))) {
+ /*
+ * An option has changed which may influence
+ * content negotiation, and the resource is from
+ * a http or https or lynxcgi URL (the only protocols
+ * which currently do anything with this information).
+ * Set reloading = TRUE so that proxy caches will be
+ * flushed, which is necessary until the time when
+ * all proxies understand HTTP 1.1 Vary: and all
+ * Servers properly use it... Treat like
+ * case LYK_RELOAD (see comments there). - KW
+ */
+ reloading = TRUE; /* global flag */
+ need_reload = TRUE;
+ }
+
+ if (need_reload == TRUE) {
+ /* update HText cache */
+ HTuncache_current_document();
+ LYpush(newdoc, FALSE);
+ return(NULLFILE);
+ } else {
+ /* no uncache, already loaded */
+ return(NORMAL);
}
- return(NULLFILE);
}
PRIVATE char *NewSecureValue NOARGS
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), (continued)
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), Philip Webb, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), David Combs, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), Philip Webb, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), Klaus Weide, 1999/03/16
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), David Combs, 1999/03/16
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), David Combs, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), Philip Webb, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), Leonid Pauzner, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #6 (em dash = --), Leonid Pauzner, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #8 (minore chrtrans undo), Leonid Pauzner, 1999/03/15
- Re: lynx-dev lynx2.8.2dev.19 patch #7 (Options menu!),
Leonid Pauzner <=
- Re: lynx-dev lynx2.8.2dev.19 patch #9 (more comments), Leonid Pauzner, 1999/03/16
- Re: lynx-dev lynx2.8.2dev.19 patch #7 (Options menu!), Leonid Pauzner, 1999/03/16
- lynx-dev lynx2.8.2dev.19 patch #2 (DJGPP build), Leonid Pauzner, 1999/03/04
- lynx-dev lynx2.8.2dev.19 patch #3 (non UNIX build), Leonid Pauzner, 1999/03/05
Re: lynx-dev lynx2.8.2dev.18, brian j pardy, 1999/03/04
Re: lynx-dev lynx2.8.2dev.18, Kim DeVaughn, 1999/03/04