diff options
Diffstat (limited to 'WWW/Library/Implementation/HTMIME.c')
-rw-r--r-- | WWW/Library/Implementation/HTMIME.c | 1221 |
1 files changed, 558 insertions, 663 deletions
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index e060d372..f165a6a2 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -108,38 +108,38 @@ typedef enum _MIME_state { miJUNK_LINE, /* Ignore the rest of this folded line */ miNEWLINE, /* Just found a LF .. maybe continuation */ miCHECK, /* check against check_pointer */ - MIME_NET_ASCII, /* Translate from net ascii */ + MIME_NET_ASCII, /* Translate from net ascii */ MIME_IGNORE /* Ignore entire file */ /* TRANSPARENT and IGNORE are defined as stg else in _WINDOWS */ } MIME_state; -#define VALUE_SIZE 1024 /* @@@@@@@ Arbitrary? */ +#define VALUE_SIZE 1024 /* @@@@@@@ Arbitrary? */ struct _HTStream { CONST HTStreamClass * isa; - + BOOL net_ascii; /* Is input net ascii? */ MIME_state state; /* current state */ MIME_state if_ok; /* got this state if match */ MIME_state field; /* remember which field */ MIME_state fold_state; /* state on a fold */ CONST char * check_pointer; /* checking input */ - + char * value_pointer; /* storing values */ - char value[VALUE_SIZE]; - - HTParentAnchor * anchor; /* Given on creation */ + char value[VALUE_SIZE]; + + HTParentAnchor * anchor; /* Given on creation */ HTStream * sink; /* Given on creation */ - + char * boundary; /* For multipart */ char * set_cookie; /* Set-Cookie */ char * set_cookie2; /* Set-Cookie2 */ - + HTFormat encoding; /* Content-Transfer-Encoding */ char * compression_encoding; - HTFormat format; /* Content-Type */ - HTStream * target; /* While writing out */ + HTFormat format; /* Content-Type */ + HTStream * target; /* While writing out */ HTStreamClass targetClass; - + HTAtom * targetRep; /* Converting into? */ }; @@ -151,34 +151,34 @@ struct _HTStream { ** first and last characters are double-quotes. - FM */ PUBLIC void HTMIME_TrimDoubleQuotes ARGS1( - char *, value) + char *, value) { int i; char *cp = value; if (!(cp && *cp) || *cp != '\"') - return; + return; i = strlen(cp); if (cp[(i - 1)] != '\"') - return; + return; else - cp[(i - 1)] = '\0'; + cp[(i - 1)] = '\0'; for (i = 0; value[i]; i++) - value[i] = cp[(i +1)]; + value[i] = cp[(i +1)]; } /*_________________________________________________________________________ ** -** A C T I O N R O U T I N E S +** A C T I O N R O U T I N E S */ /* Character handling ** ------------------ ** ** This is a FSM parser which is tolerant as it can be of all -** syntax errors. It ignores field names it does not understand, +** syntax errors. It ignores field names it does not understand, ** and resynchronises on line beginnings. */ PRIVATE void HTMIME_put_character ARGS2( @@ -188,17 +188,17 @@ PRIVATE void HTMIME_put_character ARGS2( int i, j; if (me->state == MIME_TRANSPARENT) { - (*me->targetClass.put_character)(me->target, c);/* MUST BE FAST */ + (*me->targetClass.put_character)(me->target, c);/* MUST BE FAST */ return; } /* - ** This slightly simple conversion just strips CR and turns LF to - ** newline. On unix LF is \n but on Mac \n is CR for example. - ** See NetToText for an implementation which preserves single CR or LF. + ** This slightly simple conversion just strips CR and turns LF to + ** newline. On unix LF is \n but on Mac \n is CR for example. + ** See NetToText for an implementation which preserves single CR or LF. */ if (me->net_ascii) { - c = FROMASCII(c); + c = FROMASCII(c); if (c == CR) return; else if (c == LF) @@ -208,32 +208,32 @@ PRIVATE void HTMIME_put_character ARGS2( switch(me->state) { case MIME_IGNORE: - return; + return; case MIME_TRANSPARENT: /* Not reached see above */ - (*me->targetClass.put_character)(me->target, c); + (*me->targetClass.put_character)(me->target, c); return; case MIME_NET_ASCII: - (*me->targetClass.put_character)(me->target, c); /* MUST BE FAST */ + (*me->targetClass.put_character)(me->target, c); /* MUST BE FAST */ return; case miNEWLINE: if (c != '\n' && WHITE(c)) { /* Folded line */ - me->state = me->fold_state; /* pop state before newline */ + me->state = me->fold_state; /* pop state before newline */ break; } /* else Falls through */ - + case miBEGINNING_OF_LINE: - me->net_ascii = YES; + me->net_ascii = YES; switch (c) { case 'a': case 'A': me->state = miA; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Got 'A' at beginning of line, state now A\n"); break; @@ -241,7 +241,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'C': me->state = miC; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'C' at beginning of line, state now C\n"); break; @@ -251,7 +251,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miDATE; me->state = miCHECK; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'D' at beginning of line, checking for 'ate:'\n"); break; @@ -259,7 +259,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'E': me->state = miE; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'E' at beginning of line, state now E\n"); break; @@ -269,7 +269,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miKEEP_ALIVE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Got 'K' at beginning of line, checking for 'eep-alive:'\n"); break; @@ -277,7 +277,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'L': me->state = miL; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'L' at beginning of line, state now L\n"); break; @@ -285,7 +285,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'P': me->state = miP; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'P' at beginning of line, state now P\n"); break; @@ -295,7 +295,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miRETRY_AFTER; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Got 'R' at beginning of line, checking for 'etry-after'\n"); break; @@ -303,7 +303,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'S': me->state = miS; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'S' at beginning of line, state now S\n"); break; @@ -311,7 +311,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'T': me->state = miT; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'T' at beginning of line, state now T\n"); break; @@ -319,7 +319,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'U': me->state = miU; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'U' at beginning of line, state now U\n"); break; @@ -327,7 +327,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'V': me->state = miV; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'V' at beginning of line, state now V\n"); break; @@ -335,40 +335,40 @@ PRIVATE void HTMIME_put_character ARGS2( case 'W': me->state = miW; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Got 'W' at beginning of line, state now W\n"); break; case '\n': /* Blank line: End of Header! */ { - me->net_ascii = NO; + me->net_ascii = NO; if (strchr(HTAtom_name(me->format), ';') != NULL) { char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Extended MIME Content-Type is %s\n", HTAtom_name(me->format)); StrAllocCopy(cp, HTAtom_name(me->format)); /* - ** Note that the Content-Type value was converted - ** to lower case when we loaded into me->format, - ** but there may have been a mixed or upper-case - ** atom, so we'll force lower-casing again. We - ** also stripped spaces and double-quotes, but - ** we'll make sure they're still gone from any - ** charset parameter we check. - FM + ** Note that the Content-Type value was converted + ** to lower case when we loaded into me->format, + ** but there may have been a mixed or upper-case + ** atom, so we'll force lower-casing again. We + ** also stripped spaces and double-quotes, but + ** we'll make sure they're still gone from any + ** charset parameter we check. - FM */ for (i = 0; cp[i]; i++) - cp[i] = TOLOWER(cp[i]); + cp[i] = TOLOWER(cp[i]); if ((cp1 = strchr(cp, ';')) != NULL) { BOOL chartrans_ok = NO; - if ((cp2 = strstr(cp1, "charset")) != NULL) { + if ((cp2 = strstr(cp1, "charset")) != NULL) { int chndl; cp2 += 7; while (*cp2 == ' ' || *cp2 == '=' || *cp2 == '\"') - cp2++; + cp2++; StrAllocCopy(cp3, cp2); /* copy to mutilate more */ for (cp4 = cp3; (*cp4 != '\0' && *cp4 != '\"' && *cp4 != ';' && *cp4 != ':' && @@ -384,9 +384,10 @@ PRIVATE void HTMIME_put_character ARGS2( me->format = HTAtom_for(cp); StrAllocCopy(me->anchor->charset, cp4); HTAnchor_setUCInfoStage(me->anchor, chndl, - UCT_STAGE_MIME, UCT_SETBY_MIME); + UCT_STAGE_MIME, + UCT_SETBY_MIME); } - else if (chndl < 0) {/* got something but we don't + else if (chndl < 0) {/* got something but we don't recognize it */ chndl = UCLYhndl_for_unrec; if (UCCanTranslateFromTo(chndl, @@ -395,7 +396,8 @@ PRIVATE void HTMIME_put_character ARGS2( *cp1 = '\0'; me->format = HTAtom_for(cp); HTAnchor_setUCInfoStage(me->anchor, chndl, - UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + UCT_STAGE_MIME, + UCT_SETBY_DEFAULT); } } FREE(cp3); @@ -406,11 +408,11 @@ PRIVATE void HTMIME_put_character ARGS2( LYUCcharset * p_out = HTAnchor_setUCInfoStage(me->anchor, current_char_set, - UCT_STAGE_HTEXT, + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); if (!p_out) /* - ** Try again. + ** Try again. */ p_out = HTAnchor_getUCInfoStage(me->anchor, @@ -422,7 +424,8 @@ PRIVATE void HTMIME_put_character ARGS2( HTAnchor_setUCInfoStage(me->anchor, HTAnchor_getUCLYhndl(me->anchor, UCT_STAGE_HTEXT), - UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + UCT_STAGE_MIME, + UCT_SETBY_DEFAULT); } if (!strcmp(p_out->MIMEname, "x-transparent")) { @@ -473,14 +476,17 @@ PRIVATE void HTMIME_put_character ARGS2( HTCJK = NOCJK; } } - } else if + /* + ** Check for an iso-8859-# we don't know. - FM + */ + } else if (!strncmp(cp4, "iso-8859-", 9) && isdigit((unsigned char)cp4[9]) && !strncmp(LYchar_set_names[current_char_set], - "Other ISO Latin", 15)) { - /* - ** Hope it's a match, for now. - FM - */ + "Other ISO Latin", 15)) { + /* + ** Hope it's a match, for now. - FM + */ *cp1 = '\0'; me->format = HTAtom_for(cp); cp1 = &cp4[10]; @@ -491,126 +497,13 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCopy(me->anchor->charset, cp4); HTPassEightBitRaw = TRUE; HTAlert(me->anchor->charset); -#ifdef NOT_USED /* pre-chartrans */ - } else if (!strncmp(cp2, "us-ascii", 8) || - !strncmp(cp2, "iso-8859-1", 10)) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-8859-1"); - HTCJK = NOCJK; - } else if - (!strncmp(cp2, "iso-8859-2", 10) && - !strncmp(LYchar_set_names[current_char_set], - "ISO Latin 2", 11)) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-8859-2"); - HTPassEightBitRaw = TRUE; - } else if - (!strncmp(cp2, "iso-8859-", 9) && - !strncmp(LYchar_set_names[current_char_set], - "Other ISO Latin", 15)) { - /* - ** Hope it's a match, for now. - FM - */ - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-8859- "); - me->anchor->charset[9] = cp2[9]; - HTPassEightBitRaw = TRUE; - HTAlert(me->anchor->charset); - } else if - (!strncmp(cp2, "koi8-r", 6) && - !strncmp(LYchar_set_names[current_char_set], - "KOI8-R Cyrillic", 15)) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "koi8-r"); - HTPassEightBitRaw = TRUE; - } else if - (!strncmp(cp2, "euc-jp", 6) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "euc-jp"); - } else if - (!strncmp(cp2, "shift_jis", 9) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "shift_jis"); - } else if - (!strncmp(cp2, "iso-2022-jp", 11) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-jp"); - } else if - (!strncmp(cp2, "iso-2022-jp-2", 13) && - HTCJK == JAPANESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-jp-2"); - } else if - (!strncmp(cp2, "euc-kr", 6) && - HTCJK == KOREAN) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "euc-kr"); - } else if - (!strncmp(cp2, "iso-2022-kr", 11) && - HTCJK == KOREAN) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-kr"); - } else if - ((!strncmp(cp2, "big5", 4) || - !strncmp(cp2, "cn-big5", 7)) && - HTCJK == TAIPEI) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "big5"); - } else if - (!strncmp(cp2, "euc-cn", 6) && - HTCJK == CHINESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "euc-cn"); - } else if - ((!strncmp(cp2, "gb2312", 6) || - !strncmp(cp2, "cn-gb", 5)) && - HTCJK == CHINESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "gb2312"); - } else if - (!strncmp(cp2, "iso-2022-cn", 11) && - HTCJK == CHINESE) { - *cp1 = '\0'; - me->format = HTAtom_for(cp); - StrAllocCopy(me->anchor->charset, - "iso-2022-cn"); -#endif /* NOT_USED */ } FREE(cp3); } else { /* - ** No charset parameter is present. - ** Ignore all other parameters, as - ** we do when charset is present. - FM + ** No charset parameter is present. + ** Ignore all other parameters, as + ** we do when charset is present. - FM */ *cp1 = '\0'; me->format = HTAtom_for(cp); @@ -633,7 +526,7 @@ PRIVATE void HTMIME_put_character ARGS2( */ me->anchor->no_cache = TRUE; } else if (me->anchor->date != NULL) { - /* + /* ** We have a Date header, so check if ** the value is less than or equal to ** that. - FM @@ -643,7 +536,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->anchor->no_cache = TRUE; } } else if (LYmktime(me->anchor->expires, FALSE) <= 0) { - /* + /* ** We don't have a Date header, and ** the value is in past for us. - FM */ @@ -653,23 +546,23 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCopy(me->anchor->content_type, HTAtom_name(me->format)); if (!me->compression_encoding) { - if (TRACE) { - fprintf(stderr, + if (TRACE) { + fprintf(stderr, "HTMIME: MIME Content-Type is '%s', converting to '%s'\n", HTAtom_name(me->format), HTAtom_name(me->targetRep)); } } else { /* - ** Change the format to that for "www/compressed" - ** and set up a stream to deal with it. - FM + ** Change the format to that for "www/compressed" + ** and set up a stream to deal with it. - FM */ - if (TRACE) { - fprintf(stderr, + if (TRACE) { + fprintf(stderr, "HTMIME: MIME Content-Type is '%s',\n", HTAtom_name(me->format)); } me->format = HTAtom_for("www/compressed"); - if (TRACE) { - fprintf(stderr, + if (TRACE) { + fprintf(stderr, " Treating as '%s'. Converting to '%s'\n", HTAtom_name(me->format), HTAtom_name(me->targetRep)); } @@ -682,18 +575,18 @@ PRIVATE void HTMIME_put_character ARGS2( FREE(me->set_cookie2); } me->target = HTStreamStack(me->format, me->targetRep, - me->sink , me->anchor); + me->sink , me->anchor); if (!me->target) { if (TRACE) - fprintf(stderr, "HTMIME: Can't translate! ** \n"); + fprintf(stderr, "HTMIME: Can't translate! ** \n"); me->target = me->sink; /* Cheat */ } if (me->target) { me->targetClass = *me->target->isa; /* - ** Check for encoding and select state from there, - ** someday, but until we have the relevant code, - ** from now push straight through. - FM + ** Check for encoding and select state from there, + ** someday, but until we have the relevant code, + ** from now push straight through. - FM */ me->state = MIME_TRANSPARENT; } else { @@ -708,17 +601,17 @@ PRIVATE void HTMIME_put_character ARGS2( break; } /* switch on character */ - break; + break; case miA: /* Check for 'c','g' or 'l' */ - switch (c) { + switch (c) { case 'c': case 'C': me->check_pointer = "cept-ranges:"; me->if_ok = miACCEPT_RANGES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was A, found C, checking for 'cept-ranges:'\n"); break; @@ -728,7 +621,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miAGE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was A, found G, checking for 'e:'\n"); break; @@ -736,7 +629,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'L': me->state = miAL; if (TRACE) - fprintf(stderr, "HTMIME: Was A, found L, state now AL'\n"); + fprintf(stderr, "HTMIME: Was A, found L, state now AL'\n"); break; default: @@ -751,14 +644,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miAL: /* Check for 'l' or 't' */ - switch (c) { - case 'l': - case 'L': + switch (c) { + case 'l': + case 'L': me->check_pointer = "ow:"; me->if_ok = miALLOW; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was AL, found L, checking for 'ow:'\n"); break; @@ -768,7 +661,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miALTERNATES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was AL, found T, checking for 'ernates:'\n"); break; @@ -784,14 +677,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miC: /* Check for 'a' or 'o' */ - switch (c) { - case 'a': + switch (c) { + case 'a': case 'A': me->check_pointer = "che-control:"; me->if_ok = miCACHE_CONTROL; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was C, found A, checking for 'che-control:'\n"); break; @@ -799,7 +692,7 @@ PRIVATE void HTMIME_put_character ARGS2( case 'O': me->state = miCO; if (TRACE) - fprintf(stderr, "HTMIME: Was C, found O, state now CO'\n"); + fprintf(stderr, "HTMIME: Was C, found O, state now CO'\n"); break; default: @@ -814,28 +707,28 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCO: /* Check for 'n' or 'o' */ - switch (c) { - case 'n': - case 'N': + switch (c) { + case 'n': + case 'N': me->state = miCON; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CO, found N, state now CON\n"); - break; + break; - case 'o': - case 'O': + case 'o': + case 'O': me->check_pointer = "kie:"; me->if_ok = miCOOKIE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CO, found O, checking for 'kie:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", c, "'n' or 'o'"); goto bad_field_name; @@ -844,15 +737,15 @@ PRIVATE void HTMIME_put_character ARGS2( } /* switch on character */ break; - case miCON: /* Check for 'n' or 't' */ - switch (c) { - case 'n': - case 'N': + case miCON: /* Check for 'n' or 't' */ + switch (c) { + case 'n': + case 'N': me->check_pointer = "ection:"; me->if_ok = miCONNECTION; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CON, found N, checking for 'ection:'\n"); break; @@ -862,7 +755,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miCONTENT_; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CON, found T, checking for 'ent-'\n"); break; @@ -878,14 +771,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miE: /* Check for 't' or 'x' */ - switch (c) { - case 't': + switch (c) { + case 't': case 'T': me->check_pointer = "ag:"; me->if_ok = miETAG; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was E, found T, checking for 'ag:'\n"); break; @@ -895,15 +788,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miEXPIRES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was E, found X, checking for 'pires:'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'t' or 'x'"); + c, "'t' or 'x'"); goto bad_field_name; break; @@ -911,14 +804,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miL: /* Check for 'a', 'i' or 'o' */ - switch (c) { + switch (c) { case 'a': case 'A': me->check_pointer = "st-modified:"; me->if_ok = miLAST_MODIFIED; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was L, found A, checking for 'st-modified:'\n"); break; @@ -928,7 +821,7 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miLINK; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was L, found I, checking for 'nk:'\n"); break; @@ -938,15 +831,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miLOCATION; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was L, found O, checking for 'cation:'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a', 'i' or 'o'"); + c, "'a', 'i' or 'o'"); goto bad_field_name; break; @@ -954,29 +847,29 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miP: /* Check for 'r' or 'u' */ - switch (c) { + switch (c) { case 'r': case 'R': me->state = miPR; if (TRACE) - fprintf(stderr, "HTMIME: Was P, found R, state now PR'\n"); + fprintf(stderr, "HTMIME: Was P, found R, state now PR'\n"); break; - case 'u': + case 'u': case 'U': me->check_pointer = "blic:"; me->if_ok = miPUBLIC; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was P, found U, checking for 'blic:'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'r' or 'u'"); + c, "'r' or 'u'"); goto bad_field_name; break; @@ -984,14 +877,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miPR: /* Check for 'a' or 'o' */ - switch (c) { + switch (c) { case 'a': case 'A': me->check_pointer = "gma:"; me->if_ok = miPRAGMA; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was PR, found A, checking for 'gma'\n"); break; @@ -1001,15 +894,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miPROXY_AUTHENTICATE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was PR, found O, checking for 'xy-authenticate'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'o'"); + c, "'a' or 'o'"); goto bad_field_name; break; @@ -1017,28 +910,28 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miS: /* Check for 'a' or 'e' */ - switch (c) { + switch (c) { case 'a': case 'A': me->check_pointer = "fe:"; me->if_ok = miSAFE; me->state = miCHECK; if (TRACE) - fprintf(stderr, "HTMIME: Was S, found A, checking for 'fe:'\n"); + fprintf(stderr, "HTMIME: Was S, found A, checking for 'fe:'\n"); break; case 'e': case 'E': me->state = miSE; if (TRACE) - fprintf(stderr, "HTMIME: Was S, found E, state now SE'\n"); + fprintf(stderr, "HTMIME: Was S, found E, state now SE'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'e'"); + c, "'a' or 'e'"); goto bad_field_name; break; @@ -1046,14 +939,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSE: /* Check for 'r' or 't' */ - switch (c) { + switch (c) { case 'r': case 'R': me->check_pointer = "ver:"; me->if_ok = miSERVER; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SE, found R, checking for 'ver'\n"); break; @@ -1063,15 +956,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miSET_COOKIE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SE, found T, checking for '-cookie'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'r' or 't'"); + c, "'r' or 't'"); goto bad_field_name; break; @@ -1079,12 +972,12 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miSET_COOKIE: /* Check for ':' or '2' */ - switch (c) { + switch (c) { case ':': me->field = miSET_COOKIE1; /* remember it */ me->state = miSKIP_GET_VALUE; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SET_COOKIE, found :, processing\n"); break; @@ -1093,15 +986,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miSET_COOKIE2; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was SET_COOKIE, found 2, checking for ':'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "':' or '2'"); + c, "':' or '2'"); goto bad_field_name; break; @@ -1109,16 +1002,16 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miT: /* Check for 'i' or 'r' */ - switch (c) { - case 'i': + switch (c) { + case 'i': case 'I': me->check_pointer = "tle:"; me->if_ok = miTITLE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was T, found I, checking for 'tle:'\n"); - break; + break; case 'r': case 'R': @@ -1126,15 +1019,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miTRANSFER_ENCODING; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was T, found R, checking for 'ansfer-encoding'\n"); break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'i' or 'r'"); + c, "'i' or 'r'"); goto bad_field_name; break; @@ -1142,14 +1035,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miU: /* Check for 'p' or 'r' */ - switch (c) { - case 'p': + switch (c) { + case 'p': case 'P': me->check_pointer = "grade:"; me->if_ok = miUPGRADE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was U, found P, checking for 'grade:'\n"); break; @@ -1159,15 +1052,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miURI; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was U, found R, checking for 'i:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'p' or 'r'"); + c, "'p' or 'r'"); goto bad_field_name; break; @@ -1175,14 +1068,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miV: /* Check for 'a' or 'i' */ - switch (c) { - case 'a': + switch (c) { + case 'a': case 'A': me->check_pointer = "ry:"; me->if_ok = miVARY; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was V, found A, checking for 'ry:'\n"); break; @@ -1192,15 +1085,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miVIA; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was V, found I, checking for 'a:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'i'"); + c, "'a' or 'i'"); goto bad_field_name; break; @@ -1208,14 +1101,14 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miW: /* Check for 'a' or 'w' */ - switch (c) { - case 'a': + switch (c) { + case 'a': case 'A': me->check_pointer = "rning:"; me->if_ok = miWARNING; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was W, found A, checking for 'rning:'\n"); break; @@ -1225,15 +1118,15 @@ PRIVATE void HTMIME_put_character ARGS2( me->if_ok = miWWW_AUTHENTICATE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was W, found W, checking for 'w-authenticate:'\n"); - break; + break; default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Bad character `%c' found where `%s' expected\n", - c, "'a' or 'w'"); + c, "'a' or 'w'"); goto bad_field_name; break; @@ -1241,186 +1134,186 @@ PRIVATE void HTMIME_put_character ARGS2( break; case miCHECK: /* Check against string */ - if (TOLOWER(c) == *(me->check_pointer)++) { + if (TOLOWER(c) == *(me->check_pointer)++) { if (!*me->check_pointer) - me->state = me->if_ok; + me->state = me->if_ok; } else { /* Error */ if (TRACE) - fprintf(stderr, - "HTMIME: Bad character `%c' found where `%s' expected\n", - c, me->check_pointer - 1); + fprintf(stderr, + "HTMIME: Bad character `%c' found where `%s' expected\n", + c, me->check_pointer - 1); goto bad_field_name; } break; case miCONTENT_: if (TRACE) - fprintf (stderr, - "HTMIME: in case CONTENT_\n"); - switch(c) { - case 'b': - case 'B': + fprintf (stderr, + "HTMIME: in case CONTENT_\n"); + switch(c) { + case 'b': + case 'B': me->check_pointer = "ase:"; me->if_ok = miCONTENT_BASE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found B, checking for 'ase:'\n"); break; - case 'd': - case 'D': + case 'd': + case 'D': me->check_pointer = "isposition:"; me->if_ok = miCONTENT_DISPOSITION; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found D, checking for 'isposition:'\n"); break; - case 'e': - case 'E': + case 'e': + case 'E': me->check_pointer = "ncoding:"; me->if_ok = miCONTENT_ENCODING; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found E, checking for 'ncoding:'\n"); break; - case 'f': - case 'F': + case 'f': + case 'F': me->check_pointer = "eatures:"; me->if_ok = miCONTENT_FEATURES; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found F, checking for 'eatures:'\n"); break; - case 'l': - case 'L': + case 'l': + case 'L': me->state = miCONTENT_L; if (TRACE) - fprintf (stderr, + fprintf (stderr, "HTMIME: Was CONTENT_, found L, state now CONTENT_L\n"); break; - case 'm': - case 'M': + case 'm': + case 'M': me->check_pointer = "d5:"; me->if_ok = miCONTENT_MD5; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found M, checking for 'd5:'\n"); break; - case 'r': - case 'R': + case 'r': + case 'R': me->check_pointer = "ange:"; me->if_ok = miCONTENT_RANGE; me->state = miCHECK; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found R, checking for 'ange:'\n"); break; - case 't': - case 'T': + case 't': + case 'T': me->state = miCONTENT_T; if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found T, state now CONTENT_T\n"); break; - default: + default: if (TRACE) - fprintf(stderr, + fprintf(stderr, "HTMIME: Was CONTENT_, found nothing; bleah\n"); goto bad_field_name; break; - } /* switch on character */ + } /* switch on character */ break; case miCONTENT_L: if (TRACE) - fprintf (stderr, - "HTMIME: in case CONTENT_L\n"); + fprintf (stderr, + "HTMIME: in case CONTENT_L\n"); switch(c) { case 'a': case 'A': me->check_pointer = "nguage:"; me->if_ok = miCONTENT_LANGUAGE; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_L, found A, checking for 'nguage:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found A, checking for 'nguage:'\n"); break; - + case 'e': case 'E': me->check_pointer = "ngth:"; me->if_ok = miCONTENT_LENGTH; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_L, found E, checking for 'ngth:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found E, checking for 'ngth:'\n"); break; - + case 'o': case 'O': me->check_pointer = "cation:"; me->if_ok = miCONTENT_LOCATION; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_L, found O, checking for 'cation:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_L, found O, checking for 'cation:'\n"); break; - + default: - if (TRACE) - fprintf (stderr, - "HTMIME: Was CONTENT_L, found nothing; bleah\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_L, found nothing; bleah\n"); goto bad_field_name; break; - + } /* switch on character */ break; case miCONTENT_T: if (TRACE) - fprintf (stderr, - "HTMIME: in case CONTENT_T\n"); + fprintf (stderr, + "HTMIME: in case CONTENT_T\n"); switch(c) { case 'r': case 'R': me->check_pointer = "ansfer-encoding:"; me->if_ok = miCONTENT_TRANSFER_ENCODING; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_T, found R, checking for 'ansfer-encoding:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_T, found R, checking for 'ansfer-encoding:'\n"); break; - + case 'y': case 'Y': me->check_pointer = "pe:"; me->if_ok = miCONTENT_TYPE; me->state = miCHECK; - if (TRACE) - fprintf(stderr, - "HTMIME: Was CONTENT_T, found Y, checking for 'pe:'\n"); + if (TRACE) + fprintf(stderr, + "HTMIME: Was CONTENT_T, found Y, checking for 'pe:'\n"); break; - + default: - if (TRACE) - fprintf (stderr, - "HTMIME: Was CONTENT_T, found nothing; bleah\n"); + if (TRACE) + fprintf (stderr, + "HTMIME: Was CONTENT_T, found nothing; bleah\n"); goto bad_field_name; break; - + } /* switch on character */ break; @@ -1465,28 +1358,28 @@ PRIVATE void HTMIME_put_character ARGS2( case miVIA: case miWARNING: case miWWW_AUTHENTICATE: - me->field = me->state; /* remember it */ + me->field = me->state; /* remember it */ me->state = miSKIP_GET_VALUE; /* Fall through! */ case miSKIP_GET_VALUE: - if (c == '\n') { + if (c == '\n') { me->fold_state = me->state; me->state = miNEWLINE; break; } if (WHITE(c)) /* - ** Skip white space. + ** Skip white space. */ break; - + me->value_pointer = me->value; - me->state = miGET_VALUE; + me->state = miGET_VALUE; /* Fall through to store first character */ - + case miGET_VALUE: - if (WHITE(c) && c != 32) { /* End of field */ + if (WHITE(c) && c != 32) { /* End of field */ char *cp; *me->value_pointer = '\0'; cp = (me->value_pointer - 1); @@ -1494,41 +1387,41 @@ PRIVATE void HTMIME_put_character ARGS2( /* ** Trim trailing spaces. */ - *cp = '\0'; + *cp = '\0'; switch (me->field) { case miACCEPT_RANGES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Accept-Ranges: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Accept-Ranges: '%s'\n", me->value); - break; + break; case miAGE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Age: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Age: '%s'\n", me->value); - break; + break; case miALLOW: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Allow: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Allow: '%s'\n", me->value); - break; + break; case miALTERNATES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Alternates: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Alternates: '%s'\n", me->value); - break; + break; case miCACHE_CONTROL: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Cache-Control: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Cache-Control: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1545,8 +1438,8 @@ PRIVATE void HTMIME_put_character ARGS2( char *cp1, *cp0 = me->value; while ((cp1 = strstr(cp0, "no-cache")) != NULL) { - cp1 += 8; - while (*cp1 != '\0' && WHITE(*cp1)) + cp1 += 8; + while (*cp1 != '\0' && WHITE(*cp1)) cp1++; if (*cp1 == '\0' || *cp1 == ';') { me->anchor->no_cache = TRUE; @@ -1555,22 +1448,22 @@ PRIVATE void HTMIME_put_character ARGS2( cp0 = cp1; } if (me->anchor->no_cache == TRUE) - break; + break; cp0 = me->value; while ((cp1 = strstr(cp0, "max-age")) != NULL) { - cp1 += 7; - while (*cp1 != '\0' && WHITE(*cp1)) + cp1 += 7; + while (*cp1 != '\0' && WHITE(*cp1)) cp1++; if (*cp1 == '=') { cp1++; while (*cp1 != '\0' && WHITE(*cp1)) - cp1++; + cp1++; if (isdigit((unsigned char)*cp1)) { - cp0 = cp1; + cp0 = cp1; while (isdigit((unsigned char)*cp1)) cp1++; - if (*cp0 == '0' && cp1 == (cp0 + 1)) { - me->anchor->no_cache = TRUE; + if (*cp0 == '0' && cp1 == (cp0 + 1)) { + me->anchor->no_cache = TRUE; break; } } @@ -1578,26 +1471,26 @@ PRIVATE void HTMIME_put_character ARGS2( cp0 = cp1; } } - break; + break; case miCOOKIE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Cookie: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Cookie: '%s'\n", me->value); - break; + break; case miCONNECTION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Connection: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Connection: '%s'\n", me->value); - break; + break; case miCONTENT_BASE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Base: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Base: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1605,12 +1498,12 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->content_base, me->value); - break; + break; case miCONTENT_DISPOSITION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Disposition: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Disposition: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1636,14 +1529,14 @@ PRIVATE void HTMIME_put_character ARGS2( cp++; if (*cp == '\0') break; - while (*cp != '\0' && WHITE(*cp)) + while (*cp != '\0' && WHITE(*cp)) cp++; if (*cp == '\0') break; StrAllocCopy(me->anchor->SugFname, cp); if (*me->anchor->SugFname == '\"') { if ((cp = strchr((me->anchor->SugFname + 1), - '\"')) != NULL) { + '\"')) != NULL) { *(cp + 1) = '\0'; HTMIME_TrimDoubleQuotes(me->anchor->SugFname); } else { @@ -1657,13 +1550,13 @@ PRIVATE void HTMIME_put_character ARGS2( *cp = '\0'; if (*me->anchor->SugFname == '\0') FREE(me->anchor->SugFname); - break; - case miCONTENT_ENCODING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Encoding: '%s'\n", - me->value); + break; + case miCONTENT_ENCODING: + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Encoding: '%s'\n", + me->value); if (!(me->value && *me->value) || !strcasecomp(me->value, "identity")) break; @@ -1678,32 +1571,32 @@ PRIVATE void HTMIME_put_character ARGS2( !strcmp(me->value, "7bit") || !strcmp(me->value, "binary")) { /* - ** Some server indicated "8bit", "7bit" or "binary" - ** inappropriately. We'll ignore it. - FM + ** Some server indicated "8bit", "7bit" or "binary" + ** inappropriately. We'll ignore it. - FM */ if (TRACE) fprintf(stderr, " Ignoring it!\n"); } else { /* - ** Save it to use as a flag for setting - ** up a "www/compressed" target. - FM + ** Save it to use as a flag for setting + ** up a "www/compressed" target. - FM */ StrAllocCopy(me->compression_encoding, me->value); } break; case miCONTENT_FEATURES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Features: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Features: '%s'\n", me->value); - break; + break; case miCONTENT_LANGUAGE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Language: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Language: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1713,31 +1606,31 @@ PRIVATE void HTMIME_put_character ARGS2( for (i = 0; me->value[i]; i++) me->value[i] = TOLOWER(me->value[i]); StrAllocCopy(me->anchor->content_language, me->value); - break; + break; case miCONTENT_LENGTH: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Length: '%s'\n", - me->value); + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Length: '%s'\n", + me->value); if (!(me->value && *me->value)) break; /* ** Convert to integer and indicate in anchor. - FM */ - me->anchor->content_length = atoi(me->value); + me->anchor->content_length = atoi(me->value); if (me->anchor->content_length < 0) me->anchor->content_length = 0; - if (TRACE) - fprintf(stderr, - " Converted to integer: '%d'\n", - me->anchor->content_length); - break; + if (TRACE) + fprintf(stderr, + " Converted to integer: '%d'\n", + me->anchor->content_length); + break; case miCONTENT_LOCATION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Location: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Location: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1745,12 +1638,12 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->content_location, me->value); - break; + break; case miCONTENT_MD5: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-MD5: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-MD5: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1758,20 +1651,20 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->content_md5, me->value); - break; + break; case miCONTENT_RANGE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Range: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Range: '%s'\n", me->value); - break; + break; case miCONTENT_TRANSFER_ENCODING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, "HTMIME: PICKED UP Content-Transfer-Encoding: '%s'\n", - me->value); + me->value); if (!(me->value && *me->value)) break; /* @@ -1780,13 +1673,13 @@ PRIVATE void HTMIME_put_character ARGS2( */ for (i = 0; me->value[i]; i++) me->value[i] = TOLOWER(me->value[i]); - me->encoding = HTAtom_for(me->value); + me->encoding = HTAtom_for(me->value); break; case miCONTENT_TYPE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Content-Type: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Content-Type: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1796,17 +1689,17 @@ PRIVATE void HTMIME_put_character ARGS2( */ for (i = 0, j = 0; me->value[i]; i++) { if (me->value[i] != ' ' && me->value[i] != '\"') { - me->value[j++] = TOLOWER(me->value[i]); + me->value[j++] = TOLOWER(me->value[i]); } } me->value[j] = '\0'; - me->format = HTAtom_for(me->value); + me->format = HTAtom_for(me->value); break; case miDATE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Date: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Date: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1814,19 +1707,19 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->date, me->value); - break; + break; case miETAG: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP ETag: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP ETag: '%s'\n", me->value); - break; + break; case miEXPIRES: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Expires: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Expires: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1834,19 +1727,19 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->expires, me->value); - break; + break; case miKEEP_ALIVE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Keep-Alive: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Keep-Alive: '%s'\n", me->value); - break; + break; case miLAST_MODIFIED: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Last-Modified: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Last-Modified: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1854,26 +1747,26 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->last_modified, me->value); - break; + break; case miLINK: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Link: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Link: '%s'\n", me->value); - break; + break; case miLOCATION: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Location: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Location: '%s'\n", me->value); - break; + break; case miPRAGMA: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Pragma: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Pragma: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1882,33 +1775,33 @@ PRIVATE void HTMIME_put_character ARGS2( */ if (!strcmp(me->value, "no-cache")) me->anchor->no_cache = TRUE; - break; + break; case miPROXY_AUTHENTICATE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Proxy-Authenticate: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Proxy-Authenticate: '%s'\n", me->value); - break; + break; case miPUBLIC: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Public: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Public: '%s'\n", me->value); - break; + break; case miRETRY_AFTER: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Retry-After: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Retry-After: '%s'\n", me->value); - break; + break; case miSAFE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Safe: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Safe: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1919,12 +1812,12 @@ PRIVATE void HTMIME_put_character ARGS2( !strcasecomp(me->value, "TRUE")) { me->anchor->safe = TRUE; } - break; + break; case miSERVER: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Server: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Server: '%s'\n", me->value); if (!(me->value && *me->value)) break; @@ -1932,12 +1825,12 @@ PRIVATE void HTMIME_put_character ARGS2( ** Indicate in anchor. - FM */ StrAllocCopy(me->anchor->server, me->value); - break; + break; case miSET_COOKIE1: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Set-Cookie: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Set-Cookie: '%s'\n", me->value); if (me->set_cookie == NULL) { StrAllocCopy(me->set_cookie, me->value); @@ -1945,12 +1838,12 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCat(me->set_cookie, ", "); StrAllocCat(me->set_cookie, me->value); } - break; + break; case miSET_COOKIE2: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Set-Cookie2: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Set-Cookie2: '%s'\n", me->value); if (me->set_cookie2 == NULL) { StrAllocCopy(me->set_cookie2, me->value); @@ -1958,96 +1851,96 @@ PRIVATE void HTMIME_put_character ARGS2( StrAllocCat(me->set_cookie2, ", "); StrAllocCat(me->set_cookie2, me->value); } - break; + break; case miTITLE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Title: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Title: '%s'\n", me->value); - break; + break; case miTRANSFER_ENCODING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Transfer-Encoding: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Transfer-Encoding: '%s'\n", me->value); - break; + break; case miUPGRADE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Upgrade: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Upgrade: '%s'\n", me->value); - break; + break; case miURI: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP URI: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP URI: '%s'\n", me->value); - break; + break; case miVARY: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Vary: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Vary: '%s'\n", me->value); - break; + break; case miVIA: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Via: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Via: '%s'\n", me->value); - break; + break; case miWARNING: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP Warning: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP Warning: '%s'\n", me->value); - break; + break; case miWWW_AUTHENTICATE: - HTMIME_TrimDoubleQuotes(me->value); - if (TRACE) - fprintf(stderr, - "HTMIME: PICKED UP WWW-Authenticate: '%s'\n", + HTMIME_TrimDoubleQuotes(me->value); + if (TRACE) + fprintf(stderr, + "HTMIME: PICKED UP WWW-Authenticate: '%s'\n", me->value); - break; + break; default: /* Should never get here */ - break; + break; } } else { if (me->value_pointer < me->value + VALUE_SIZE - 1) { - *me->value_pointer++ = c; + *me->value_pointer++ = c; break; } else { - goto value_too_long; + goto value_too_long; } } /* Fall through */ - + case miJUNK_LINE: - if (c == '\n') { + if (c == '\n') { me->state = miNEWLINE; me->fold_state = me->state; } break; - - + + } /* switch on state*/ - + return; - + value_too_long: if (TRACE) - fprintf(stderr, "HTMIME: *** Syntax error. (string too long)\n"); - -bad_field_name: /* Ignore it */ + fprintf(stderr, "HTMIME: *** Syntax error. (string too long)\n"); + +bad_field_name: /* Ignore it */ me->state = miJUNK_LINE; return; - + } @@ -2064,13 +1957,13 @@ PRIVATE void HTMIME_put_string ARGS2( CONST char * p; if (me->state == MIME_TRANSPARENT) { /* Optimisation */ - (*me->targetClass.put_string)(me->target,s); + (*me->targetClass.put_string)(me->target,s); } else if (me->state != MIME_IGNORE) { - if (TRACE) + if (TRACE) fprintf(stderr, "HTMIME: %s\n", s); - for (p=s; *p; p++) + for (p=s; *p; p++) HTMIME_put_character(me, *p); } } @@ -2087,13 +1980,13 @@ PRIVATE void HTMIME_write ARGS3( CONST char * p; if (me->state == MIME_TRANSPARENT) { /* Optimisation */ - (*me->targetClass.put_block)(me->target, s, l); + (*me->targetClass.put_block)(me->target, s, l); } else { - if (TRACE) + if (TRACE) fprintf(stderr, "HTMIME: %.*s\n", l, s); - for (p = s; p < s+l; p++) + for (p = s; p < s+l; p++) HTMIME_put_character(me, *p); } } @@ -2107,7 +2000,7 @@ PRIVATE void HTMIME_free ARGS1( HTStream *, me) { if (me->target) - (*me->targetClass._free)(me->target); + (*me->targetClass._free)(me->target); FREE(me); } @@ -2118,7 +2011,7 @@ PRIVATE void HTMIME_abort ARGS2( HTError, e) { if (me->target) - (*me->targetClass._abort)(me->target, e); + (*me->targetClass._abort)(me->target, e); FREE(me); } @@ -2127,14 +2020,14 @@ PRIVATE void HTMIME_abort ARGS2( ** ----------------------- */ PRIVATE CONST HTStreamClass HTMIME = -{ +{ "MIMEParser", HTMIME_free, HTMIME_abort, HTMIME_put_character, HTMIME_put_string, HTMIME_write -}; +}; /* Subclass-specific Methods @@ -2146,11 +2039,11 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( HTStream *, sink) { HTStream* me; - + me = (HTStream *)calloc(1, sizeof(*me)); if (me == NULL) - outofmem(__FILE__, "HTMIME_new"); - me->isa = &HTMIME; + outofmem(__FILE__, "HTMIMEConvert"); + me->isa = &HTMIME; me->sink = sink; me->anchor = anchor; me->anchor->safe = FALSE; @@ -2169,28 +2062,28 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( FREE(me->anchor->expires); FREE(me->anchor->last_modified); FREE(me->anchor->server); - me->target = NULL; + me->target = NULL; me->state = miBEGINNING_OF_LINE; /* * Sadly enough, change this to always default to WWW_HTML * to parse all text as HTML for the users. - * GAB 06-30-94 + * GAB 06-30-94 * Thanks to Robert Rowland robert@cyclops.pei.edu * * After discussion of the correct handline, should be application/octet- * stream or unknown; causing servers to send a correct content * type. * - * The consequence of using WWW_UNKNOWN is that you end up downloading - * as a binary file what 99.9% of the time is an HTML file, which should - * have been rendered or displayed. So sadly enough, I'm changing it - * back to WWW_HTML, and it will handle the situation like Mosaic does, - * and as Robert Rowland suggested, because being functionally correct - * 99.9% of the time is better than being technically correct but - * functionally nonsensical. - FM + * The consequence of using WWW_UNKNOWN is that you end up downloading + * as a binary file what 99.9% of the time is an HTML file, which should + * have been rendered or displayed. So sadly enough, I'm changing it + * back to WWW_HTML, and it will handle the situation like Mosaic does, + * and as Robert Rowland suggested, because being functionally correct + * 99.9% of the time is better than being technically correct but + * functionally nonsensical. - FM *//*** me->format = WWW_UNKNOWN; - ***/ + ***/ me->format = WWW_HTML; me->targetRep = pres->rep_out; me->boundary = NULL; /* Not set yet */ @@ -2200,9 +2093,11 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( me->compression_encoding = NULL; /* Not set yet */ me->net_ascii = NO; /* Local character set */ HTAnchor_setUCInfoStage(me->anchor, current_char_set, - UCT_STAGE_STRUCTURED, UCT_SETBY_DEFAULT); + UCT_STAGE_STRUCTURED, + UCT_SETBY_DEFAULT); HTAnchor_setUCInfoStage(me->anchor, current_char_set, - UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); + UCT_STAGE_HTEXT, + UCT_SETBY_DEFAULT); return me; } @@ -2213,8 +2108,8 @@ PUBLIC HTStream* HTNetMIME ARGS3( { HTStream* me = HTMIMEConvert(pres,anchor, sink); if (!me) - return NULL; - + return NULL; + me->net_ascii = YES; return me; } @@ -2259,7 +2154,7 @@ PUBLIC HTStream* HTNetMIME ARGS3( ** Written by S. Ichikawa, ** partially inspired by encdec.c of <jh@efd.lth.se>. */ -#define BUFLEN 1024 +#define BUFLEN 1024 #ifdef ESC #undef ESC #endif /* ESC */ @@ -2271,8 +2166,8 @@ PRIVATE char HTmmquote[] = "0123456789ABCDEF"; PRIVATE int HTmmcont = 0; PUBLIC void HTmmdec_base64 ARGS2( - char *, t, - char *, s) + char *, t, + char *, s) { int d, count, j, val; char buf[BUFLEN], *bp, nw[4], *p; @@ -2310,8 +2205,8 @@ PUBLIC void HTmmdec_base64 ARGS2( } PUBLIC void HTmmdec_quote ARGS2( - char *, t, - char *, s) + char *, t, + char *, s) { char buf[BUFLEN], cval, *bp, *p; @@ -2348,8 +2243,8 @@ PUBLIC void HTmmdec_quote ARGS2( ** Generalized HTmmdecode for chartrans - K. Weide 1997-03-06 */ PUBLIC void HTmmdecode ARGS2( - char *, trg, - char *, str) + char *, trg, + char *, str) { char buf[BUFLEN], mmbuf[BUFLEN]; char *s, *t, *u, *qm2; @@ -2358,7 +2253,7 @@ PUBLIC void HTmmdecode ARGS2( buf[0] = '\0'; /* - ** Encoded-words look like + ** Encoded-words look like ** =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= */ for (s = str, u = buf; *s; ) { @@ -2409,7 +2304,7 @@ PUBLIC void HTmmdecode ARGS2( } } for (s = qm2 + 3, t = mmbuf; *s; ) { - if (s[0] == '?' && s[1] == '=') { + if (s[0] == '?' && s[1] == '=') { break; } else { *t++ = *s++; @@ -2422,17 +2317,17 @@ PUBLIC void HTmmdecode ARGS2( *t = '\0'; } if (base64) - HTmmdec_base64(mmbuf, mmbuf); + HTmmdec_base64(mmbuf, mmbuf); if (quote) - HTmmdec_quote(mmbuf, mmbuf); + HTmmdec_quote(mmbuf, mmbuf); for (t = mmbuf; *t; ) - *u++ = *t++; + *u++ = *t++; HTmmcont = 1; /* if (*s == ' ' || *s == '\t') *u++ = *s; */ /* for ( ; *s == ' ' || *s == '\t'; s++) ; */ } else { if (*s != ' ' && *s != '\t') - HTmmcont = 0; + HTmmcont = 0; *u++ = *s++; } } @@ -2445,8 +2340,8 @@ end: ** HTmmdecode for ISO-2022-JP - FM */ PUBLIC void HTmmdecode ARGS2( - char *, trg, - char *, str) + char *, trg, + char *, str) { char buf[BUFLEN], mmbuf[BUFLEN]; char *s, *t, *u; @@ -2473,7 +2368,7 @@ PUBLIC void HTmmdecode ARGS2( } } for (s += 16, t = mmbuf; *s; ) { - if (s[0] == '?' && s[1] == '=') { + if (s[0] == '?' && s[1] == '=') { break; } else { *t++ = *s++; @@ -2486,17 +2381,17 @@ PUBLIC void HTmmdecode ARGS2( *t = '\0'; } if (base64) - HTmmdec_base64(mmbuf, mmbuf); + HTmmdec_base64(mmbuf, mmbuf); if (quote) - HTmmdec_quote(mmbuf, mmbuf); + HTmmdec_quote(mmbuf, mmbuf); for (t = mmbuf; *t; ) - *u++ = *t++; + *u++ = *t++; HTmmcont = 1; /* if (*s == ' ' || *s == '\t') *u++ = *s; */ /* for ( ; *s == ' ' || *s == '\t'; s++) ; */ } else { if (*s != ' ' && *s != '\t') - HTmmcont = 0; + HTmmcont = 0; *u++ = *s++; } } @@ -2506,12 +2401,12 @@ end: } #endif /* NOTDEFINED */ -/* +/* ** Modified for Lynx-jp by Takuya ASADA (and K&Rized by FM). */ #if NOTDEFINED PUBLIC int main ARGS2( - int, ac, + int, ac, char **, av) { FILE *fp; @@ -2566,8 +2461,8 @@ PUBLIC int main ARGS2( ** (The author of this function "rjis" is S. Ichikawa.) */ PUBLIC int HTrjis ARGS2( - char *, t, - char *, s) + char *, t, + char *, s) { char *p, buf[BUFLEN]; int kanji = 0; @@ -2600,7 +2495,7 @@ PUBLIC int HTrjis ARGS2( } *p++ = *s++; } - *p = *s; /* terminate string */ + *p = *s; /* terminate string */ strcpy(t, buf); return 0; @@ -2639,9 +2534,9 @@ PUBLIC int HTmaybekanji ARGS2( { if ((c2 < 33) || (c2 > 126)) - return 0; + return 0; if ((c1 < 33) || ((40 < c1) && (c1 < 48)) || (116 < c1)) - return 0; + return 0; c2 -= 32; switch(c1-32) { case 2: |