[rtmpdump] [PATCH 3/4] Don't require 144 bytes to be buffered before proceeding with HTTP_read
Martin Storsjo
martin at martin.st
Mon May 21 17:17:31 CEST 2012
This makes the code more flexible, if servers were to use
smaller headers.
---
librtmp/rtmp.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 4afcecf..58c809d 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -3734,11 +3734,20 @@ HTTP_read(RTMP *r, int fill)
restart:
if (fill)
RTMPSockBuf_Fill(&r->m_sb);
- if (r->m_sb.sb_size < 144)
+ if (r->m_sb.sb_size < 13) {
+ if (fill)
+ goto restart;
return -2;
+ }
if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13))
return -1;
r->m_sb.sb_start[r->m_sb.sb_size] = '\0';
+ if (!strstr(r->m_sb.sb_start, "\r\n\r\n")) {
+ if (fill)
+ goto restart;
+ return -2;
+ }
+
ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200");
while ((ptr = strstr(ptr, "Content-"))) {
if (!strncasecmp(ptr+8, "length:", 7)) break;
--
1.7.9.4
More information about the rtmpdump
mailing list