[w3m-dev-en 00242] Small bug with fix

From: Lars Bjønnes (larslist@online.no)
Date: Mon Oct 02 2000 - 07:43:49 CDT

  • Next message: Norman Walsh: "[w3m-dev-en 00243] Patch for display.c in w3m.0.1.10"

    I've been using w3m for some time now (the version distributed
    with Debiam, 0.1.10-1) and I use it as my main browser. Thanks for
    a great browser!

    I've noticed a problem with the META-tag:

    Say you go to <URL: http://msdn.microsoft.com/ > which tries
    to redirect you to another page, using the
    <META HTTP-EQUIV="refresh" URL="0;url=someurl">
    tag.

    However, if there's a space betweem 0; (number of seconds to
    wait and semicolon) and the URL, it breaks in w3m.
    Example:
    <META HTTP-EQUIV="refresh" URL="0; url=someurl">

    After some searching I found the reason: In the HTML_META-case
    in file.c, a SKIP_BLANKS is missing.

    I tried to make diff, but with all the different patches, I couldn't
    get it to patch cleanly. So, for the code maintainer, here's what
    need to be done:

    In file.c, find the HTML_META-case.

      case HTML_META:
            p = q = NULL;
    #ifndef ID_EXT
            targ = parse_tag(h_env->tagbuf->ptr);
    #endif /* !ID_EXT */
            for (t = targ; t; t = t->next) {
                if (!strcasecmp(t->arg, "http-equiv") && t->value)
                    p = t->value;
                else if (!strcasecmp(t->arg, "content") && t->value)
                    q = t->value;
            }
    #ifdef JP_CHARSET
            if (p && q && !strcasecmp(p, "Content-Type") &&
                (q = strcasestr(q, "charset")) != NULL) {
                q += 7;
                SKIP_BLANKS(q);
                if (*q == '=')
                    q++;
                SKIP_BLANKS(q);
                content_charset = guess_charset(q);
            }
            else
    #endif
            if (p && q && !strcasecmp(p, "refresh")) {
                int refresh = atoi(q);
                Str s_tmp = NULL;

                while (*q) {
                                    // PATCH ALERT! :-)
                                    // *** APPLY SKIP_BLANKS(q) HERE! *** //
                   SKIP_BLANKS(q); // <- Yup, here it is!

                    if (!strncasecmp(q, "url=", 4)) {
                        q += 4;
                        if (*q == '\"') /* " */
                            q++;
                        r = q;
                        while (*r && !IS_SPACE(*r) && *r != ';')
                            r++;

    (I haven't tested this with the JP_CHARSET-flag, but it should work
    fine. (Famous last words. :-))

    Once again, sorry for no diff/patch-file.

    -- 
    Lars
    



    This archive was generated by hypermail 2b29 : Mon Oct 02 2000 - 07:58:46 CDT