+ /* move forward until CRLF - skip chunk ext */
+ j = 0;
+ while (buf[i] != '\r' && buf[i+1] != '\n')
+ {
+ if (i >= len-2)
+ return 0; /* need more buffer .. */
+ if (++j > 1000)
+ return i; /* enough.. stop */
+ i++;
+ }
+ /* got CRLF */
+#if CHUNK_DEBUG
+ printf ("XXXXXX chunk_len=%d\n", chunk_len);
+#endif
+ if (chunk_len < 0)
+ return i+2; /* bad chunk_len */