diff --git a/src/httpc.c b/src/httpc.c index 4bc2dbbc3..742b0f693 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -1026,11 +1026,15 @@ retry: } if (hc->hc_rsize < r + hc->hc_rpos) { - if (hc->hc_rsize + r > hc->hc_io_size + 20*1024) + if (hc->hc_rsize + r > hc->hc_io_size + 20*1024) { + tvhtrace(LS_HTTPC, "%04X: overflow, buf %zd read %zd io %zd", shortid(hc), hc->hc_rsize, r, hc->hc_io_size); + tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, 16); return http_client_flush(hc, -EMSGSIZE); + } hc->hc_rsize += r; hc->hc_rbuf = realloc(hc->hc_rbuf, hc->hc_rsize + 1); } + tvhtrace(LS_HTTPC, "%04X: new data %zd", shortid(hc), r); memcpy(hc->hc_rbuf + hc->hc_rpos, buf, r); hc->hc_rpos += r; @@ -1135,14 +1139,18 @@ rtsp_data: r = 0; hc->hc_in_data = 0; hc->hc_in_rtp_data = 0; + tvhtrace(LS_HTTPC, "%04X: rtsp data %zd", shortid(hc), hc->hc_rpos); while (hc->hc_rpos > r + 3) { if (hc->hc_rbuf[r] != '$') break; hc->hc_csize = 4 + ((hc->hc_rbuf[r+2] << 8) | hc->hc_rbuf[r+3]); + tvhtrace(LS_HTTPC, "%04X: rtsp data chunk %zd", shortid(hc), hc->hc_csize); hc->hc_chunked = 0; if (r + hc->hc_csize > hc->hc_rpos) { http_client_rbuf_cut(hc, r); hc->hc_in_rtp_data = 1; + tvhtrace(LS_HTTPC, "%04X: rtsp data incomplete %zd", shortid(hc), r); + tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, 16); if (r == 0) goto retry; return HTTP_CON_RECEIVING; @@ -1156,6 +1164,7 @@ rtsp_data: if (res < 0) return res; } + tvhtrace(LS_HTTPC, "%04X: rtsp data cont %zd", shortid(hc), hc->hc_csize); r += hc->hc_csize; hc->hc_in_rtp_data = 1; hc->hc_code = 0; @@ -1166,6 +1175,8 @@ rtsp_data: } if (r > 0) { http_client_rbuf_cut(hc, r); + tvhtrace(LS_HTTPC, "%04X: rtsp data next header %zd (cut %zd)", shortid(hc), hc->hc_rpos, r); + tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, 16); goto next_header; } return HTTP_CON_RECEIVING;