+int cs_complete_http(const char *buf, int len)
+{
+ /* deal with HTTP request/response */
+ int i = 2, content_len = 0, chunked = 0;
+
+ if (len < 6)
+ return 0;
+
+ /* if dealing with HTTP responses - then default
+ content length is unlimited (socket close) */
+ if (!memcmp(buf, "HTTP/", 5))
+ content_len = -1;
+
+#if 0
+ printf("len = %d\n", len);
+ fwrite (buf, 1, len, stdout);
+ printf("----------\n");
+#endif
+ while (i <= len-2)
+ {
+ if (i > 8192)