- return 0;
- } else if (isdigit(buf[i]))
- chunk_len = chunk_len * 16 +
- (buf[i++] - '0');
- else if (isupper(buf[i]))
- chunk_len = chunk_len * 16 +
- (buf[i++] - ('A'-10));
- else if (islower(buf[i]))
- chunk_len = chunk_len * 16 +
- (buf[i++] - ('a'-10));
- else
- break;
- /* 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 */
- if (chunk_len == 0)
+ return 0;
+ } else if (isdigit(buf[i]))
+ chunk_len = chunk_len * 16 +
+ (buf[i++] - '0');
+ else if (isupper(buf[i]))
+ chunk_len = chunk_len * 16 +
+ (buf[i++] - ('A'-10));
+ else if (islower(buf[i]))
+ chunk_len = chunk_len * 16 +
+ (buf[i++] - ('a'-10));
+ else