On Thu, Oct 10, 2002 at 07:21:25PM +0100, Michel SUCH wrote:
> We have a problem connecting to the following link with latest lynx.
> http://webmail.t-online.de

I isolated the problem, and attach a patch which fixes it.  The issue
is that there was both a refresh-url, and the downloaded data is compressed.
The code I added in dev.8 for refresh-url will not work with compressed
data.  So I add a check for that condition.

-- 
Thomas E. Dickey <[EMAIL PROTECTED]>
http://invisible-island.net
ftp://invisible-island.net
--- HTMIME.c.orig       Tue May 28 15:56:46 2002
+++ HTMIME.c    Sun Oct 13 18:42:29 2002
@@ -200,6 +200,16 @@
     return result;
 }
 
+PRIVATE BOOL content_is_compressed ARGS1(HTStream *, me)
+{
+    char *encoding = me->anchor->content_encoding;
+
+    CTRACE((tfp, "FIXME testing %s\n", me->anchor->address));
+    return strcmp(encoding, "8bit") != 0
+       && strcmp(encoding, "7bit") != 0
+       && strcmp(encoding, "binary") != 0;
+}
+
 PRIVATE int pumpData ARGS1(HTStream *, me)
 {
     if (strchr(HTAtom_name(me->format), ';') != NULL) {
@@ -467,9 +477,11 @@
     } else {
        me->state = MIME_IGNORE;        /* What else to do? */
     }
-    if (me->refresh_url != NULL) {
+    if (me->refresh_url != NULL && !content_is_compressed(me)) {
        char *url = parse_parameter(me->refresh_url, "URL");
        char *txt = NULL;
+       char *arg = NULL;
+       char *base = "";        /* FIXME: refresh_url may be relative to doc */
        int num = 0;
 
        if (url != NULL) {
@@ -479,7 +491,10 @@
            HTSprintf0(&txt, gettext("Refresh: "));
            if (num != 0)
                HTSprintf(&txt, gettext("%.*s seconds "), num, me->refresh_url);
-           HTSprintf(&txt, "<a href=\"%s\">%s</a><br>", url, url);
+           if ((arg = strchr(url, '?')) != NULL)
+               *arg = '\0';
+           HTSprintf(&txt, "<a href=\"%s%s\">%s</a><br>", base, url, url);
+           CTRACE((tfp, "URL %s%s\n", base, url));
            (me->isa->put_string)(me, txt);
            free(url);
            free(txt);
@@ -658,20 +673,18 @@
        LYLowerCase(me->value);
        StrAllocCopy(me->anchor->content_encoding, me->value);
        FREE(me->compression_encoding);
-       if (!strcmp(me->value, "8bit") ||
-           !strcmp(me->value, "7bit") ||
-           !strcmp(me->value, "binary")) {
-           /*
-           **  Some server indicated "8bit", "7bit" or "binary"
-           **  inappropriately.  We'll ignore it. - FM
-           */
-           CTRACE((tfp, "                Ignoring it!\n"));
-       } else {
+       if (content_is_compressed(me)) {
            /*
            **  Save it to use as a flag for setting
            **  up a "www/compressed" target. - FM
            */
            StrAllocCopy(me->compression_encoding, me->value);
+       } else {
+           /*
+           **  Some server indicated "8bit", "7bit" or "binary"
+           **  inappropriately.  We'll ignore it. - FM
+           */
+           CTRACE((tfp, "                Ignoring it!\n"));
        }
        break;
     case miCONTENT_FEATURES:

Reply via email to