diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-05-05 16:27:03 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-05-05 16:27:03 +0200 |
commit | f0612f166a5fa51d09498baa19a327c5cf36941f (patch) | |
tree | 29c442a7c9de7d9b7075ea73456daef845bfbf91 /lib/transfer.c | |
parent | e34131db783336aa17fa0aa664635867459b2a85 (diff) | |
download | curl-f0612f166a5fa51d09498baa19a327c5cf36941f.tar.gz |
RTSP: convert protocol-specific checks to generic
Add a 'readwrite' function to the protocol handler struct and use that
for the extra readwrite functionality RTSP needs.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index d250b106c..87a03aa86 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -467,16 +467,13 @@ static CURLcode readwrite_data(struct SessionHandle *data, in the flow below before the actual storing is done. */ k->str = k->buf; -#ifndef CURL_DISABLE_RTSP - /* Check for RTP at the beginning of the data */ - if(conn->handler->protocol & CURLPROTO_RTSP) { - result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); + if(conn->handler->readwrite) { + result = conn->handler->readwrite(data, conn, &nread, &readmore); if(result) return result; if(readmore) break; } -#endif #ifndef CURL_DISABLE_HTTP /* Since this is a two-state thing, we check if we are parsing @@ -488,17 +485,14 @@ static CURLcode readwrite_data(struct SessionHandle *data, if(result) return result; -#ifndef CURL_DISABLE_RTSP - /* Check for RTP after the headers if there is no Content */ - if(k->maxdownload <= 0 && nread > 0 && - (conn->handler->protocol & CURLPROTO_RTSP)) { - result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); + if(conn->handler->readwrite && + (k->maxdownload <= 0 && nread > 0)) { + result = conn->handler->readwrite(data, conn, &nread, &readmore); if(result) return result; if(readmore) break; } -#endif if(stop_reading) { /* We've stopped dealing with input, get out of the do-while loop */ @@ -765,16 +759,13 @@ static CURLcode readwrite_data(struct SessionHandle *data, } /* if(! header and data to read ) */ -#ifndef CURL_DISABLE_RTSP - if(excess > 0 && !conn->bits.stream_was_rewound && - (conn->handler->protocol & CURLPROTO_RTSP)) { - /* Check for RTP after the content if there is unrewound excess */ - + if(conn->handler->readwrite && + (excess > 0 && !conn->bits.stream_was_rewound)) { /* Parse the excess data */ k->str += nread; nread = (ssize_t)excess; - result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); + result = conn->handler->readwrite(data, conn, &nread, &readmore); if(result) return result; @@ -782,7 +773,6 @@ static CURLcode readwrite_data(struct SessionHandle *data, k->keepon |= KEEP_RECV; /* we're not done reading */ break; } -#endif if(is_empty_data) { /* if we received nothing, the server closed the connection and we |