- From: Henrik Frystyk Nielsen <frystyk@w3.org>
- Date: Fri, 09 Aug 1996 18:09:23 -0400
- To: rabih@ceci.mit.edu
- cc: www-lib@w3.org
Rabih Zbib writes: > I am trying to run the library on Windows NT 3.51. The library was > compiled using VC++ 4.0, and the examples are crashing on the followinf > statement: > > if ((status = (*me->target->isa->put_block)(me->target, b, l)) != HT_OK) > > in the function: > > HTMIME_put_block > > I have read previous messages on this list from people complaining about > the same problem, so if any body knows what is the solution, I will > appreciate it if you tell me. This problem has been reported and it's in the latest beta that is currently in W3C member release. If you are a member then you can get it from http://www.w3.org/member/WWW/Library/ and it will also be publicly available August 20th. In the mean time you can probably use this patch which should fix it. It's a substitution for the HTMIME_putBlock() that you can find in the HTMIME.c module. Henrik 0 \ / -- CLIP -- CLIP -- CLIP -- x -- CLIP -- CLIP -- CLIP -- CLIP -- CLIP -- CLIP -- / \ 0 /* ** Header is terminated by CRCR, LFLF, CRLFLF, CRLFCRLF ** Folding is either of CF LWS, LF LWS, CRLF LWS */ PRIVATE int HTMIME_put_block (HTStream * me, const char * b, int l) { const char * start = b; const char * end = start; const char * value = me->value->size ? b : NULL; long cl; int status; /* enum {Line_CHAR, Line_END, Line_FOLD, Line_LINE} line = Line_CHAR; */ while (!me->transparent) { if (me->EOLstate == EOL_FCR) { if (*b == CR) /* End of header */ me->EOLstate = EOL_END; else if (*b == LF) /* CRLF */ me->EOLstate = EOL_FLF; else if (WHITE(*b)) /* Folding: CR SP */ me->EOLstate = EOL_FOLD; else /* New line */ me->EOLstate = EOL_LINE; } else if (me->EOLstate == EOL_FLF) { if (*b == CR) /* LF CR or CR LF CR */ me->EOLstate = EOL_SCR; else if (*b == LF) /* End of header */ me->EOLstate = EOL_END; else if (WHITE(*b)) /* Folding: LF SP or CR LF SP */ me->EOLstate = EOL_FOLD; else /* New line */ me->EOLstate = EOL_LINE; } else if (me->EOLstate == EOL_SCR) { if (*b==CR || *b==LF) /* End of header */ me->EOLstate = EOL_END; else if (WHITE(*b)) /* Folding: LF CR SP or CR LF CR SP */ me->EOLstate = EOL_FOLD; else /* New line */ me->EOLstate = EOL_LINE; } else if (*b == CR) me->EOLstate = EOL_FCR; else if (*b == LF) me->EOLstate = EOL_FLF; /* Line found */ else { if (!me->haveToken) { if (*b == ':' || isspace(*b)) { HTChunk_putb(me->token, start, end-start); HTChunk_putc(me->token, '\0'); me->haveToken = YES; } else { unsigned char ch = *(unsigned char *) b; tolower(ch); /* if (ch >= 'A' && ch <= 'Z') ch += ('a' - 'A'); */ me->hash = (me->hash * 3 + ch) % MIME_HASH_SIZE; } } else if (value == NULL && *b != ':' && !isspace(*b)) value = b; end++; } switch (me->EOLstate) { case EOL_LINE: case EOL_END: { int status; HTChunk_putb(me->value, value, end-value); HTChunk_putc(me->value, '\0'); start=b, end=b; status = _dispatchParsers(me); if (me->EOLstate == EOL_END) { /* EOL_END */ if (status == HT_OK) { b++, l--; status = pumpData(me); } HTNet_setBytesRead(me->net, l); } else { /* EOL_LINE */ HTChunk_clear(me->token); HTChunk_clear(me->value); me->haveToken = NO; me->hash = 0; value = NULL; } me->EOLstate = EOL_BEGIN; if (status != HT_OK) return status; break; } case EOL_FOLD: me->EOLstate = EOL_BEGIN; if (!me->haveToken) { HTChunk_putb(me->token, start, end-start); HTChunk_putc(me->token, '\0'); me->haveToken = YES; } else if (value) { HTChunk_putb(me->value, value, end-value); HTChunk_putc(me->value, ' '); } start=b, end=b; break; default: b++; l--; if (!l) { if (!me->haveToken) HTChunk_putb(me->token, start, end-start); else if (value) HTChunk_putb(me->value, value, end-value); return HT_OK; } } } /* ** Put the rest down the stream without touching the data but make sure ** that we get the correct content length of data */ if (me->target) { if ((status = (*me->target->isa->put_block)(me->target, b, l)) != HT_OK) return status; /* Check if CL at all - thanks to jwei@hal.com (John Wei) */ cl = HTAnchor_length(me->anchor); return (cl>=0 && HTNet_bytesRead(me->net)>=cl) ? HT_LOADED : HT_OK; } return HT_LOADED; }
Received on Friday, 9 August 1996 18:09:29 UTC